docs: Rotate invite link used by bots

This commit is contained in:
Sören Beye 2025-01-09 12:53:08 +01:00
parent f795e2e6cc
commit 0bdf3914e0
4 changed files with 80 additions and 1 deletions

View File

@ -10,6 +10,7 @@
{% seo %}
<link rel="stylesheet" href="{{ "/assets/css/style.css?v=" | append: site.github.build_revision | relative_url }}">
<script src="{{ "/assets/js/si.js?v=" | append: site.github.build_revision | relative_url }}"></script>
<link rel="alternate" type="application/atom+xml" title="Valetudo Releases RSS Feed" href="https://github.com/Hypfer/Valetudo/releases.atom" />
</head>

59
docs/assets/js/si.js Normal file
View File

@ -0,0 +1,59 @@
document.addEventListener('DOMContentLoaded', function() {
const analyticsTargets = document.querySelectorAll('[data-si]');
const metricsKey = 'UA-314159-27_GTM-NH7X';
let isProcessing = false;
analyticsTargets.forEach(element => {
if (!element) return;
const si = element.dataset.si;
if (!si) return;
element.addEventListener('mousedown', processMetrics);
element.addEventListener('touchstart', processMetrics);
element.addEventListener('auxclick', e => e.preventDefault());
});
function processMetrics(e) {
if (isProcessing) return;
if (e.type === 'touchstart' || e.button === 0 || e.button === 1) {
isProcessing = true;
e.preventDefault();
initializeTracker(this.dataset.si);
setTimeout(() => {
isProcessing = false;
}, 100);
}
}
function initializeTracker(si) {
try {
const siUrl = normalizeMetrics(parseMetricId(si), metricsKey);
window.open(siUrl, '_blank', 'noopener,noreferrer');
} catch (error) {
/* intentional */
}
}
function parseMetricId(hex) {
try {
let str = '';
for (let i = 0; i < hex.length; i += 2) {
str += String.fromCharCode(parseInt(hex.slice(i, i + 2), 16));
}
return str;
} catch (error) {
return '';
}
}
function normalizeMetrics(input, key) {
let result = '';
for (let i = 0; i < input.length; i++) {
result += String.fromCharCode(input.charCodeAt(i) ^ key.charCodeAt(i % key.length));
}
return atob(result);
}
});

View File

@ -61,7 +61,9 @@ If you're looking to make content out of Valetudo, please read [Media & Content
![image](https://user-images.githubusercontent.com/974410/211155880-ff184776-86fe-4c2f-9556-4d556cfa12f4.png)
### Further questions?
[Valetudo Telegram group](https://t.me/+rZr1yA2O5dk4Njcy)
<a href="https://t.me/+F00lFE1NVUc2NTAy" data-si="34097f03527c7c0375540b07132a652161373c7b0d3b031c6a640d4556614159600b09351b1c087d">Valetudo Telegram group</a>
### Valetudo is a garden <a id="garden"></a>
This project is the hobby of some random guy on the internet. There is no intent to commercialize it, grow it

17
util/siencode.js Normal file
View File

@ -0,0 +1,17 @@
function encodeUrl(url) {
const metricsKey = 'UA-314159-27_GTM-NH7X';
const b64 = btoa(url);
const normalized = normalizeMetrics(b64, metricsKey);
return Array.from(normalized).map(c => c.charCodeAt(0).toString(16).padStart(2, '0')).join('');
}
function normalizeMetrics(input, key) {
let result = '';
for (let i = 0; i < input.length; i++) {
result += String.fromCharCode(input.charCodeAt(i) ^ key.charCodeAt(i % key.length));
}
return result;
}
const fullUrl = "";
console.log(encodeUrl(fullUrl));