some improvements:

- add rules translation
- store language to localstorage
- fall back to english on load fail
This commit is contained in:
Elijah R 2024-01-04 12:26:44 -05:00
parent cd1703da1c
commit 910bfc9372
5 changed files with 16 additions and 29 deletions

26
dist/index.html vendored
View File

@ -41,32 +41,10 @@
<div class="modal-dialog modal-lg">
<div class="modal-content bg-dark text-light">
<div class="modal-header">
<h1>Welcome to CollabVM</h1>
<h1 id="welcomeText">Welcome to CollabVM</h1>
</div>
<div class="modal-body">
<p>Before continuing, please familiarize yourself with our rules:</p>
<h3>R1. Don't break the law.</h3>
Do not use CollabVM or CollabVM's network to violate United States federal law, New York state law, or international law. If CollabVM becomes aware a crime has been committed through its service, you will be immediately banned, and your activities may be reported to the authorities if necessary.<br><br>CollabVM is required by law to notify law enforcement agencies if it becomes aware of the presence of child pornography on, or being transmitted through its network.<br><br>COPPA is also enforced, please do not use CollabVM if you are under the age of 13 years old.
<h3>R2. No running DoS/DDoS tools.</h3>
Do not use CollabVM to DoS/DDoS an indivdiual, business, company, or anyone else.
<h3>R3. No spam distribution.</h3>
Do not spam any emails using this service or push spam in general.
<h3>R4. Do not abuse any exploits.</h3>
Do not abuse any exploits, additionally if you see someone abusing exploits or you need to report one, please contact me at: computernewbab@gmail.com
<h3>R5. Don't impersonate other users.</h3>
Do not impersonate other members of CollabVM. If caught, you'll be temporarily disconnected, and banned if necessary.
<h3>R6. One vote per person.</h3>
Do not use any methods or tools to bypass the vote restriction. Only one vote per person is allowed, no matter what. Anybody who is caught doing this will be banned.
<h3>R7. No Remote Administration Tools.</h3>
Do not use any remote administration tools (ex: DarkComet, NanoCore, Anydesk, TeamViewer, Orcus, etc.)
<h3>R8. No bypassing CollabNet.</h3>
Do not attempt to bypass the blocking provided by CollabNet, especially if it is being used to break Rule 1, Rule 2, or Rule 7 (or run stupid over-used things).
<h3>R9. No performing destructive actions constantly.</h3>
Any user may not destroy the VM (rendering it unusable constantly), install/reinstall the operating system (except on VM7 or VM8), or run bots that do such. This includes bots that spam massive amounts of keyboard/mouse input ("kitting").
<h3>R10. No Cryptomining</h3>
Attempting to mine cryptocurrency on the VMs will result in a kick, and then a permanent ban if you keep attempting. Besides, it's not like you're gonna make any money off it.
<h3>NSFW Warning</h3>
Please note that NSFW content is allowed on our anarchy VM (VM0b0t), and is viewed regularly. In addition, while we give a good effort to keep NSFW off the main VMs, people will occasionally slip it through.
<div id="rulesHtml"></div>
</div>
<div class="modal-footer">
<button type="button" id="welcomeModalDismiss" class="btn btn-primary" data-bs-dismiss="modal">Understood</button>

View File

@ -3,6 +3,7 @@
"Home": "Hauptseite",
"FAQ": "FAQ",
"Rules": "Regeln",
"Welcome to CollabVM": "Willkommen zu CollabVM",
"Do you want to reset the vm?": "Möchten Sie die VM zurücksetzen?",
"Yes": "Ja",
"No": "Nein",
@ -18,5 +19,6 @@
"Turn expires in # seconds.": "Ihre Zeit läuft in # Sekunden aus.",
"Waiting for turn in # seconds.": "In der Reihe warten für # Sekunden.",
"Please wait # seconds before starting another vote.": "Bitte warten Sie # Sekunden bevor Sie noch eine Abstimmung starten.",
"Enter new username": "Geben Sie Ihren neuen Nutzername ein."
"Enter new username": "Geben Sie Ihren neuen Nutzername ein.",
"rulesHTML": "<p>Bevor Sie fortfahren, machen Sie sich bitte mit unseren Regeln vertraut:</p> <h3>R1. Verbrechen Sie nicht das Gesetz.</h3> Verwenden Sie CollabVM oder das CollabVM-Netzwerk nicht, um das Bundesgesetz der Vereinigten Staaten, das Gesetz des Staates New York oder internationales Recht zu verletzen. Wenn CollabVM erfährt, dass eine Straftat durch seinen Dienst begangen wurde, werden Sie sofort gesperrt und Ihre Aktivitäten können den Behörden gemeldet werden, falls erforderlich.<br/> CollabVM ist gesetzlich verpflichtet, die Strafverfolgungsbehörden zu benachrichtigen, wenn es Kenntnis vom Vorhandensein von Kinderpornographie in seinem Netzwerk oder deren Übertragung erhält.<br/> COPPA wird auch durchgesetzt, bitte benutzen Sie CollabVM nicht, wenn Sie unter 13 Jahre alt sind. <h3>R2. Keine DoS/DDoS-Tools.</h3> Benutzen Sie CollabVM nicht, um DoS/DDoS gegen eine Einzelperson, ein Geschäft, ein Unternehmen oder eine andere Person zu betreiben.<h3>R3. Kein Spam-Versand.</h3> Verwenden Sie diesen Dienst nicht zum Versenden von Spam-E-Mails oder zum Versenden von Spam im Allgemeinen.<h3>R4. Keinen Missbrauch von Exploits.</h3> Missbrauche keine Exploits. Wenn Sie jemanden sehen, der Exploits missbraucht, oder wenn Sie einen Exploit melden möchtest, kontaktiere mich bitte unter: computernewbab@gmail.com <h3>R5. Geben Sie sich nicht als andere Benutzer aus.</h3> Geben Sie sich nicht als andere Mitglieder von CollabVM aus. Wenn Sie erwischt werden, werden Sie vorübergehend von der Verbindung getrennt und gegebenenfalls gesperrt. <h3>R6. Eine Stimme pro Person.</h3> Verwenden Sie keine Methoden oder Hilfsmittel, um die Abstimmungsbeschränkung zu umgehen. Es ist nur eine Stimme pro Person erlaubt, egal wie. Jeder, der dabei erwischt wird, wird gebannt. <h3>R7. Keine Fernadministrations-Tools.</h3> Es dürfen keine Fernadministrations-Tools verwendet werden (z.B. DarkComet, NanoCore, Anydesk, TeamViewer, Orcus, uzw.)<h3>R8. Kein Umgehen von CollabNet</h3> Versuchen Sie nicht, die von CollabNet bereitgestellten Sperren zu umgehen, insbesondere dann nicht, wenn sie dazu benutzt werden, Regel 1, Regel 2 oder Regel 7 zu brechen (oder dumme, übermäßige Dinge auszuführen).<h3>R9. Keine ständigen destruktiven Aktionen durchführen.</h3> Jeder Nutzer darf die VM nicht zerstören (was es ständig unbrauchbar macht), ein anderes Betriebssystem installieren oder das Betriebssystem neu installieren (außer auf VM7 oder VM8) oder Bots ausführen, die dies tun. Dies schließt Bots ein, die massive Mengen an Tastatur-/Mauseingaben spammen (so genanntes \"Kitting\"). <h3>R10. Kein Cryptomining</h3> Der Versuch, auf den VMs Kryptowährungen zu \"schürfen\", führt zu einem Kick und dann zu einem permanenten Bann, wenn Sie es weiter versuchen. Außerdem ist es ja nicht so, dass Sie damit Geld verdienen würden.<h3>NSFW-Warnung</h3> Bitte beachten Sie, dass NSFW-Inhalte auf unserer Anarcho-VM (VM0b0t) erlaubt sind und regelmäßig angesehen werden. Obwohl wir uns bemühen, NSFW von den Haupt-VMs fernzuhalten, kann es vorkommen, dass was durchrutscht. </div>"
}

View File

@ -3,6 +3,7 @@
"Home": "Home",
"FAQ": "FAQ",
"Rules": "Rules",
"Welcome to CollabVM": "Welcome to CollabVM",
"Do you want to reset the vm?": "Do you want to reset the vm?",
"Yes": "Yes",
"No": "No",
@ -18,5 +19,6 @@
"Turn expires in # seconds.": "Turn expires in # seconds.",
"Waiting for turn in # seconds.": "Waiting for turn in # seconds.",
"Please wait # seconds before starting another vote.": "Please wait # seconds before starting another vote.",
"Enter new username": "Enter new username"
"Enter new username": "Enter new username",
"rulesHTML": "<p>Before continuing, please familiarize yourself with our rules:</p> <h3>R1. Don't break the law.</h3> Do not use CollabVM or CollabVM's network to violate United States federal law, New York state law, or international law. If CollabVM becomes aware a crime has been committed through its service, you will be immediately banned, and your activities may be reported to the authorities if necessary.<br><br>CollabVM is required by law to notify law enforcement agencies if it becomes aware of the presence of child pornography on, or being transmitted through its network.<br><br>COPPA is also enforced, please do not use CollabVM if you are under the age of 13 years old. <h3>R2. No running DoS/DDoS tools.</h3> Do not use CollabVM to DoS/DDoS an indivdiual, business, company, or anyone else. <h3>R3. No spam distribution.</h3> Do not spam any emails using this service or push spam in general. <h3>R4. Do not abuse any exploits.</h3> Do not abuse any exploits, additionally if you see someone abusing exploits or you need to report one, please contact me at: computernewbab@gmail.com <h3>R5. Don't impersonate other users.</h3> Do not impersonate other members of CollabVM. If caught, you'll be temporarily disconnected, and banned if necessary. <h3>R6. One vote per person.</h3> Do not use any methods or tools to bypass the vote restriction. Only one vote per person is allowed, no matter what. Anybody who is caught doing this will be banned. <h3>R7. No Remote Administration Tools.</h3> Do not use any remote administration tools (ex: DarkComet, NanoCore, Anydesk, TeamViewer, Orcus, etc.) <h3>R8. No bypassing CollabNet.</h3> Do not attempt to bypass the blocking provided by CollabNet, especially if it is being used to break Rule 1, Rule 2, or Rule 7 (or run stupid over-used things). <h3>R9. No performing destructive actions constantly.</h3> Any user may not destroy the VM (rendering it unusable constantly), install/reinstall the operating system (except on VM7 or VM8), or run bots that do such. This includes bots that spam massive amounts of keyboard/mouse input (\"kitting\"). <h3>R10. No Cryptomining</h3> Attempting to mine cryptocurrency on the VMs will result in a kick, and then a permanent ban if you keep attempting. Besides, it's not like you're gonna make any money off it. <h3>NSFW Warning</h3> Please note that NSFW content is allowed on our anarchy VM (VM0b0t), and is viewed regularly. In addition, while we give a good effort to keep NSFW off the main VMs, people will occasionally slip it through."
}

View File

@ -54,6 +54,7 @@ export default class i18n {
this.lang = lang;
this.data = res;
this.replaceAllInDOM();
window.localStorage.setItem("cvm-lang", lang);
}).catch((e) => {
console.log(e);
return alert(`i18n error: Failed to load language file for ${lang}. Alert a site administrator!`);
@ -67,6 +68,7 @@ export default class i18n {
{ id: "homeText", key: "Home" },
{ id: "faqLink", key: "FAQ" },
{ id: "rulesLink", key: "Rules" },
{ id: "welcomeText", key: "Welcome to CollabVM" },
{ id: "onlineUserText", key: "Users Online" },
{ id: "voteResetText", key: "Do you want to reset the vm?" },
{ id: "voteYesText", key: "Yes" },
@ -76,13 +78,14 @@ export default class i18n {
{ id: "takeTurnButtonText", key: "Take Turn" },
{ id: "changeUsernameButtonText", key: "Change Username" },
{ id: "voteResetButtonText", key: "Vote for Reset" },
{ id: "screenshotButtonText", key: "Screenshot" }
{ id: "screenshotButtonText", key: "Screenshot" },
{ id: "rulesHtml", key: "rulesHTML"}
];
elements.forEach(el => {
var element = document.getElementById(el.id);
if (element != null) {
element.innerText = ` ${this.get(el.key)}`;
element.innerHTML = ` ${this.get(el.key)}`;
} else {
console.warn(`${el.id} was null (would have assigned ${this.get(el.key)})`)
}

View File

@ -7,9 +7,11 @@ import doCaptcha from "./captcha";
import i18n from "./i18n";
// i18n
window.i18n = new i18n(navigator.language.split("-")[0]);
window.i18n = new i18n(localStorage.getItem("cvm-lang") || navigator.language.split("-")[0]);
window.i18n.init().then(() => {
window.i18n.replaceAllInDOM();
}).catch(() => {
window.i18n.change("en");
});
// None = -1