fix typo, refactor and add da language

This commit is contained in:
sallbet 2023-03-13 03:05:46 +03:00 committed by HF
parent f668c025f2
commit b91dcac040
97 changed files with 2309 additions and 290 deletions

1570
i18n/da.po Normal file

File diff suppressed because it is too large Load Diff

471
i18n/ssr-da.po Normal file
View File

@ -0,0 +1,471 @@
msgid ""
msgstr ""
"Project-Id-Version: \n"
"POT-Creation-Date: \n"
"PO-Revision-Date: \n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: da\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Generator: Poedit 3.2.2\n"
#: src/core/ChatProvider.js:434
msgid "You can not send chat messages with proxy"
msgstr "Du kan ikke sende chat beskeder med proxy"
#: src/core/ChatProvider.js:436
msgid "Your country is temporary muted from this chat channel"
msgstr "Dit land er midlertidigt gjort stum i denne chat kanal"
#: src/core/ChatProvider.js:439
msgid "You are permanently muted, join our guilded to apppeal the mute"
msgstr ""
"Du er permanent gjort stum, Tilslut dig til vores Guilded for at appellere "
"om at du blev gjort stum"
#: src/core/ChatProvider.js:441
msgid "You are banned"
msgstr "Du er bannet"
#: src/core/ChatProvider.js:443
msgid "Your Internet Provider is banned"
msgstr "Din Internetudbyder er bannet"
#: src/core/ChatProvider.js:448
#, javascript-format
msgid "You are muted for another ${ timeMin } minutes"
msgstr "Du er gjort stum for en anden ${ timeMin } minutes"
#: src/core/ChatProvider.js:450
msgid "You are muted for another ${ ttl } seconds"
msgstr "Du er gjort stum for en anden ${ ttl } Sekunder"
#: src/core/ChatProvider.js:467
#, javascript-format
msgid "You are sending messages too fast, you have to wait ${ waitTime }s :("
msgstr "Du sender beskeder for hurtigt, du skal vente ${ waitTime }s :("
#: src/core/ChatProvider.js:471
msgid "You don't have access to this channel"
msgstr "Du har ikke tilladelse til at se denne kanal"
#: src/core/ChatProvider.js:488
msgid "Your mail has to be verified in order to chat"
msgstr "Din mail skal være bekræftet for at chatte"
#: src/core/ChatProvider.js:498
msgid "You can't send a message this long :("
msgstr "Du kan ikke sende en besked så lang :("
#: src/core/ChatProvider.js:502
msgid "Please use int channel"
msgstr "Venligst brug int kanal"
#: src/core/ChatProvider.js:510
msgid "Stop flooding."
msgstr "Lad være med at oversvømme chatten."
#: src/routes/reset_password.js:39
msgid "You sent an empty password or invalid data :("
msgstr "Du sendte en tom adgangskode eller ugyldig data :("
#: src/routes/reset_password.js:51
msgid "This password-reset link isn't valid anymore :("
msgstr "Dette adgangskode-nulstillings link er ikke længere gyldig :("
#: src/routes/reset_password.js:62
msgid "Your passwords do not match :("
msgstr "Dine adgangskoder matcher ikke :("
#: src/routes/reset_password.js:77
msgid "User doesn't exist in our database :("
msgstr "Bruger eksisterer ikke i vores database :("
#: src/routes/reset_password.js:89
msgid "Passowrd successfully changed."
msgstr "Adgangskode blev succesfuldt ændret."
#: src/routes/reset_password.js:108
msgid "Invalid url :( Please check your mail again."
msgstr "Ugyldig url :( Venligst tjek din mail igen."
#: src/ssr/Globe.jsx:32
msgid "PixelPlanet.Fun 3DGlobe"
msgstr "PixelPlanet.Fun 3DGlobus"
#: src/ssr/Globe.jsx:33
msgid "A 3D globe of our whole map"
msgstr "En 3D klode af hele vores kort"
#: src/ssr/Globe.jsx:46
msgid "Double click on globe to go back."
msgstr "Dobbeltklik på kloden for at gå tilbage."
#: src/ssr/Globe.jsx:47
msgid "Loading..."
msgstr "Indlæser..."
#: src/ssr/PopUp.jsx:58
msgid "ppfun"
msgstr "ppfun"
#: src/ssr/PopUp.jsx:59
msgid "PixelPlanet.Fun PopUp"
msgstr "PixelPlanet.Fun PopUp"
#: src/ssr/Main.jsx:67
msgid "PixelPlanet.Fun"
msgstr "PixelPlanet.Fun"
#: src/ssr/Main.jsx:68
msgid "Place color pixels on an map styled canvas with other players online"
msgstr ""
"Placer farvede pixels på et kort-stilet kanvas med andre spillere online"
#: src/utils/validation.js:17
msgid "Email can't be empty."
msgstr "Email må ikke være tom."
#: src/utils/validation.js:18
msgid "Email should be at least 5 characters long."
msgstr "Email skal være mindst 5 tegn lang."
#: src/utils/validation.js:19
msgid "Email can't be longer than 40 characters."
msgstr "Email kan ikke være længere end 40 tegn."
#: src/utils/validation.js:20
msgid "Email should at least contain a dot"
msgstr "Email skal indeholde i det mindste én prik"
#: src/utils/validation.js:22
msgid "Email should contain a @"
msgstr "Email skal indeholde et @"
#: src/utils/validation.js:29
msgid "Name can't be empty."
msgstr "Navn kan ikke være tomt."
#: src/utils/validation.js:30
msgid "Name must be at least 2 characters long"
msgstr "Navn skal være mindst 2 tegn langt"
#: src/utils/validation.js:31
msgid "Name must be shorter than 26 characters"
msgstr "Navn skal være kortere end 26 tegn"
#: src/utils/validation.js:38
msgid "Name contains invalid character like @, /, \\ or #"
msgstr "Navn indeholder ugyldige tegn f.eks. @, /, \\ eller #"
#: src/utils/validation.js:53
msgid "No password given."
msgstr "Ingen adgangskode angivet."
#: src/utils/validation.js:56
msgid "Password must be at least 6 characters long."
msgstr "Adgangskode skal være mindst 6 tegn lang."
#: src/utils/validation.js:59
msgid "Password must be shorter than 60 characters."
msgstr "Adgangskode skal være kortere end 60 tegn."
#: src/ssr/PasswordReset.jsx:20 src/ssr/PasswordReset.jsx:40
msgid "PixelPlanet.fun Password Reset"
msgstr "PixelPlanet.fun Adgangskode Nulstilling"
#: src/ssr/PasswordReset.jsx:21 src/ssr/PasswordReset.jsx:41
msgid "Reset your password here"
msgstr "Nulstil din adgangskode her"
#: src/core/MailProvider.js:105 src/ssr/PasswordReset.jsx:28
#: src/ssr/PasswordReset.jsx:49
msgid "Reset Password"
msgstr "Nulstil Adgangskode"
#: src/ssr/PasswordReset.jsx:30 src/ssr/RedirectionPage.jsx:12
msgid "Click here"
msgstr "Klik her"
#: src/ssr/PasswordReset.jsx:30
msgid "to go back to pixelplanet"
msgstr "for at gå tilbage til pixelplanet"
#: src/ssr/PasswordReset.jsx:50
#, javascript-format
msgid "Hello ${ name }, you can set your new password here:"
msgstr "Hej ${ name }, du kan skrive din nye adgangskode her:"
#: src/ssr/PasswordReset.jsx:54
msgid "New Password"
msgstr "Nye adgangskode"
#: src/ssr/PasswordReset.jsx:60
msgid "Confirm New Password"
msgstr "Bekræft Nye Adgangskode"
#: src/ssr/PasswordReset.jsx:65
msgid "Submit"
msgstr "Indsend"
#: src/routes/api/modtools.js:53
msgid "You are not logged in"
msgstr "Du er ikke logget ind"
#: src/routes/api/modtools.js:65
msgid "You are not allowed to access this page"
msgstr "Du er ikke tilladt til at få adgang til denne side"
#: src/routes/api/modtools.js:207
msgid "Just admins can do that"
msgstr "Kun administratorer kan gøre det"
#: src/routes/api/baninfo.js:32
msgid "You are not banned"
msgstr "Du er ikke bannet"
#: src/routes/api/auth/change_mail.js:21 src/routes/api/auth/register.js:24
msgid "This email provider is not allowed"
msgstr "Denne email udbyder er ikke tilladt"
#: src/routes/api/auth/register.js:31
msgid "No Captcha given"
msgstr "Ingen Captcha angivet"
#: src/routes/api/auth/register.js:34
msgid "E-Mail already in use."
msgstr "E-Mail allerede i brug."
#: src/routes/api/auth/register.js:36
msgid "Username already in use."
msgstr "Brugernavn allerede i brug."
#: src/routes/api/auth/register.js:59
msgid "You took too long, try again."
msgstr "Du tog for lang tid, prøv igen."
#: src/routes/api/auth/register.js:62
msgid "You failed your captcha"
msgstr "Du fejlede din captcha"
#: src/routes/api/auth/register.js:65
msgid "Unknown Captcha Error"
msgstr "Ukendt Captcha Fejl"
#: src/routes/api/auth/register.js:89
msgid "Failed to create new user :("
msgstr "Kunne ikke oprette ny bruger :("
#: src/routes/api/auth/register.js:105
msgid "Failed to establish session after register :("
msgstr "Kunne ikke oprette session efter registrering :("
#: src/routes/api/auth/logout.js:11
msgid "You are not even logged in."
msgstr "Du er engang logget in."
#: src/routes/api/auth/delete_account.js:55 src/routes/api/auth/logout.js:20
msgid "Server error when logging out."
msgstr "Server fejl ved log ud."
#: src/routes/api/auth/change_mail.js:43
#: src/routes/api/auth/change_passwd.js:34
#: src/routes/api/auth/delete_account.js:35
msgid "You are not authenticated."
msgstr "Du er ikke godkendt."
#: src/routes/api/auth/change_mail.js:52
#: src/routes/api/auth/change_passwd.js:43
#: src/routes/api/auth/delete_account.js:45
msgid "Incorrect password!"
msgstr "Forkerte adgangskode!"
#: src/routes/api/auth/verify.js:26 src/routes/api/auth/verify.js:35
msgid "Mail verification"
msgstr "Mail Bekræftelse"
#: src/routes/api/auth/verify.js:27
msgid "You are now verified :)"
msgstr "Du er nu bekræftet"
#: src/routes/api/auth/verify.js:35
msgid ""
"Your mail verification code is invalid or already expired :(, please request "
"a new one."
msgstr ""
"Din mail bekræftelseskode er ugyldig eller allerede udløbet :(, venligst "
"anmod om en ny en."
#: src/ssr/RedirectionPage.jsx:19
msgid "PixelPlanet.fun Accounts"
msgstr "PixelPlanet.fun Kontoer"
#: src/ssr/RedirectionPage.jsx:29
msgid "You will be automatically redirected after 15s"
msgstr "Du vil blive automatisk omdirigeret efter 15s"
#: src/ssr/RedirectionPage.jsx:30
#, javascript-format
msgid "Or ${ clickHere } to go back to pixelplanet"
msgstr "Eller ${ clickHere } for at gå tilbage til pixelplanet"
#: src/canvasesDesc.js:19
msgid "Earth"
msgstr "Jorden"
#: src/canvasesDesc.js:20
msgid "Moon"
msgstr "Måne"
#: src/canvasesDesc.js:21
msgid "3D Canvas"
msgstr "3D Kanvas"
#: src/canvasesDesc.js:22
msgid "Coronavirus"
msgstr "Koronavirus"
#: src/canvasesDesc.js:23
msgid "PixelZone"
msgstr "PixelZone"
#: src/canvasesDesc.js:24
msgid "PixelCanvas"
msgstr "PixelKanvas"
#: src/canvasesDesc.js:25
msgid "1bit"
msgstr "1bit"
#: src/canvasesDesc.js:26
msgid "Top10"
msgstr "Top10"
#: src/canvasesDesc.js:29
msgid "Our main canvas, a huge map of the world. Place everywhere you like"
msgstr "Vores hovedkanvas, et kæmpe verdenskort. Placer hvor end du vil"
#: src/canvasesDesc.js:30
msgid ""
"Moon canvas. Safe space for art. No flags or large text (unless part of art) "
"or art larger than 1.5k x 1.5k pixels."
msgstr ""
"Måne kanvas. Sikkert sted for kunst. Ingen flager eller stor text (undtagen "
"hvis del af kunst) eller større end 1,5k x 1,5k pixels."
#: src/canvasesDesc.js:31
msgid "Place Voxels on a 3D canvas with others"
msgstr "Placer Voxels på et 3D kanvas med andre"
#: src/canvasesDesc.js:32
msgid "Special canvas to spread awareness of SARS-CoV2"
msgstr "Specielt kanvas for at sprede viden om SARS-CoV2"
#: src/canvasesDesc.js:33
msgid "Mirror of PixelZone"
msgstr "Spejl af PixelZone"
#: src/canvasesDesc.js:34
msgid "Mirror of PixelCanvas"
msgstr "Spejl af Pixelcanvas"
#: src/canvasesDesc.js:35
msgid "Black and White canvas"
msgstr "Sort og hvid kanvas"
#: src/canvasesDesc.js:36
msgid ""
"A canvas for the most active players from the the previous day. Daily "
"ranking updates at 00:00 UTC."
msgstr ""
"Et kanvas for de mest aktive spillere fra den tidligere dag. Daglig "
"rangering opdaterer kl. 00:00 UTC."
#: src/core/MailProvider.js:66
#, javascript-format
msgid "Welcome ${ name } to PixelPlanet, plese verify your mail"
msgstr "Velkommen ${ name } til PixelPlanet, venligst bekræft din mail"
#: src/core/MailProvider.js:67
msgid "Hello ${ name }"
msgstr "Hej ${ name }"
#: src/core/MailProvider.js:68
msgid ""
"welcome to our little community of pixelplacers, to use your account, you "
"have to verify your mail. You can do that here: "
msgstr ""
"velkommen til vores lille samfund of pixelplacere, for at bruge din konto, "
"har du brug for at bekræfte din mail. Du kan gøre det her: "
#: src/core/MailProvider.js:68
msgid "Click to Verify"
msgstr "Klik for at Bekræfte"
#: src/core/MailProvider.js:68 src/core/MailProvider.js:105
msgid "Or by copying following url:"
msgstr "Eller ved at kopiere følgende url:"
#: src/core/MailProvider.js:69
msgid ""
"Have fun and don't hesitate to contact us if you encouter any problems :)"
msgstr ""
"Hav' det sjovt og tøv ikke med at kontakte os hvis du støder på nogle "
"problemer :)"
#: src/core/MailProvider.js:70 src/core/MailProvider.js:107
msgid "Thanks"
msgstr "Tak"
#: src/core/MailProvider.js:87
#, javascript-format
msgid ""
"We already sent you a verification mail, you can request another one in "
"${ minLeft } minutes."
msgstr ""
"Vi har allerede sendt dig en bekræftelsesmail, du kan anmode om endnu en om "
"${ minLeft } minutter."
#: src/core/MailProvider.js:103
msgid "You forgot your password for PixelPlanet? Get a new one here"
msgstr "Glemt din adgangskode for PixelPlanet? Få en ny en her"
#: src/core/MailProvider.js:104
msgid "Hello"
msgstr "Hello"
#: src/core/MailProvider.js:105
msgid ""
"You requested to get a new password. You can change your password within the "
"next 30min here: "
msgstr ""
"Du anmodet om en ny adgangskode. Du kan ændre din adgangskode inden for de "
"næste 30min her: "
#: src/core/MailProvider.js:106
#, javascript-format
msgid ""
"If you did not request this mail, please just ignore it (the ip that "
"requested this mail was ${ ip })."
msgstr ""
"Hvis du ikke anmodet om denne mail, venligst bare ignorerer den (ip'en der "
"anmodet om denne mail var ${ ip })."
#: src/core/MailProvider.js:114
msgid "Mail is not configured on the server"
msgstr "Mail er ikke konfigureret på serveren"
#: src/core/MailProvider.js:122
msgid ""
"We already sent you a mail with instructions. Please wait before requesting "
"another mail."
msgstr ""
"Vi har allerede sendt dig en mail med instruktioner. Venligst vent før du "
"anmoder om en ny mail."
#: src/core/MailProvider.js:130
msgid "Couldn't find this mail in our database"
msgstr "Kunne ikke finde denne mail i vores database"

View File

@ -18,9 +18,9 @@ import { createClient } from 'redis';
import { import {
updateBackupRedis,
createPngBackup, createPngBackup,
incrementialBackupRedis, incrementalBackupRedis,
updateBackupRedis,
} from './core/tilesBackup'; } from './core/tilesBackup';
import canvases from './core/canvases'; import canvases from './core/canvases';
@ -122,8 +122,7 @@ function getDateFolder() {
if (month < 10) month = `0${month}`; if (month < 10) month = `0${month}`;
if (day < 10) day = `0${day}`; if (day < 10) day = `0${day}`;
const dayDir = `${date.getUTCFullYear()}/${month}/${day}`; const dayDir = `${date.getUTCFullYear()}/${month}/${day}`;
const backupDir = `${dir}/${dayDir}`; return `${dir}/${dayDir}`;
return backupDir;
} }
async function dailyBackup() { async function dailyBackup() {
@ -139,25 +138,25 @@ async function dailyBackup() {
await createPngBackup(backupRedis, canvases, backupDir); await createPngBackup(backupRedis, canvases, backupDir);
} catch (e) { } catch (e) {
fs.rmSync(backupDir, { recursive: true }); fs.rmSync(backupDir, { recursive: true });
console.log('Error occured during daily backup', e); console.log('Error occurred during daily backup', e);
} }
console.log('Daily full backup done'); console.log('Daily full backup done');
} }
async function incrementialBackup() { async function incrementalBackup() {
const backupDir = getDateFolder(); const backupDir = getDateFolder();
if (!fs.existsSync(backupDir)) { if (!fs.existsSync(backupDir)) {
fs.mkdirSync(backupDir, { recursive: true }); fs.mkdirSync(backupDir, { recursive: true });
} }
try { try {
await incrementialBackupRedis( await incrementalBackupRedis(
canvasRedis, canvasRedis,
backupRedis, backupRedis,
canvases, canvases,
backupDir, backupDir,
); );
} catch (e) { } catch (e) {
console.log('Error occured during incremential backup', e); console.log('Error occurred during incremental backup', e);
} }
} }
@ -166,7 +165,7 @@ async function trigger() {
if (!fs.existsSync(backupDir)) { if (!fs.existsSync(backupDir)) {
await dailyBackup(); await dailyBackup();
} else { } else {
await incrementialBackup(); await incrementalBackup();
} }
if (CMD) { if (CMD) {
runCmd(CMD); runCmd(CMD);

View File

@ -39,21 +39,21 @@ function getCanvases(t) {
* no edit below here needed when adding/removing canvas * no edit below here needed when adding/removing canvas
*/ */
const localicedCanvases = {}; const localizedCanvases = {};
const canvasKeys = Object.keys(canvases); const canvasKeys = Object.keys(canvases);
for (let i = 0; i < canvasKeys.length; i += 1) { for (let i = 0; i < canvasKeys.length; i += 1) {
const key = canvasKeys[i]; const key = canvasKeys[i];
localicedCanvases[key] = { ...canvases[key] }; localizedCanvases[key] = { ...canvases[key] };
localicedCanvases[key].desc = canvasDesc[key] localizedCanvases[key].desc = canvasDesc[key]
|| canvases[key].desc || canvases[key].desc
|| `Canvas ${key}`; || `Canvas ${key}`;
localicedCanvases[key].title = canvasTitles[key] localizedCanvases[key].title = canvasTitles[key]
|| canvases[key].title || canvases[key].title
|| `Canvas ${key}`; || `Canvas ${key}`;
} }
return localicedCanvases; return localizedCanvases;
} }
const lCanvases = {}; const lCanvases = {};
@ -64,7 +64,7 @@ const lCanvases = {};
}); });
})(); })();
export function getLocalicedCanvases(lang) { export function getLocalizedCanvases(lang) {
return lCanvases[lang] || lCanvases.default; return lCanvases[lang] || lCanvases.default;
} }

View File

@ -63,7 +63,7 @@ const BanInfo = ({ close }) => {
return ( return (
<div style={{ userSelect: 'text' }}> <div style={{ userSelect: 'text' }}>
<p> <p>
{t`You are banned. You think it is unjustifed? Check out the `} {t`You are banned. You think it is unjustified? Check out the `}
<span <span
role="button" role="button"
tabIndex={0} tabIndex={0}

View File

@ -25,7 +25,7 @@ const MdLink = ({ href, title, refEmbed }) => {
const desc = getLinkDesc(href); const desc = getLinkDesc(href);
// treat pixelplanet links seperately // treat pixelplanet links separately
if (desc === window.location.hostname && href.includes('/#')) { if (desc === window.location.hostname && href.includes('/#')) {
const coords = href.substring(href.indexOf('/#') + 1); const coords = href.substring(href.indexOf('/#') + 1);
if (isPopUp() && window.opener && !window.opener.closed) { if (isPopUp() && window.opener && !window.opener.closed) {

View File

@ -40,7 +40,7 @@ function getStylesByWindowSize(
paletteCols = 5; paletteCols = 5;
flexDirection = 'row'; flexDirection = 'row';
} else { } else {
// ordinary palette (one or two colums) // ordinary palette (one or two columns)
spanSize = 24; spanSize = 24;
paletteCols = (windowHeight < 801) ? 2 : 1; paletteCols = (windowHeight < 801) ? 2 : 1;
flexDirection = 'column'; flexDirection = 'column';

View File

@ -5,7 +5,7 @@
import React, { useMemo } from 'react'; import React, { useMemo } from 'react';
import { useSelector, useDispatch } from 'react-redux'; import { useSelector, useDispatch } from 'react-redux';
import { selectWindowType, selectWIndowArgs } from '../store/selectors/popup'; import { selectWindowType, selectWindowArgs } from '../store/selectors/popup';
import { import {
setWindowArgs, setWindowArgs,
setWindowTitle, setWindowTitle,
@ -16,7 +16,7 @@ import COMPONENTS from './windows';
const UIPopUp = () => { const UIPopUp = () => {
const windowType = useSelector(selectWindowType); const windowType = useSelector(selectWindowType);
const args = useSelector(selectWIndowArgs); const args = useSelector(selectWindowArgs);
const [Content] = COMPONENTS[windowType]; const [Content] = COMPONENTS[windowType];
@ -27,7 +27,7 @@ const UIPopUp = () => {
setArgs: (newArgs) => dispatch(setWindowArgs(newArgs)), setArgs: (newArgs) => dispatch(setWindowArgs(newArgs)),
setTitle: (title) => dispatch(setWindowTitle(title)), setTitle: (title) => dispatch(setWindowTitle(title)),
// eslint-disable-next-line max-len // eslint-disable-next-line max-len
changeType: (newType, newTitel, newArgs) => dispatch(changeWindowType(newType, newTitel, newArgs)), changeType: (newType, newTitle, newArgs) => dispatch(changeWindowType(newType, newTitle, newArgs)),
}), [args]); }), [args]);
return ( return (

View File

@ -59,7 +59,7 @@ const UserAreaContent = () => {
<div className="content"> <div className="content">
<UserMessages /> <UserMessages />
<Stat <Stat
text={t`Todays Placed Pixels`} text={t`Today Placed Pixels`}
value={stats.dailyTotalPixels} value={stats.dailyTotalPixels}
/> />
<Stat <Stat

View File

@ -40,10 +40,10 @@ const Window = ({ id }) => {
const resizeRef = useRef(); const resizeRef = useRef();
const selectWindowById = useMemo(() => makeSelectWindowById(id), []); const selectWindowById = useMemo(() => makeSelectWindowById(id), []);
const selectWIndowPosById = useMemo(() => makeSelectWindowPosById(id), []); const selectWindowPosById = useMemo(() => makeSelectWindowPosById(id), []);
const selectWindowArgs = useMemo(() => makeSelectWindowArgs(id), []); const selectWindowArgs = useMemo(() => makeSelectWindowArgs(id), []);
const win = useSelector(selectWindowById); const win = useSelector(selectWindowById);
const position = useSelector(selectWIndowPosById); const position = useSelector(selectWindowPosById);
const showWindows = useSelector(selectShowWindows); const showWindows = useSelector(selectShowWindows);
const args = useSelector(selectWindowArgs); const args = useSelector(selectWindowArgs);
@ -54,7 +54,7 @@ const Window = ({ id }) => {
setArgs: (newArgs) => dispatch(setWindowArgs(id, newArgs)), setArgs: (newArgs) => dispatch(setWindowArgs(id, newArgs)),
setTitle: (title) => dispatch(setWindowTitle(id, title)), setTitle: (title) => dispatch(setWindowTitle(id, title)),
// eslint-disable-next-line max-len // eslint-disable-next-line max-len
changeType: (newType, newTitel, newArgs) => dispatch(changeWindowType(id, newType, newTitel, newArgs)), changeType: (newType, newTitle, newArgs) => dispatch(changeWindowType(id, newType, newTitle, newArgs)),
}), [id, args]); }), [id, args]);
const { const {

View File

@ -15,7 +15,7 @@ import {
} from '../../store/actions/windows'; } from '../../store/actions/windows';
/* /*
* return [ chatOpen, chatHiden ] * return [ chatOpen, chatHidden ]
* chatOpen: if any chat window or modal is open * chatOpen: if any chat window or modal is open
* chatHidden: if any chat windows are hidden * chatHidden: if any chat windows are hidden
*/ */

View File

@ -1,5 +1,5 @@
/* /*
* espand menu / show other menu buttons * expand menu / show other menu buttons
* *
*/ */

View File

@ -73,7 +73,7 @@ const ChannelDropDown = ({
} }
// latest lastTs first // latest lastTs first
sortChansNew.sort((c1, c2) => { sortChansNew.sort((c1, c2) => {
// determins if default channels get sorted too // determines if default channels get sorted too
if (c1[3] === 0 || c2[3] === 0) return 0; if (c1[3] === 0 || c2[3] === 0) return 0;
if (c1[4] > c2[4]) return -1; if (c1[4] > c2[4]) return -1;
if (c2[4] > c1[4]) return 1; if (c2[4] > c1[4]) return 1;

View File

@ -1,6 +1,6 @@
/* /*
* Odysee oembed API does not allow CORS request, * Odysee oembed API does not allow CORS request,
* therefor we can't use it right now. * therefore we can't use it right now.
* Still keeping this here in case that the policy changes in the future * Still keeping this here in case that the policy changes in the future
*/ */
import React from 'react'; import React from 'react';
@ -18,7 +18,7 @@ function stripCol(str) {
const urlStr = '/@'; const urlStr = '/@';
const Odysee = ({ url }) => { const Odysee = ({ url }) => {
let oid = null; let oid;
let posA = url.indexOf(urlStr); let posA = url.indexOf(urlStr);
if (posA !== -1) { if (posA !== -1) {
oid = url.substring(url.indexOf('/', posA + urlStr.length) + 1); oid = url.substring(url.indexOf('/', posA + urlStr.length) + 1);
@ -60,10 +60,7 @@ export default [
return false; return false;
} }
posA = urlPart.indexOf('/', posA + urlStr.length); posA = urlPart.indexOf('/', posA + urlStr.length);
if (posA === -1 || posA + 2 >= urlPart.length) { return !(posA === -1 || posA + 2 >= urlPart.length);
return false;
}
return true;
} }
// https://odysee.com/why-we-were-wrong-about-ukraine:6bd300b38bf1b30fa56e53c191b0652682c2ae6f // https://odysee.com/why-we-were-wrong-about-ukraine:6bd300b38bf1b30fa56e53c191b0652682c2ae6f
posA = urlPart.indexOf('//'); posA = urlPart.indexOf('//');
@ -71,10 +68,7 @@ export default [
posA = 0; posA = 0;
} }
posA = urlPart.indexOf('/', posA + 2); posA = urlPart.indexOf('/', posA + 2);
if (posA === -1 || posA + 2 >= urlPart.length) { return !(posA === -1 || posA + 2 >= urlPart.length);
return false;
}
return true;
}, },
(url) => { (url) => {
let urlPart = stripQuery(url); let urlPart = stripQuery(url);

View File

@ -10,7 +10,7 @@ import { useEffect, useLayoutEffect, useCallback } from 'react';
* Keeps listening to outside clicks or window resize * Keeps listening to outside clicks or window resize
* as long as active is true * as long as active is true
* @param insideRefs references to elements that are considered inside * @param insideRefs references to elements that are considered inside
* @param calback function that gets fired on click outside * @param callback function that gets fired on click outside
* @param active boolean if we should listen or not * @param active boolean if we should listen or not
*/ */
export function useConditionalClickOutside(insideRefs, active, callback) { export function useConditionalClickOutside(insideRefs, active, callback) {

View File

@ -1,5 +1,5 @@
/* /*
* mouse draging * mouse dragging
*/ */
/* eslint-disable consistent-return */ /* eslint-disable consistent-return */
@ -9,7 +9,7 @@ import { useEffect, useCallback } from 'react';
/* /*
* @param elRef element reference from useRef * @param elRef element reference from useRef
* @param startHandler function called on start of drag * @param startHandler function called on start of drag
* @param diffHandler functio that is called with dragged distance * @param diffHandler function that is called with dragged distance
*/ */
function useDrag(elRef, startHandler, diffHandler) { function useDrag(elRef, startHandler, diffHandler) {
const startDrag = useCallback((event) => { const startDrag = useCallback((event) => {

View File

@ -23,6 +23,6 @@ export default {
/* /*
* NOTE: * NOTE:
* set windows that should be accessable via popup / url * set windows that should be accessible via popup / url
* also in ./popUpAvailable.js * also in ./popUpAvailable.js
*/ */

View File

@ -27,7 +27,7 @@ import {
getOffsetOfPixel, getOffsetOfPixel,
} from '../core/utils'; } from '../core/utils';
class PixelPlainterControls { class PixelPainterControls {
constructor(renderer, viewport, curStore) { constructor(renderer, viewport, curStore) {
this.store = curStore; this.store = curStore;
this.renderer = renderer; this.renderer = renderer;
@ -67,7 +67,7 @@ class PixelPlainterControls {
* 2: right shift * 2: right shift
*/ */
this.holdPainting = 0; this.holdPainting = 0;
// if we are waiting before placeing pixel via holdPainting again // if we are waiting before placing pixel via holdPainting again
this.coolDownDelta = false; this.coolDownDelta = false;
document.addEventListener('keydown', this.onKeyDown, false); document.addEventListener('keydown', this.onKeyDown, false);
@ -149,7 +149,7 @@ class PixelPlainterControls {
this.viewport, this.viewport,
[clientX, clientY], [clientX, clientY],
); );
PixelPlainterControls.placePixel( PixelPainterControls.placePixel(
store, store,
this.renderer, this.renderer,
cell, cell,
@ -268,13 +268,13 @@ class PixelPlainterControls {
clearTimeout(this.onViewFinishChangeTimeOut); clearTimeout(this.onViewFinishChangeTimeOut);
this.clickTapStartTime = Date.now(); this.clickTapStartTime = Date.now();
this.clickTapStartCoords = PixelPlainterControls.getTouchCenter(event); this.clickTapStartCoords = PixelPainterControls.getTouchCenter(event);
const state = this.store.getState(); const state = this.store.getState();
this.clickTapStartView = state.canvas.view; this.clickTapStartView = state.canvas.view;
if (event.touches.length > 1) { if (event.touches.length > 1) {
this.tapStartScale = state.canvas.scale; this.tapStartScale = state.canvas.scale;
this.tapStartDist = PixelPlainterControls.getMultiTouchDistance(event); this.tapStartDist = PixelPainterControls.getMultiTouchDistance(event);
this.isMultiTab = true; this.isMultiTab = true;
this.clearTabTimeout(); this.clearTabTimeout();
} else { } else {
@ -282,7 +282,7 @@ class PixelPlainterControls {
this.isMultiTab = false; this.isMultiTab = false;
this.tapTimeout = setTimeout(() => { this.tapTimeout = setTimeout(() => {
// check for longer tap to select taped color // check for longer tap to select taped color
PixelPlainterControls.selectColor( PixelPainterControls.selectColor(
this.store, this.store,
this.viewport, this.viewport,
this.renderer, this.renderer,
@ -314,7 +314,7 @@ class PixelPlainterControls {
viewport, viewport,
[pageX, pageY], [pageX, pageY],
); );
PixelPlainterControls.placePixel( PixelPainterControls.placePixel(
store, store,
this.renderer, this.renderer,
cell, cell,
@ -334,7 +334,7 @@ class PixelPlainterControls {
const multiTouch = (event.touches.length > 1); const multiTouch = (event.touches.length > 1);
const [clientX, clientY] = PixelPlainterControls.getTouchCenter(event); const [clientX, clientY] = PixelPainterControls.getTouchCenter(event);
const { store } = this; const { store } = this;
const state = store.getState(); const state = store.getState();
if (this.isMultiTab !== multiTouch) { if (this.isMultiTab !== multiTouch) {
@ -342,7 +342,7 @@ class PixelPlainterControls {
this.isMultiTab = multiTouch; this.isMultiTab = multiTouch;
this.clickTapStartCoords = [clientX, clientY]; this.clickTapStartCoords = [clientX, clientY];
this.clickTapStartView = state.canvas.view; this.clickTapStartView = state.canvas.view;
this.tapStartDist = PixelPlainterControls.getMultiTouchDistance(event); this.tapStartDist = PixelPainterControls.getMultiTouchDistance(event);
this.tapStartScale = state.canvas.scale; this.tapStartScale = state.canvas.scale;
} else { } else {
// pan // pan
@ -413,7 +413,7 @@ class PixelPlainterControls {
const state = store.getState(); const state = store.getState();
if (isClicking) { if (isClicking) {
if (Date.now() < this.clickTapStartTime + 100) { if (Date.now() < this.clickTapStartTime + 100) {
// 100ms treshold till starting to pan // 100ms threshold till starting to pan
return; return;
} }
const { clickTapStartView, clickTapStartCoords } = this; const { clickTapStartView, clickTapStartCoords } = this;
@ -454,7 +454,7 @@ class PixelPlainterControls {
switch (this.holdPainting) { switch (this.holdPainting) {
case 1: { case 1: {
/* left shift: from selected color */ /* left shift: from selected color */
PixelPlainterControls.placePixel( PixelPainterControls.placePixel(
store, store,
this.renderer, this.renderer,
screenCoor, screenCoor,
@ -466,7 +466,7 @@ class PixelPlainterControls {
const colorIndex = this.renderer const colorIndex = this.renderer
.getColorIndexOfPixel(x, y, true); .getColorIndexOfPixel(x, y, true);
if (colorIndex !== null) { if (colorIndex !== null) {
PixelPlainterControls.placePixel( PixelPainterControls.placePixel(
store, store,
this.renderer, this.renderer,
screenCoor, screenCoor,
@ -510,7 +510,7 @@ class PixelPlainterControls {
} }
event.preventDefault(); event.preventDefault();
PixelPlainterControls.selectColor( PixelPainterControls.selectColor(
this.store, this.store,
this.viewport, this.viewport,
this.renderer, this.renderer,
@ -590,7 +590,7 @@ class PixelPlainterControls {
if (event.location === KeyboardEvent.DOM_KEY_LOCATION_LEFT) { if (event.location === KeyboardEvent.DOM_KEY_LOCATION_LEFT) {
// left shift // left shift
this.holdPainting = 1; this.holdPainting = 1;
PixelPlainterControls.placePixel(store, this.renderer, hover); PixelPainterControls.placePixel(store, this.renderer, hover);
return; return;
} }
if (event.location === KeyboardEvent.DOM_KEY_LOCATION_RIGHT) { if (event.location === KeyboardEvent.DOM_KEY_LOCATION_RIGHT) {
@ -599,7 +599,7 @@ class PixelPlainterControls {
const colorIndex = this.renderer const colorIndex = this.renderer
.getColorIndexOfPixel(...hover, true); .getColorIndexOfPixel(...hover, true);
if (colorIndex !== null) { if (colorIndex !== null) {
PixelPlainterControls.placePixel( PixelPainterControls.placePixel(
store, store,
this.renderer, this.renderer,
hover, hover,
@ -615,4 +615,4 @@ class PixelPlainterControls {
} }
} }
export default PixelPlainterControls; export default PixelPainterControls;

View File

@ -1,6 +1,6 @@
/* /*
* Buffer for chatMessages for the server * Buffer for chatMessages for the server
* it just buffers the msot recent 200 messages for each channel * it just buffers the most recent 200 messages for each channel
* *
*/ */
import Sequelize from 'sequelize'; import Sequelize from 'sequelize';

View File

@ -241,11 +241,8 @@ export class ChatProvider {
return true; return true;
} }
const { lang } = user; const { lang } = user;
if (this.langChannels[lang] return !!(this.langChannels[lang]
&& this.langChannels[lang].id === cid) { && this.langChannels[lang].id === cid);
return true;
}
return false;
} }
checkIfDm(user, cid) { checkIfDm(user, cid) {
@ -308,7 +305,7 @@ export class ChatProvider {
return 'No legit country defined'; return 'No legit country defined';
} }
if (!ret) { if (!ret) {
return `Cuntry ${cc} is already muted`; return `Country ${cc} is already muted`;
} }
if (ret) { if (ret) {
this.broadcastChatMessage( this.broadcastChatMessage(
@ -331,7 +328,7 @@ export class ChatProvider {
return 'No legit country defined'; return 'No legit country defined';
} }
if (!ret) { if (!ret) {
return `Cuntry ${cc} is not muted`; return `Country ${cc} is not muted`;
} }
this.broadcastChatMessage( this.broadcastChatMessage(
'info', 'info',
@ -379,7 +376,7 @@ export class ChatProvider {
} }
default: default:
return `Couln't parse command ${cmd}`; return `Couldn't parse command ${cmd}`;
} }
} }
@ -436,7 +433,7 @@ export class ChatProvider {
return t`Your country is temporary muted from this chat channel`; return t`Your country is temporary muted from this chat channel`;
} if (allowed === 101) { } if (allowed === 101) {
// eslint-disable-next-line max-len // eslint-disable-next-line max-len
return t`You are permanently muted, join our guilded to apppeal the mute`; return t`You are permanently muted, join our guilded to appeal the mute`;
} if (allowed === 2) { } if (allowed === 2) {
return t`You are banned`; return t`You are banned`;
} if (allowed === 3) { } if (allowed === 3) {
@ -474,14 +471,14 @@ export class ChatProvider {
let displayCountry = country; let displayCountry = country;
if (user.userlvl !== 0) { if (user.userlvl !== 0) {
displayCountry = 'zz'; displayCountry = 'zz';
/* /*
* meme names disabled for now * meme names disabled for now
* TODO think about activating it again after fixing accounts and * TODO think about activating it again after fixing accounts and
* mute evasions * mute evasions
* *
} else if (name.endsWith('berg') || name.endsWith('stein')) { } else if (name.endsWith('berg') || name.endsWith('stein')) {
displayCountry = 'il'; displayCountry = 'il';
/ */ / */
} else if (user.id === 2927) { } else if (user.id === 2927) {
/* /*
* hard coded flag for Manchukuo_1940 * hard coded flag for Manchukuo_1940
@ -495,8 +492,8 @@ export class ChatProvider {
} }
for (let i = 0; i < this.substitutes.length; i += 1) { for (let i = 0; i < this.substitutes.length; i += 1) {
const subsitute = this.substitutes[i]; const substitute = this.substitutes[i];
message = message.replace(subsitute.regexp, subsitute.replace); message = message.replace(substitute.regexp, substitute.replace);
} }
if (message.length > 200) { if (message.length > 200) {

View File

@ -16,7 +16,7 @@ import Palette from './Palette';
/* /*
* Load iamge from ABGR buffer onto canvas * Load image from ABGR buffer onto canvas
* (be aware that tis function does no validation of arguments) * (be aware that tis function does no validation of arguments)
* @param canvasId numerical ID of canvas * @param canvasId numerical ID of canvas
* @param x X coordinate on canvas * @param x X coordinate on canvas
@ -103,7 +103,7 @@ export async function imageABGR2Canvas(
/* /*
* Load iamgemask from ABGR buffer and execute function for each black pixel * Load imagemask from ABGR buffer and execute function for each black pixel
* (be aware that tis function does no validation of arguments) * (be aware that tis function does no validation of arguments)
* @param canvasId numerical ID of canvas * @param canvasId numerical ID of canvas
* @param x X coordinate on canvas * @param x X coordinate on canvas

View File

@ -63,10 +63,10 @@ export class MailProvider {
const { t } = getTTag(lang); const { t } = getTTag(lang);
logger.info(`Sending verification mail to ${to} / ${name}`); logger.info(`Sending verification mail to ${to} / ${name}`);
const verifyUrl = `${host}/api/auth/verify?token=${code}&email=${encodeURIComponent(to)}`; const verifyUrl = `${host}/api/auth/verify?token=${code}&email=${encodeURIComponent(to)}`;
const subject = t`Welcome ${name} to PixelPlanet, plese verify your mail`; const subject = t`Welcome ${name} to PixelPlanet, please verify your mail`;
const html = `<em>${t`Hello ${name}`}</em>,<br /> const html = `<em>${t`Hello ${name}`}</em>,<br />
${t`welcome to our little community of pixelplacers, to use your account, you have to verify your mail. You can do that here: `} <a href="${verifyUrl}">${t`Click to Verify`}</a>. ${t`Or by copying following url:`}<br />${verifyUrl}\n<br /> ${t`welcome to our little community of pixelplacers, to use your account, you have to verify your mail. You can do that here: `} <a href="${verifyUrl}">${t`Click to Verify`}</a>. ${t`Or by copying following url:`}<br />${verifyUrl}\n<br />
${t`Have fun and don't hesitate to contact us if you encouter any problems :)`}<br /> ${t`Have fun and don't hesitate to contact us if you encounter any problems :)`}<br />
${t`Thanks`}<br /><br /> ${t`Thanks`}<br /><br />
<img alt="" src="https://assets.pixelplanet.fun/tile.png" style="height:64px; width:64px" />`; <img alt="" src="https://assets.pixelplanet.fun/tile.png" style="height:64px; width:64px" />`;
this.sendMail(to, subject, html); this.sendMail(to, subject, html);
@ -132,7 +132,7 @@ export class MailProvider {
/* /*
* not sure if this is needed yet * not sure if this is needed yet
* does it matter if spaming password reset mails or verifications mails? * does it matter if spamming password reset mails or verifications mails?
* *
if(!reguser.verified) { if(!reguser.verified) {
logger.info(`Password reset mail for ${to} requested by ${ip} - mail not verified`); logger.info(`Password reset mail for ${to} requested by ${ip} - mail not verified`);
@ -169,7 +169,7 @@ export class MailProvider {
/* /*
* we do not use this right now * we do not use this right now
static cleanUsers() { static cleanUsers() {
// delete users that requier verification for more than 4 days // delete users that require verification for more than 4 days
RegUser.destroy({ RegUser.destroy({
where: { where: {
verificationReqAt: { verificationReqAt: {

View File

@ -3,8 +3,8 @@
* *
* We do not support all markdown, but do additionally parse extra * We do not support all markdown, but do additionally parse extra
* stuff like pixelplanet coords and usernames and bare links. * stuff like pixelplanet coords and usernames and bare links.
* This code is written in preparation for a possible imporementation in * This code is written in preparation for a possible implementation in
* WebAssambly, so it's all in a big loop * WebAssembly, so it's all in a big loop
*/ */
import MString from './MString'; import MString from './MString';
@ -142,7 +142,7 @@ function parseMParagraph(text, opts, breakChar) {
/* /*
* parse Code Block * parse Code Block
* start is first character after the initializing ``` * start is first character after the initializing ```
* we just parse till the ending occures * we just parse till the ending occurs
*/ */
function parseCodeBlock(text) { function parseCodeBlock(text) {
text.skipSpaces(false); text.skipSpaces(false);
@ -183,7 +183,7 @@ function parseQuote(text, opts) {
* parses Section (contains paragraphs, lists, etc. but no headings or quotes) * parses Section (contains paragraphs, lists, etc. but no headings or quotes)
* @param text MString * @param text MString
* @param headingLevel the number of heading headingLevels we are in * @param headingLevel the number of heading headingLevels we are in
* @param indent ndentation that should be considered (when inside list) * @param indent indentation that should be considered (when inside list)
* returns when encountering heading of <= headingLevel (iter is at # position) * returns when encountering heading of <= headingLevel (iter is at # position)
* or heading-cancel with three spaces (iter is past newlines) * or heading-cancel with three spaces (iter is past newlines)
* or ident is smaller than given * or ident is smaller than given
@ -264,7 +264,7 @@ function parseMSection(
curIndent + 1, curIndent + 1,
); );
childMdArray = ['-', childMdArray]; childMdArray = ['-', childMdArray];
// lists are encapsuled // lists are encapsulated
const capsule = (isUnorderedList) ? 'ul' : 'ol'; const capsule = (isUnorderedList) ? 'ul' : 'ol';
if (!mdArray.length || mdArray[mdArray.length - 1][0] !== capsule) { if (!mdArray.length || mdArray[mdArray.length - 1][0] !== capsule) {
mdArray.push([capsule, [childMdArray]]); mdArray.push([capsule, [childMdArray]]);

View File

@ -167,7 +167,7 @@ class RpgEvent {
// make sure that its the center of a 3x3 area // make sure that its the center of a 3x3 area
const i = Math.floor(Math.random() * (canvasSize / TILE_SIZE - 2)) + 1; const i = Math.floor(Math.random() * (canvasSize / TILE_SIZE - 2)) + 1;
const j = Math.floor(Math.random() * (canvasSize / TILE_SIZE - 2)) + 1; const j = Math.floor(Math.random() * (canvasSize / TILE_SIZE - 2)) + 1;
// backup it and schedul next event in 1h // backup it and schedule next event in 1h
await setNextEvent(EVENT_GAP_MIN, i, j); await setNextEvent(EVENT_GAP_MIN, i, j);
const timestamp = await nextEvent(); const timestamp = await nextEvent();
const x = i * TILE_SIZE - canvasSize / 2; const x = i * TILE_SIZE - canvasSize / 2;
@ -194,7 +194,7 @@ class RpgEvent {
async runEventLoop() { async runEventLoop() {
/* /*
* if we aren't the main shard, we just wait and regularly check, * if we aren't the main shard, we just wait and regularly check,
* re-intilializing if we become it * re-initializing if we become it
*/ */
if (!socketEvents.amIImportant()) { if (!socketEvents.amIImportant()) {
this.iAmNotImportant = true; this.iAmNotImportant = true;
@ -281,7 +281,7 @@ class RpgEvent {
} }
setTimeout(this.runEventLoop, 1000); setTimeout(this.runEventLoop, 1000);
} else if (eventMinutes > STEPS[4]) { } else if (eventMinutes > STEPS[4]) {
// 1min till Event: blinking solid cross red small fase // 1min till Event: blinking solid cross red small faze
if (eventState !== 9 && eventState !== 10) { if (eventState !== 9 && eventState !== 10) {
this.eventState = 9; this.eventState = 9;
RpgEvent.broadcastChatMessage( RpgEvent.broadcastChatMessage(

View File

@ -1,5 +1,5 @@
/* /*
* basic functions for creating zommed tiles * basic functions for creating zoomed tiles
* Used by tilewriter worker thread, so dont import too much. * Used by tilewriter worker thread, so dont import too much.
* *
* */ * */
@ -492,7 +492,7 @@ async function createEmptyTile(
/* /*
* created 4096x4096 texture of default canvas * created 4096x4096 texture of default canvas
* @param canvasId numberical Id of canvas * @param canvasId numerical Id of canvas
* @param canvas canvas data * @param canvas canvas data
* @param canvasTileFolder root folder where to save texture * @param canvasTileFolder root folder where to save texture
* *

View File

@ -29,7 +29,7 @@ class Void {
// Uint8Array to log pixels in area // Uint8Array to log pixels in area
area; area;
userArea; userArea;
// current numberical data // current numerical data
curRadius; curRadius;
curAngle; curAngle;
curAngleDelta; curAngleDelta;
@ -129,7 +129,7 @@ class Void {
while (true) { while (true) {
this.curAngle += this.curAngleDelta; this.curAngle += this.curAngleDelta;
if (this.curAngle > 2 * Math.PI) { if (this.curAngle > 2 * Math.PI) {
// it does skip some pixel, but thats ok // it does skip some pixel, but that's ok
this.curRadius += 1; this.curRadius += 1;
if (this.curRadius > TARGET_RADIUS) { if (this.curRadius > TARGET_RADIUS) {
this.cancel(); this.cancel();

View File

@ -48,7 +48,7 @@ import rollbackCanvasArea from './rollback';
/* /*
* Execute IP based actions (banning, whitelist, etc.) * Execute IP based actions (banning, whitelist, etc.)
* @param action what to do with the ip * @param action what to do with the ip
* @param ip already sanizized ip * @param ip already sanitized ip
* @return text of success * @return text of success
*/ */
export async function executeIPAction(action, ips, logger = null) { export async function executeIPAction(action, ips, logger = null) {
@ -79,7 +79,7 @@ export async function executeIPAction(action, ips, logger = null) {
/* /*
* Execute IID based actions * Execute IID based actions
* @param action what to do with the iid * @param action what to do with the iid
* @param iid already sanizized iid * @param iid already sanitized iid
* @return text of success * @return text of success
*/ */
export async function executeIIDAction( export async function executeIIDAction(
@ -265,7 +265,7 @@ export async function executeImageAction(
} }
/* /*
* retgister responses on socket for Watch Actions * register responses on socket for Watch Actions
*/ */
socketEvents.onReq('watch', (action, ...args) => { socketEvents.onReq('watch', (action, ...args) => {
if (action === 'getIIDSummary') { if (action === 'getIIDSummary') {
@ -466,7 +466,7 @@ export async function executeProtAction(
const width = u - x + 1; const width = u - x + 1;
const height = v - y + 1; const height = v - y + 1;
if (width * height > 10000000) { if (width * height > 10000000) {
return [403, 'Can not set protection to more than 10m pixels at onec']; return [403, 'Can not set protection to more than 10m pixels at once'];
} }
const protect = action === 'protect'; const protect = action === 'protect';
const pxlCount = await protectCanvasArea( const pxlCount = await protectCanvasArea(

View File

@ -296,8 +296,7 @@ export function getCPieOpts(isDarkMode) {
}, },
}; };
if (isDarkMode) { if (isDarkMode) {
const sColor = '#e6e6e6'; options.plugins.title.color = '#e6e6e6';
options.plugins.title.color = sColor;
} }
return options; return options;
} }

View File

@ -51,7 +51,7 @@ export const HOURLY_EVENT = parseInt(process.env.HOURLY_EVENT, 10) || false;
// Accounts // Accounts
export const APISOCKET_KEY = process.env.APISOCKET_KEY || null; export const APISOCKET_KEY = process.env.APISOCKET_KEY || null;
// Comma seperated list of user ids of Admins // Comma separated list of user ids of Admins
export const ADMIN_IDS = (process.env.ADMIN_IDS) export const ADMIN_IDS = (process.env.ADMIN_IDS)
? process.env.ADMIN_IDS.split(',').map((z) => parseInt(z, 10)) : []; ? process.env.ADMIN_IDS.split(',').map((z) => parseInt(z, 10)) : [];

View File

@ -2,7 +2,7 @@
*/ */
// canvas size (width and height) MUST be 256 * 4^n to be able to stick // canvas size (width and height) MUST be 256 * 4^n to be able to stick
// to established tiling convetions. // to established tiling conventions.
// (basically by sticking to that, we keep ourself many options open for the future) // (basically by sticking to that, we keep ourself many options open for the future)
// see OSM tiling: https://wiki.openstreetmap.org/wiki/Slippy_map_tilenames // see OSM tiling: https://wiki.openstreetmap.org/wiki/Slippy_map_tilenames
export const MAX_SCALE = 40; // 52 in log2 export const MAX_SCALE = 40; // 52 in log2

View File

@ -43,13 +43,13 @@ setInterval(() => {
/** /**
* *
* By Offset is prefered on server side * By Offset is preferred on server side
* This gets used by websocket pixel placing requests * This gets used by websocket pixel placing requests
* @param user user that can be registered, but doesn't have to * @param user user that can be registered, but doesn't have to
* @param canvasId * @param canvasId
* @param i Chunk coordinates * @param i Chunk coordinates
* @param j * @param j
* @param pixels Array of indiviual pixels within the chunk, with: * @param pixels Array of individual pixels within the chunk, with:
* [[offset, color], [offset2, color2],...] * [[offset, color], [offset2, color2],...]
* Offset is the offset of the pixel within the chunk * Offset is the offset of the pixel within the chunk
* @return Promise<Object> * @return Promise<Object>
@ -74,7 +74,7 @@ export default async function drawByOffsets(
if (curReqIPs.has(ip)) { if (curReqIPs.has(ip)) {
// already setting a pixel somewhere // already setting a pixel somewhere
logger.warn( logger.warn(
`Got simultanious requests from ${user.ip}`, `Got simultaneous requests from ${user.ip}`,
); );
throw new Error(13); throw new Error(13);
} }
@ -95,12 +95,12 @@ export default async function drawByOffsets(
*/ */
if (i >= canvasSize / tileSize) { if (i >= canvasSize / tileSize) {
// x out of bounds // x out of bounds
// (we don't have to check for <0 becaue it is received as uint) // (we don't have to check for <0 because it is received as uint)
throw new Error(2); throw new Error(2);
} }
if (j >= canvasSize / tileSize) { if (j >= canvasSize / tileSize) {
// y out of bounds // y out of bounds
// (we don't have to check for <0 becaue it is received as uint) // (we don't have to check for <0 because it is received as uint)
throw new Error(3); throw new Error(3);
} }

View File

@ -194,7 +194,7 @@ export default function checkIfAllowed(ip, disableCache = false) {
* check if email is disposable * check if email is disposable
* @param email * @param email
* @return Promise * @return Promise
* null: some error occured * null: some error occurred
* false: legit provider * false: legit provider
* true: disposable * true: disposable
*/ */

View File

@ -4,7 +4,7 @@
* various api endpoints. * various api endpoints.
* *
*/ */
import { getLocalicedCanvases } from '../canvasesDesc'; import { getLocalizedCanvases } from '../canvasesDesc';
import { USE_MAILER } from './config'; import { USE_MAILER } from './config';
import chatProvider from './ChatProvider'; import chatProvider from './ChatProvider';
@ -25,7 +25,7 @@ export default async function getMe(user, lang = 'default') {
} }
delete userdata.mailVerified; delete userdata.mailVerified;
userdata.canvases = getLocalicedCanvases(lang); userdata.canvases = getLocalizedCanvases(lang);
userdata.channels = { userdata.channels = {
...chatProvider.getDefaultChannels(lang), ...chatProvider.getDefaultChannels(lang),
...userdata.channels, ...userdata.channels,

View File

@ -173,7 +173,7 @@ export async function getIIDPixels(
/* /*
* Get summary of users placing in area of current day * Get summary of users placing in area of current day
* @param canvasId id of canvas * @param canvasId id of canvas
* @param xUL, yUL, xBR, yBR area of canvs * @param xUL, yUL, xBR, yBR area of canvas
* @param time timestamp of when to start * @param time timestamp of when to start
* @param iid Limit on one user (optional) * @param iid Limit on one user (optional)
* @return array of parsed pixel log lines * @return array of parsed pixel log lines
@ -266,9 +266,9 @@ export async function getSummaryFromArea(
} else { } else {
let { pcheck } = ipInfo; let { pcheck } = ipInfo;
if (pcheck) { if (pcheck) {
const seperator = pcheck.indexOf(','); const separator = pcheck.indexOf(',');
if (seperator !== -1) { if (separator !== -1) {
pcheck = pcheck.slice(0, seperator); pcheck = pcheck.slice(0, separator);
} }
} }
row.push( row.push(

View File

@ -40,7 +40,7 @@ passport.use(new JsonStrategy({
usernameProp: 'nameoremail', usernameProp: 'nameoremail',
passwordProp: 'password', passwordProp: 'password',
}, async (nameoremail, password, done) => { }, async (nameoremail, password, done) => {
// Decide if email or name by the occurance of @ // Decide if email or name by the occurrence of @
// this is why we don't allow @ in usernames // this is why we don't allow @ in usernames
// NOTE: could allow @ in the future by making an OR query, // NOTE: could allow @ in the future by making an OR query,
// but i guess nobody really cares. // but i guess nobody really cares.

View File

@ -13,8 +13,9 @@ import canvases from './canvases';
/** /**
* *
* By Offset is prefered on server side * By Offset is preferred on server side
* @param canvasId * @param canvasId
* @param color Pixel color
* @param i Chunk coordinates * @param i Chunk coordinates
* @param j * @param j
* @param offset Offset of pixel withing chunk * @param offset Offset of pixel withing chunk

View File

@ -17,7 +17,7 @@ import { TILE_SIZE } from './constants';
* Copy canvases from one redis instance to another * Copy canvases from one redis instance to another
* @param canvasRedis redis from where to get the data * @param canvasRedis redis from where to get the data
* @param backupRedis redis where to write the data to * @param backupRedis redis where to write the data to
* @param canvases Object with all canvas informations * @param canvases Object with all canvas information
*/ */
export async function updateBackupRedis(canvasRedis, backupRedis, canvases) { export async function updateBackupRedis(canvasRedis, backupRedis, canvases) {
const ids = Object.keys(canvases); const ids = Object.keys(canvases);
@ -25,7 +25,7 @@ export async function updateBackupRedis(canvasRedis, backupRedis, canvases) {
const id = ids[i]; const id = ids[i];
const canvas = canvases[id]; const canvas = canvases[id];
if (canvas.v || canvas.hid) { if (canvas.v || canvas.hid) {
// ignore 3D and hiddedn canvases // ignore 3D and hidden canvases
continue; continue;
} }
const chunksXY = (canvas.size / TILE_SIZE); const chunksXY = (canvas.size / TILE_SIZE);
@ -70,12 +70,12 @@ export async function updateBackupRedis(canvasRedis, backupRedis, canvases) {
/* /*
* Create incremential PNG tile backup between two redis canvases * Create incremental PNG tile backup between two redis canvases
* @param canvasRedis redis from where to get the data * @param canvasRedis redis from where to get the data
* @param backupRedis redis where to write the data to * @param backupRedis redis where to write the data to
* @param canvases Object with all canvas informations * @param canvases Object with all canvas information
*/ */
export async function incrementialBackupRedis( export async function incrementalBackupRedis(
canvasRedis, canvasRedis,
backupRedis, backupRedis,
canvases, canvases,
@ -108,7 +108,7 @@ export async function incrementialBackupRedis(
const palette = new Palette(canvas.colors); const palette = new Palette(canvas.colors);
const chunksXY = (canvas.size / TILE_SIZE); const chunksXY = (canvas.size / TILE_SIZE);
console.log('Creating Incremential Backup...'); console.log('Creating Incremental Backup...');
const startTime = Date.now(); const startTime = Date.now();
let amount = 0; let amount = 0;
for (let x = 0; x < chunksXY; x++) { for (let x = 0; x < chunksXY; x++) {
@ -198,7 +198,7 @@ export async function incrementialBackupRedis(
} catch (error) { } catch (error) {
console.error( console.error(
// eslint-disable-next-line max-len // eslint-disable-next-line max-len
new Error(`Could not populate incremential backup data of chunk ${key}: ${error.message}`), new Error(`Could not populate incremental backup data of chunk ${key}: ${error.message}`),
); );
continue; continue;
} }
@ -223,15 +223,14 @@ export async function incrementialBackupRedis(
} catch (error) { } catch (error) {
console.error( console.error(
// eslint-disable-next-line max-len // eslint-disable-next-line max-len
new Error(`Could not save incremential backup of chunk ${key}: ${error.message}`), new Error(`Could not save incremental backup of chunk ${key}: ${error.message}`),
); );
continue;
} }
} }
} }
const time = Date.now() - startTime; const time = Date.now() - startTime;
console.log( console.log(
`Finished Incremential backup of ${amount} chunks in ${time}ms.`, `Finished Incremental backup of ${amount} chunks in ${time}ms.`,
); );
} }
} }
@ -273,7 +272,7 @@ function buffer2RGB(palette, chunkBuffer) {
/* /*
* Backup all tiles as PNG files into folder * Backup all tiles as PNG files into folder
* @param redisClient RedisClient * @param redisClient RedisClient
* @param canvases Object with the informations to all canvases * @param canvases Object with the information to all canvases
* @param backupDir directory where to save png tiles * @param backupDir directory where to save png tiles
*/ */
export async function createPngBackup( export async function createPngBackup(

View File

@ -120,7 +120,7 @@ class CanvasUpdater {
} }
/* /*
* register changed chunk, queue corespongind tile to reload * register changed chunk, queue corresponding tile to reload
* @param chunk Chunk coordinates * @param chunk Chunk coordinates
*/ */
registerChunkChange(chunk) { registerChunkChange(chunk) {

View File

@ -33,7 +33,7 @@ export function getTTag(lang) {
/* /*
* express middleware for getting language * express middleware for getting language
* It checks the lang cookie, and if not present, * It checks the lang cookie, and if not present,
* the Accept-Lanuage header * the Accept-Language header
*/ */
export function expressTTag(req, res, next) { export function expressTTag(req, res, next) {
const cookies = cookie.parse(req.headers.cookie || ''); const cookies = cookie.parse(req.headers.cookie || '');

View File

@ -63,7 +63,7 @@ export function getToday() {
} }
// z is assumed to be height here // z is assumed to be height here
// in ui and rendeer, y is height // in ui and renderer, y is height
export function getChunkOfPixel( export function getChunkOfPixel(
canvasSize, canvasSize,
x, x,
@ -95,10 +95,9 @@ export function getTileOfPixel(
pixel, pixel,
canvasSize = null, canvasSize = null,
) { ) {
const target = pixel.map( return pixel.map(
(x) => Math.floor((x + canvasSize / 2) / TILE_SIZE * tileScale), (x) => Math.floor((x + canvasSize / 2) / TILE_SIZE * tileScale),
); );
return target;
} }
export function getMaxTiledZoom(canvasSize) { export function getMaxTiledZoom(canvasSize) {
@ -131,7 +130,7 @@ export function getCanvasBoundaries(canvasSize) {
} }
// z is assumed to be height here // z is assumed to be height here
// in ui and rendeer, y is height // in ui and renderer, y is height
export function getOffsetOfPixel( export function getOffsetOfPixel(
canvasSize, canvasSize,
x, x,
@ -167,7 +166,7 @@ export function getIdFromObject(obj, ident) {
} }
// z is returned as height here // z is returned as height here
// in ui and rendeer, y is height // in ui and renderer, y is height
export function getPixelFromChunkOffset( export function getPixelFromChunkOffset(
i, i,
j, j,
@ -575,7 +574,7 @@ export function combineTables(a, b) {
} }
/* /*
* conbine two similar objects * combine two similar objects
*/ */
export function combineObjects(a, b) { export function combineObjects(a, b) {
if (!b) { if (!b) {
@ -621,14 +620,10 @@ export function getDateKeyOfTs(ts) {
*/ */
export function parentExists() { export function parentExists() {
try { try {
if (!window.opener return !(!window.opener
|| window.opener.closed || window.opener.closed
|| !window.opener.location || !window.opener.location
|| window.opener.location.origin !== window.location.origin || window.opener.location.origin !== window.location.origin);
) {
return false;
}
return true;
} catch { } catch {
return false; return false;
} }

View File

@ -1,10 +1,10 @@
/* /*
* .vox file exporter for 3D canvas * .vox file exporter for 3D canvas
* .vox is the Magica Voxel file format that is also compatible with * .vox is the Magica Voxel file format that is also compatible with
* other vodel editors like Goxel. * other voxel editors like Goxel.
* A object in a .vox file can have a max dimension of 128x128 and 256 height * A object in a .vox file can have a max dimension of 128x128 and 256 height
* As of the latest release with 0.99.5 4/5/2020 this limit is now 256x256x256, * As of the latest release with 0.99.5 4/5/2020 this limit is now 256x256x256,
* however, lets keep with the old restreints for support of other software. * however, lets keep with the old restraints for support of other software.
* In .vox, 0,0 is the corner of the model and coordinates are unsigned int, * In .vox, 0,0 is the corner of the model and coordinates are unsigned int,
* the z dimension is the height, contrarian to pixelplanet with y. * the z dimension is the height, contrarian to pixelplanet with y.
* *
@ -15,7 +15,7 @@
/* /*
* THIS IS JUST THE START, I WONT CONTINUE IT ANYTIME SOON SO ITS ALREADY * THIS IS JUST THE START, I WONT CONTINUE IT ANYTIME SOON SO ITS ALREADY
* COMMITED AS A REFERENCE AND IDEA * COMMITTED AS A REFERENCE AND IDEA
* The idea is to export a 128x128 area around the focal point of where the user * The idea is to export a 128x128 area around the focal point of where the user
* is currently looking at as .vox. The file should just have one model. * is currently looking at as .vox. The file should just have one model.
*/ */
@ -101,12 +101,12 @@ async function exportVox(
// Main Chunk // Main Chunk
// 4 bytes MAIN // 4 bytes MAIN
// 4 bytes size (0) // 4 bytes size (0)
// 4 bythes size children chnks // 4 bytes size children chunks
const mainChildrenChunkSize = sizeChunkLength const mainChildrenChunkSize = sizeChunkLength
+ xyziChunkLength + rgbaChunkLength; + xyziChunkLength + rgbaChunkLength;
const mainChunkLength = 4 + 4 + 4 + mainChildrenChunkSize; const mainChunkLength = 4 + 4 + 4 + mainChildrenChunkSize;
// 4 bytes 'VOX ' // 4 bytes 'VOX '
// 4 bythes version number // 4 bytes version number
const fileLength = 4 + 4 + mainChunkLength; const fileLength = 4 + 4 + mainChunkLength;
const voxFile = new ArrayBuffer(fileLength); const voxFile = new ArrayBuffer(fileLength);
@ -164,7 +164,7 @@ async function exportVox(
return voxFile; return voxFile;
// can then be saved from the UI with react-file-downloader // can then be saved from the UI with react-file-downloader
// aka js-file-doanloader // aka js-file-downloader
} }
export default exportVox; export default exportVox;

View File

@ -159,7 +159,7 @@ export async function needCaptcha(ip) {
* force ip to get captcha * force ip to get captcha
* @param ip * @param ip
* @return true if we triggered captcha * @return true if we triggered captcha
* false if user would have gotton one anyway * false if user would have gotten one anyway
*/ */
export async function forceCaptcha(ip) { export async function forceCaptcha(ip) {
if (CAPTCHA_TIME < 0) { if (CAPTCHA_TIME < 0) {

View File

@ -22,7 +22,7 @@ const PREFIX = 'cd';
* @param ip ip of request * @param ip ip of request
* @param id userId * @param id userId
* @param ranked boolean if increasing rank * @param ranked boolean if increasing rank
* @param clrIgnore, bcd, pcd, cds incormations about canvas * @param clrIgnore, bcd, pcd, cds information about canvas
* @param i, j chunk coordinates * @param i, j chunk coordinates
* @param pxls Array with offsets of pixels * @param pxls Array with offsets of pixels
* @return see lua/placePixel.lua * @return see lua/placePixel.lua

View File

@ -1,9 +1,9 @@
-- Checking requirements for placing pixels, calculating cooldown -- Checking requirements for placing pixels, calculating cooldown
-- of user and incrementing pixel counts wthin redis itself. -- of user and incrementing pixel counts within redis itself.
-- Does not set pixels directly. Pixels are set in batches -- Does not set pixels directly. Pixels are set in batches
-- in RedisCanvas.js -- in RedisCanvas.js
-- Keys: -- Keys:
-- isAlloweed: 'isal:ip' (proxycheck, blacklist, whitelist) -- isAllowed: 'isal:ip' (proxycheck, blacklist, whitelist)
-- isHuman 'human:ip' captcha needed when expired, -- isHuman 'human:ip' captcha needed when expired,
-- 'nope' if no captcha should be checked -- 'nope' if no captcha should be checked
-- ipCD: 'cd:canvasId:ip:ip' -- ipCD: 'cd:canvasId:ip:ip'
@ -17,16 +17,16 @@
-- prevTop: sorted set of yesterdays top 10 -- prevTop: sorted set of yesterdays top 10
-- Args: -- Args:
-- clrIgnore: integer number of what colors are considered unset -- clrIgnore: integer number of what colors are considered unset
-- bcd: number baseColldown (fixed to cdFactor and 0 if admin) -- bcd: number baseCooldown (fixed to cdFactor and 0 if admin)
-- pcd: number set pixel cooldown (fixed to cdFactor and 0 if admin) -- pcd: number set pixel cooldown (fixed to cdFactor and 0 if admin)
-- cds: max cooldown of canvas -- cds: max cooldown of canvas
-- userId: '0' if not logged in -- userId: '0' if not logged in
-- cc country code -- cc country code
-- req: requirements of canvas -- req: requirements of canvas
-- 'nope', unsigned integer or 'top' -- 'nope', unsigned integer or 'top'
-- off1, chonk offset of first pixel -- off1, chunk offset of first pixel
-- off2, chonk offset of second pixel -- off2, chunk offset of second pixel
-- ..., infinie pixels possible -- ..., infinite pixels possible
-- Returns: -- Returns:
-- { -- {
-- 1: pixel return status code (check ui/placePixel.js) -- 1: pixel return status code (check ui/placePixel.js)

View File

@ -18,7 +18,7 @@ const Ban = sequelize.define('Ban', {
}, },
/* /*
* wpiration time, * expiration time,
* NULL if infinite * NULL if infinite
*/ */
expires: { expires: {

View File

@ -38,7 +38,7 @@ const RegUser = sequelize.define('User', {
defaultValue: false, defaultValue: false,
}, },
// null if external oauth authentification // null if external oauth authentication
password: { password: {
type: DataTypes.CHAR(60), type: DataTypes.CHAR(60),
allowNull: true, allowNull: true,
@ -193,7 +193,7 @@ export async function getNamesToIds(ids) {
/* /*
* take array of {id: useId, ...} object and resolve * take array of {id: useId, ...} object and resolve
* user informations * user information
*/ */
export async function populateRanking(rawRanks) { export async function populateRanking(rawRanks) {
if (!rawRanks.length) { if (!rawRanks.length) {

View File

@ -143,8 +143,7 @@ document.addEventListener('DOMContentLoaded', () => {
width = window.innerWidth; width = window.innerWidth;
height = window.innerHeight; height = window.innerHeight;
renderer.setSize(width, height); renderer.setSize(width, height);
const aspect = width / height; camera.aspect = width / height;
camera.aspect = aspect;
camera.updateProjectionMatrix(); camera.updateProjectionMatrix();
if (controls) controls.handleResize(); if (controls) controls.handleResize();
} }

View File

@ -85,7 +85,7 @@ router.post('/checklogin', async (req, res) => {
if (!compareToHash(password, reguser.password)) { if (!compareToHash(password, reguser.password)) {
logger.info( logger.info(
`ADMINAPI: User ${reguser.name} / ${reguser.id} entered wronng password`, `ADMINAPI: User ${reguser.name} / ${reguser.id} entered wrong password`,
); );
res.json({ res.json({
success: false, success: false,

View File

@ -63,9 +63,9 @@ router.get('/reddit/return', passport.authenticate('reddit', {
// eslint-disable-next-line no-unused-vars // eslint-disable-next-line no-unused-vars
router.use((err, req, res, next) => { router.use((err, req, res, next) => {
const host = getHostFromRequest(req); const host = getHostFromRequest(req);
logger.info(`Authentification error: ${err.message}`); logger.info(`Authentication error: ${err.message}`);
const index = getHtml( const index = getHtml(
'OAuth Authentification', 'OAuth Authentication',
err.message, host, req.lang, err.message, host, req.lang,
); );
res.status(400).send(index); res.status(400).send(index);

View File

@ -1,5 +1,5 @@
/* /*
* request passowrd reset mail * request password reset mail
*/ */

View File

@ -18,8 +18,8 @@ export default async (req, res) => {
if (!error) { if (!error) {
const name = await MailProvider.verify(email, token); const name = await MailProvider.verify(email, token);
if (name) { if (name) {
// notify websoecket to reconnect user // notify websocket to reconnect user
// thats a bit counter productive because it directly links to the websocket // that's a bit counter productive because it directly links to the websocket
socketEvents.reloadUser(name); socketEvents.reloadUser(name);
// --- // ---
const index = getHtml( const index = getHtml(

View File

@ -1,5 +1,5 @@
/* /*
* report that user shouldbe banned * report that user should be banned
*/ */
import logger from '../../core/logger'; import logger from '../../core/logger';

View File

@ -63,7 +63,7 @@ async function block(req, res) {
userId = targetUser.id; userId = targetUser.id;
userName = targetUser.name; userName = targetUser.name;
let ret = null; let ret;
if (blocking) { if (blocking) {
ret = await UserBlock.findOrCreate({ ret = await UserBlock.findOrCreate({
where: { where: {
@ -85,8 +85,8 @@ async function block(req, res) {
/* /*
* delete possible dm channel * delete possible dm channel
*/ */
let dmu1id = null; let dmu1id;
let dmu2id = null; let dmu2id;
if (user.id > userId) { if (user.id > userId) {
dmu1id = userId; dmu1id = userId;
dmu2id = user.id; dmu2id = user.id;

View File

@ -60,7 +60,7 @@ router.use(session);
/* /*
* passport authenticate * passport authenticate
* and deserlialize * and deserialize
* (makes that sql request to map req.user.regUser) * (makes that sql request to map req.user.regUser)
* After this point it is assumes that user.regUser is set if user.id is too * After this point it is assumes that user.regUser is set if user.id is too
*/ */

View File

@ -78,8 +78,8 @@ async function startDm(req, res) {
/* /*
* start DM session * start DM session
*/ */
let dmu1id = null; let dmu1id;
let dmu2id = null; let dmu2id;
if (user.id > userId) { if (user.id > userId) {
dmu1id = userId; dmu1id = userId;
dmu2id = user.id; dmu2id = user.id;

View File

@ -81,12 +81,12 @@ router.post('/', async (req, res) => {
} }
await reguser.update({ password: pass }); await reguser.update({ password: pass });
logger.info(`Changed password of ${email} via passowrd reset form`); logger.info(`Changed password of ${email} via password reset form`);
const html = getPasswordResetHtml( const html = getPasswordResetHtml(
null, null,
null, null,
lang, lang,
t`Passowrd successfully changed.`, t`Password successfully changed.`,
); );
res.status(200).send(html); res.status(200).send(html);
}); });

View File

@ -58,8 +58,9 @@ server.on('upgrade', wsupgrade);
/* /*
* use gzip compression for following calls * use gzip compression for following calls
/* level from -1 (default, 6) to 0 (no) from 1 (fastest) to 9 (best) * level from -1 (default, 6) to 0 (no) from 1 (fastest) to 9 (best)
* Set custon filter to make sure that .bmp files get compressed *
* Set custom filter to make sure that .bmp files get compressed
*/ */
app.use(compression({ app.use(compression({
level: 3, level: 3,
@ -99,7 +100,7 @@ sequelize.sync({ alter: { drop: false } })
// catch errors of server // catch errors of server
server.on('error', (e) => { server.on('error', (e) => {
logger.error( logger.error(
`HTTP Server Error ${e.code} occured, trying again in 5s...`, `HTTP Server Error ${e.code} occurred, trying again in 5s...`,
); );
setTimeout(() => { setTimeout(() => {
server.close(); server.close();

View File

@ -222,7 +222,7 @@ class APISocketServer {
} else if (even === 'online') { } else if (even === 'online') {
ws.subOnline = true; ws.subOnline = true;
} else { } else {
logger.info(`APISocket wanted to sub to unexisting ${even}`); logger.info(`APISocket wanted to sub to nonexistent ${even}`);
} }
logger.info(`APISocket client subscribed to ${even}`); logger.info(`APISocket client subscribed to ${even}`);
return; return;

View File

@ -141,7 +141,7 @@ class MessageBroker extends SocketEvents {
(buffer) => this.onShardBinaryMessage(buffer, message), (buffer) => this.onShardBinaryMessage(buffer, message),
true, true,
); );
// immediately give new shards informations // immediately give new shards information
this.publisher.publish(BROADCAST_CHAN, this.thisShard); this.publisher.publish(BROADCAST_CHAN, this.thisShard);
return; return;
} }
@ -285,7 +285,7 @@ class MessageBroker extends SocketEvents {
} }
} catch (err) { } catch (err) {
// eslint-disable-next-line max-len // eslint-disable-next-line max-len
console.error(`CLUSTER: Error on binery message of shard ${shard}: ${err.message}`); console.error(`CLUSTER: Error on binary message of shard ${shard}: ${err.message}`);
} }
} }

View File

@ -51,7 +51,7 @@ class SocketEvents extends EventEmitter {
/* /*
* requests that expect a response * requests that expect a response
* req(type, args) can be awaited * req(type, args) can be awaited
* it will return a response from whatever listenes on onReq(type, cb(args)) * it will return a response from whatever listens on onReq(type, cb(args))
* Keep the arguments serializable for shard support * Keep the arguments serializable for shard support
*/ */
req(type, ...args) { req(type, ...args) {
@ -104,7 +104,7 @@ class SocketEvents extends EventEmitter {
/* /*
* chunk updates from event, image upload, etc. * chunk updates from event, image upload, etc.
* everything thats not a pixelUpdate and changes chunks * everything that's not a pixelUpdate and changes chunks
* @param canvasId * @param canvasId
* @param chunk [i,j] chunk coordinates * @param chunk [i,j] chunk coordinates
*/ */
@ -152,8 +152,8 @@ class SocketEvents extends EventEmitter {
* broadcast chat message to all users in channel * broadcast chat message to all users in channel
* @param name chatname * @param name chatname
* @param message Message to send * @param message Message to send
* @param sendapi If chat message should get boradcasted to api websockets * @param sendapi If chat message should get broadcasted to api websockets
* (usefull if the api is supposed to not answer to its own messages) * (useful if the api is supposed to not answer to its own messages)
*/ */
broadcastChatMessage( broadcastChatMessage(
name, name,

View File

@ -240,7 +240,7 @@ class SocketClient {
} }
} catch (err) { } catch (err) {
console.log( console.log(
`An error occured while parsing websocket message ${message}`, `An error occurred while parsing websocket message ${message}`,
err, err,
); );
} }

View File

@ -1,4 +1,4 @@
# Binary Websocket Packages # Binary Websocket Packages
Note that the node Server receives and sends in [Buffer](https://nodejs.org/api/buffer.html), while the client receives [DataViews](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) and sends ArrayBuffers. Note that the node Server receives and sends in [Buffer](https://nodejs.org/api/buffer.html), while the client receives [DataViews](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) and sends ArrayBuffers.
Therefor the server can't share the same code with the client for hydrate / dehydrate and it's split in two files. Therefore, the server can't share the same code with the client for hydrate / dehydrate, and it's split in two files.

View File

@ -2,14 +2,14 @@
* server package hydration * server package hydration
*/ */
import { import {
CHANGE_ME_OP,
ONLINE_COUNTER_OP,
PIXEL_UPDATE_OP,
PIXEL_UPDATE_MB_OP,
COOLDOWN_OP,
PIXEL_RETURN_OP,
CHUNK_UPDATE_MB_OP,
CAPTCHA_RETURN_OP, CAPTCHA_RETURN_OP,
CHANGE_ME_OP,
CHUNK_UPDATE_MB_OP,
COOLDOWN_OP,
ONLINE_COUNTER_OP,
PIXEL_RETURN_OP,
PIXEL_UPDATE_MB_OP,
PIXEL_UPDATE_OP,
} from './op'; } from './op';
/* /*
@ -20,8 +20,7 @@ import {
* @return canvasId * @return canvasId
*/ */
export function hydrateRegCanvas(data) { export function hydrateRegCanvas(data) {
const canvasId = data[1]; return data[1];
return canvasId;
} }
/* /*
@ -47,16 +46,14 @@ export function hydrateOnlineCounter(data) {
* @return chunkId * @return chunkId
*/ */
export function hydrateRegChunk(data) { export function hydrateRegChunk(data) {
const i = data[1] << 8 | data[2]; return data[1] << 8 | data[2];
return i;
} }
/* /*
* @return chunkId * @return chunkId
*/ */
export function hydrateDeRegChunk(data) { export function hydrateDeRegChunk(data) {
const i = data[1] << 8 | data[2]; return data[1] << 8 | data[2];
return i;
} }
/* /*

View File

@ -9,7 +9,7 @@ import { getTTag } from '../core/ttag';
export default function getPasswordResetHtml(name, code, lang, message = null) { export default function getPasswordResetHtml(name, code, lang, message = null) {
const { t } = getTTag(lang); const { t } = getTTag(lang);
let html = ''; let html;
if (message) { if (message) {
html = ` html = `

View File

@ -25,7 +25,7 @@ export const shardOrigin = shardHost
&& `${window.location.protocol}//${shardHost}`; && `${window.location.protocol}//${shardHost}`;
/* /*
* Adds customizeable timeout to fetch * Adds customizable timeout to fetch
* defaults to 8s * defaults to 8s
*/ */
async function fetchWithTimeout(url, options = {}) { async function fetchWithTimeout(url, options = {}) {
@ -152,7 +152,7 @@ export async function requestBlock(userId, block) {
} }
/* /*
* set / unset provile as private * set / unset profile as private
* @param priv * @param priv
* @return error string or null if successful * @return error string or null if successful
*/ */
@ -210,7 +210,7 @@ export async function requestBlockDm(block) {
/* /*
* leaving Chat Channel (i.e. DM channel) * leaving Chat Channel (i.e. DM channel)
* @param channelId 8nteger id of channel * @param channelId integer id of channel
* @return error string or null if successful * @return error string or null if successful
*/ */
export async function requestLeaveChan(channelId) { export async function requestLeaveChan(channelId) {

View File

@ -1,5 +1,5 @@
/* /*
* Actions taht are used only within popup * Actions that are used only within popup
*/ */
export function setWindowArgs(args) { export function setWindowArgs(args) {

View File

@ -23,7 +23,7 @@ export function receiveChatMessage(
return (dispatch, getState) => { return (dispatch, getState) => {
channel = Number(channel); channel = Number(channel);
const state = getState(); const state = getState();
let isRead = false; let isRead;
if (state.windows) { if (state.windows) {
isRead = state.windows.windows.some( isRead = state.windows.windows.some(
(win) => win.windowType === 'CHAT' && !win.hidden, (win) => win.windowType === 'CHAT' && !win.hidden,

View File

@ -1,5 +1,5 @@
/* /*
* play sounds using the HTML5 AudoContext * play sounds using the HTML5 AudioContext
*/ */

View File

@ -1,5 +1,5 @@
/** /**
* set URL in adress bar, theme-color and title * set URL in address bar, theme-color and title
*/ */
import { import {

View File

@ -1,5 +1,5 @@
/* /*
* set URL and querys in pupup window * set URL and queries in popup window
*/ */
import { buildPopUpUrl } from '../../components/windows/popUpAvailable'; import { buildPopUpUrl } from '../../components/windows/popUpAvailable';

View File

@ -33,7 +33,7 @@ export type CanvasState = {
historicalDate: string, historicalDate: string,
historicalTime: string, historicalTime: string,
hover: Array, hover: Array,
// object with all canvas informations from all canvases like colors and size // object with all canvas information from all canvases like colors and size
canvases: Object, canvases: Object,
// last canvas view, scale, selectedColor and viewscale // last canvas view, scale, selectedColor and viewscale
// just used to get back to the previous coordinates when switching // just used to get back to the previous coordinates when switching
@ -46,7 +46,7 @@ export type CanvasState = {
/* /*
* parse url hash and sets view to coordinates * parse url hash and sets view to coordinates
* @param canvases Object with all canvas informations * @param canvases Object with all canvas information
* @return view, viewscale and scale for state * @return view, viewscale and scale for state
*/ */
function getViewFromURL(canvases) { function getViewFromURL(canvases) {
@ -331,7 +331,7 @@ export default function canvasReducer(
scale, scale,
isHistoricalView, isHistoricalView,
historicalCanvasSize, historicalCanvasSize,
// rember view, scale and viewscale // remember view, scale and viewscale
prevCanvasCoords: { prevCanvasCoords: {
...state.prevCanvasCoords, ...state.prevCanvasCoords,
[prevCanvasId]: { [prevCanvasId]: {

View File

@ -3,7 +3,7 @@
* *
*/ */
const TIME_DIFF_THREASHOLD = 15000; const TIME_DIFF_THRESHOLD = 15000;
const initialState = { const initialState = {
// channels that are muted // channels that are muted
@ -81,8 +81,8 @@ export default function chatRead(
const readTs = isRead const readTs = isRead
? { ? {
...state.readTs, ...state.readTs,
// 15s treshold for desync // 15s threshold for desync
[cid]: Date.now() + TIME_DIFF_THREASHOLD, [cid]: Date.now() + TIME_DIFF_THRESHOLD,
} : state.readTs; } : state.readTs;
const unread = isRead const unread = isRead
? state.unread ? state.unread
@ -107,7 +107,7 @@ export default function chatRead(
...state, ...state,
readTs: { readTs: {
...state.readTs, ...state.readTs,
[cid]: Date.now() + TIME_DIFF_THREASHOLD, [cid]: Date.now() + TIME_DIFF_THRESHOLD,
}, },
unread: { unread: {
...state.unread, ...state.unread,
@ -122,7 +122,7 @@ export default function chatRead(
...state, ...state,
readTs: { readTs: {
...state.readTs, ...state.readTs,
[cid]: Date.now() + TIME_DIFF_THREASHOLD, [cid]: Date.now() + TIME_DIFF_THRESHOLD,
}, },
unread: { unread: {
...state.unread, ...state.unread,

View File

@ -7,7 +7,7 @@ const initialState = {
fetchingChunks: 0, fetchingChunks: 0,
fetchingChat: false, fetchingChat: false,
fetchingPixel: false, fetchingPixel: false,
fetchinApi: false, fetchingApi: false,
}; };
export default function fetching( export default function fetching(
@ -24,10 +24,10 @@ export default function fetching(
} }
case 'SET_API_FETCHING': { case 'SET_API_FETCHING': {
const { fetching: fetchinApi } = action; const { fetching: fetchingApi } = action;
return { return {
...state, ...state,
fetchinApi, fetchingApi,
}; };
} }

View File

@ -9,7 +9,7 @@ const initialState = {
mailreg: false, mailreg: false,
// blocking all Dms // blocking all Dms
blockDm: false, blockDm: false,
// privile is private // profile is private
priv: false, priv: false,
// if user is using touchscreen // if user is using touchscreen
isOnMobile: false, isOnMobile: false,

View File

@ -69,7 +69,7 @@ function clampPos(prefXPos, prefYPos, width, height) {
} }
/* /*
* correct window positions according to screensize * correct window positions according to screen size
* to make sure that none if off-screen * to make sure that none if off-screen
*/ */
function correctPositions(state) { function correctPositions(state) {
@ -189,7 +189,7 @@ export default function windows(
switch (action.type) { switch (action.type) {
case 'OPEN_WIN': { case 'OPEN_WIN': {
/* /*
* prefered xPos, yPos, height adn width * preferred xPos, yPos, height adn width
* can be given in action (but doesn't have to) * can be given in action (but doesn't have to)
*/ */
const { const {

View File

@ -4,4 +4,4 @@
export const selectWindowType = (state) => state.popup.windowType; export const selectWindowType = (state) => state.popup.windowType;
export const selectWIndowArgs = (state) => state.popup.args; export const selectWindowArgs = (state) => state.popup.args;

View File

@ -61,7 +61,7 @@ const store = createStore(
); );
/* /*
* persistStore of redix-persist is called in client.js * persistStore of redux-persist is called in client.js
*/ */
export default store; export default store;

View File

@ -8,10 +8,10 @@ class Chunk {
// if chunk receives updates via websocket // if chunk receives updates via websocket
recUpdates = false; recUpdates = false;
// timestamp of last touch, // timestamp of last touch,
// mustbe regularly updated for GC, // must be regularly updated for GC,
// either by touch() or by setting directly // either by touch() or by setting directly
timestamp; timestamp;
// coordiantes // coordinates
z; z;
i; i;
j; j;

View File

@ -5,7 +5,7 @@ import Chunk from './Chunk';
class Chunk2D extends Chunk { class Chunk2D extends Chunk {
// HTMLCanvasElement of chunk // HTMLCanvasElement of chunk
image; image;
// boolean if chunk loeaded (request done) // boolean if chunk loaded (request done)
ready; ready;
// boolean if chunk is empty // boolean if chunk is empty
isEmpty; isEmpty;

View File

@ -116,7 +116,7 @@ class Chunk3D extends Chunk {
} }
/* /*
// Test Sin encironment creation for load tests // Test Sin environment creation for load tests
async generateSin() { async generateSin() {
let cnt = 0; let cnt = 0;
this.buffer = new Uint8Array(THREE_TILE_SIZE * THREE_TILE_SIZE * THREE_CANVAS_HEIGHT); this.buffer = new Uint8Array(THREE_TILE_SIZE * THREE_TILE_SIZE * THREE_CANVAS_HEIGHT);
@ -156,13 +156,13 @@ class Chunk3D extends Chunk {
let faceCnt = 0; let faceCnt = 0;
for (let z = THREE_TILE_SIZE - 1; z >= 0; --z) { for (let z = THREE_TILE_SIZE - 1; z >= 0; --z) {
for (let x = THREE_TILE_SIZE - 1; x >= 0; --x) { for (let x = THREE_TILE_SIZE - 1; x >= 0; --x) {
let heighestPixel = 0; let highestPixel = 0;
const startOffset = x + z * THREE_TILE_SIZE; const startOffset = x + z * THREE_TILE_SIZE;
let u = startOffset; let u = startOffset;
for (let y = 0; y < THREE_CANVAS_HEIGHT; ++y) { for (let y = 0; y < THREE_CANVAS_HEIGHT; ++y) {
if (buffer[u] !== 0) { if (buffer[u] !== 0) {
// heighest pixel fo x,z in heightmap // highest pixel fo x,z in heightmap
heighestPixel = y; highestPixel = y;
// number of faces to render // number of faces to render
if (x === 0 if (x === 0
|| buffer[u - 1] === 0) { || buffer[u - 1] === 0) {
@ -191,11 +191,11 @@ class Chunk3D extends Chunk {
} }
u += rowVolume; u += rowVolume;
} }
heightMap[startOffset] = heighestPixel; heightMap[startOffset] = highestPixel;
if (heighestPixel > totalHeight) { if (highestPixel > totalHeight) {
// last total pixel // last total pixel
totalHeight = heighestPixel; totalHeight = highestPixel;
lastPixel = Chunk3D.getOffsetOfVoxel(x, heighestPixel, z); lastPixel = Chunk3D.getOffsetOfVoxel(x, highestPixel, z);
} }
} }
} }
@ -281,7 +281,7 @@ class Chunk3D extends Chunk {
const colors = new Uint8Array(faceCnt * 4 * 3); const colors = new Uint8Array(faceCnt * 4 * 3);
const indices = new Uint32Array(faceCnt * 6); const indices = new Uint32Array(faceCnt * 6);
const { rgb } = this.palette; const { rgb } = this.palette;
// just render faces that do not have an adjescent voxel // just render faces that do not have an adjacent voxel
for (let z = 0; z < THREE_TILE_SIZE; ++z) { for (let z = 0; z < THREE_TILE_SIZE; ++z) {
for (let x = 0; x < THREE_TILE_SIZE; ++x) { for (let x = 0; x < THREE_TILE_SIZE; ++x) {
const startOffset = x + z * THREE_TILE_SIZE; const startOffset = x + z * THREE_TILE_SIZE;

View File

@ -56,7 +56,7 @@ class ChunkLoader {
cset(key, chunk) { cset(key, chunk) {
/* /*
* chunks are not neccessarily fully loaded here, * chunks are not necessarily fully loaded here,
* but they are in bcRecChunk * but they are in bcRecChunk
*/ */
this.#chunks.set(key, chunk); this.#chunks.set(key, chunk);

View File

@ -71,8 +71,8 @@ class ChunkLoader2D extends ChunkLoader {
/* /*
* Get color of pixel in current historical view * Get color of pixel in current historical view
* (has to account for canvs size changes in the past * (has to account for canvas size changes in the past
* @param x, y world coordiantes of pixel * @param x, y world coordinates of pixel
* @return ColorIndex or null if chunks not loaded or historical view not set * @return ColorIndex or null if chunks not loaded or historical view not set
*/ */
getHistoricalIndexOfPixel( getHistoricalIndexOfPixel(
@ -91,13 +91,13 @@ class ChunkLoader2D extends ChunkLoader {
if (historicalTime && historicalTime !== '0000') { if (historicalTime && historicalTime !== '0000') {
// eslint-disable-next-line max-len // eslint-disable-next-line max-len
const incrementialChunkKey = `${historicalDate}${historicalTime}:${cx}:${cy}`; const incrementalChunkKey = `${historicalDate}${historicalTime}:${cx}:${cy}`;
const incrementialChunk = this.cget(incrementialChunkKey); const incrementalChunk = this.cget(incrementalChunkKey);
if (incrementialChunk) { if (incrementalChunk) {
const incrementialColor = incrementialChunk.getColorIndex(px, false); const incrementalColor = incrementalChunk.getColorIndex(px, false);
incrementialChunk.timestamp = curTime; incrementalChunk.timestamp = curTime;
if (incrementialColor !== null) { if (incrementalColor !== null) {
return incrementialColor; return incrementalColor;
} }
} }
} }
@ -146,7 +146,7 @@ class ChunkLoader2D extends ChunkLoader {
} }
} catch (error) { } catch (error) {
// eslint-disable-next-line no-console // eslint-disable-next-line no-console
console.warn(`Error occured while preloading for ${zoom}:${cx}:${cy}`, console.warn(`Error occurred while preloading for ${zoom}:${cx}:${cy}`,
error); error);
return null; return null;
} }
@ -234,7 +234,7 @@ class ChunkLoader2D extends ChunkLoader {
// eslint-disable-next-line max-len // eslint-disable-next-line max-len
let url = `${window.ssv.backupurl}/${historicalDate.slice(0, 4)}/${historicalDate.slice(4, 6)}/${historicalDate.slice(6)}/`; let url = `${window.ssv.backupurl}/${historicalDate.slice(0, 4)}/${historicalDate.slice(4, 6)}/${historicalDate.slice(6)}/`;
if (historicalTime) { if (historicalTime) {
// incremential tiles // incremental tiles
url += `${canvasId}/${historicalTime}/${cx}/${cy}.png`; url += `${canvasId}/${historicalTime}/${cx}/${cy}.png`;
} else { } else {
// full tiles // full tiles

View File

@ -66,8 +66,8 @@ class PixelNotify {
while (index > 0) { while (index > 0) {
index--; index--;
const [setTime, x, y] = this.pixelList[index]; const [setTime, x, y] = this.pixelList[index];
const timePasseded = curTime - setTime; const timePassed = curTime - setTime;
if (timePasseded > PixelNotify.NOTIFICATION_TIME) { if (timePassed > PixelNotify.NOTIFICATION_TIME) {
this.pixelList.pop(); this.pixelList.pop();
continue; continue;
} }
@ -75,7 +75,7 @@ class PixelNotify {
.map((z) => z + this.scale / 2); .map((z) => z + this.scale / 2);
// eslint-disable-next-line max-len // eslint-disable-next-line max-len
const notRadius = timePasseded / PixelNotify.NOTIFICATION_TIME * this.notificationRadius; const notRadius = timePassed / PixelNotify.NOTIFICATION_TIME * this.notificationRadius;
const circleScale = notRadius / 100; const circleScale = notRadius / 100;
viewportCtx.save(); viewportCtx.save();
viewportCtx.scale(circleScale, circleScale); viewportCtx.scale(circleScale, circleScale);

View File

@ -1,5 +1,5 @@
/* /*
* Control in- and outcomming pixels, * Control incoming and outgoing pixels,
* do client prediction, send to draw on renderer * do client prediction, send to draw on renderer
*/ */
import { t } from 'ttag'; import { t } from 'ttag';
@ -132,7 +132,7 @@ class PixelTransferController {
store.dispatch(notify(t`Pixel protected!`)); store.dispatch(notify(t`Pixel protected!`));
break; break;
case 9: case 9:
// pixestack used up // pixelstack used up
break; break;
case 10: case 10:
errorTitle = 'Captcha'; errorTitle = 'Captcha';

View File

@ -415,7 +415,7 @@ class Renderer2D extends Renderer {
// keep in mind that everything we got here gets executed 60 times per second // keep in mind that everything we got here gets executed 60 times per second
// avoiding unneccessary stuff is important // avoiding unnecessary stuff is important
renderMain( renderMain(
state, state,
) { ) {
@ -631,7 +631,7 @@ class Renderer2D extends Renderer {
} else { } else {
context.fillRect(x, y, TILE_SIZE, TILE_SIZE); context.fillRect(x, y, TILE_SIZE, TILE_SIZE);
} }
// incremential chunks // incremental chunks
if (historicalTime === '0000') continue; if (historicalTime === '0000') continue;
chunk = this.chunkLoader chunk = this.chunkLoader
.getHistoricalChunk(cx, cy, true, historicalDate, historicalTime); .getHistoricalChunk(cx, cy, true, historicalDate, historicalTime);
@ -666,7 +666,7 @@ class Renderer2D extends Renderer {
// keep in mind that everything we got here gets executed 60 times per second // keep in mind that everything we got here gets executed 60 times per second
// avoiding unneccessary stuff is important // avoiding unnecessary stuff is important
renderHistorical( renderHistorical(
state, state,
) { ) {

View File

@ -495,7 +495,7 @@ class Renderer3D extends Renderer {
switch (multitap) { switch (multitap) {
case 1: { case 1: {
// singel tap // single tap
// Place Voxel // Place Voxel
if (this.rollOverMesh.position.y < 0) { if (this.rollOverMesh.position.y < 0) {
return; return;

View File

@ -79,7 +79,7 @@ Sky.SkyShader = {
// wavelength of used primaries, according to preetham // wavelength of used primaries, according to preetham
const vec3 lambda = vec3( 680E-9, 550E-9, 450E-9 ); const vec3 lambda = vec3( 680E-9, 550E-9, 450E-9 );
// this pre-calcuation replaces older TotalRayleigh(vec3 lambda) function: // this pre-calculation replaces older TotalRayleigh(vec3 lambda) function:
// (8.0 * pow(pi, 3.0) * pow(pow(n, 2.0) - 1.0, 2.0) * (6.0 + 3.0 * pn)) / (3.0 * N * pow(lambda, vec3(4.0)) * (6.0 - 7.0 * pn)) // (8.0 * pow(pi, 3.0) * pow(pow(n, 2.0) - 1.0, 2.0) * (6.0 + 3.0 * pn)) / (3.0 * N * pow(lambda, vec3(4.0)) * (6.0 - 7.0 * pn))
const vec3 totalRayleigh = vec3( 5.804542996261093E-6, 1.3562911419845635E-5, 3.0265902468824876E-5 ); const vec3 totalRayleigh = vec3( 5.804542996261093E-6, 1.3562911419845635E-5, 3.0265902468824876E-5 );
@ -122,7 +122,7 @@ Sky.SkyShader = {
float rayleighCoefficient = rayleigh - ( 1.0 * ( 1.0 - vSunfade ) ); float rayleighCoefficient = rayleigh - ( 1.0 * ( 1.0 - vSunfade ) );
// extinction (absorbtion + out scattering) // extinction (absorption + out scattering)
// rayleigh coefficients // rayleigh coefficients
vBetaR = totalRayleigh * rayleighCoefficient; vBetaR = totalRayleigh * rayleighCoefficient;

View File

@ -50,8 +50,7 @@ class LoadingTiles {
return; return;
} }
this.tiles[canvasId] = null; this.tiles[canvasId] = null;
const img = await loadImage(`./loading${canvasId}.png`); this.tiles[canvasId] = await loadImage(`./loading${canvasId}.png`);
this.tiles[canvasId] = img;
} }
} }

View File

@ -1,5 +1,5 @@
/* /*
* placeholder that shows underneach cursor * placeholder that shows underneath cursor
* *
*/ */

View File

@ -10,8 +10,7 @@ export default class Counter {
} }
get(item) { get(item) {
const count = this.map.get(item) || 0; return this.map.get(item) || 0;
return count;
} }
add(item) { add(item) {

View File

@ -11,13 +11,13 @@ import { HourlyCron } from './cron';
const HYSTERESIS = 60; const HYSTERESIS = 60;
/* /*
* class to serve proxyckec.io key * class to serve proxycheck.io key
* One paid account is allowed to have one additional free account, * One paid account is allowed to have one additional free account,
* which is good for fallback, if something goes wrong * which is good for fallback, if something goes wrong
*/ */
class PcKeyProvider { class PcKeyProvider {
/* /*
* @param pcKeys comma seperated list of keys * @param pcKeys comma separated list of keys
*/ */
constructor(pcKeys, logger) { constructor(pcKeys, logger) {
const keys = (pcKeys) const keys = (pcKeys)
@ -86,7 +86,7 @@ class PcKeyProvider {
} }
/* /*
* get usage data of array of keys and put them into available / diabledKeys * get usage data of array of keys and put them into available / disabledKeys
* @param keys Array of key strings * @param keys Array of key strings
*/ */
async getKeysUsage(keys) { async getKeysUsage(keys) {
@ -346,7 +346,7 @@ class ProxyCheck {
try { try {
res = await this.reqProxyCheck(values); res = await this.reqProxyCheck(values);
} catch (err) { } catch (err) {
this.logger.error(`Eroor: ${err.message}`); this.logger.error(`Error: ${err.message}`);
} }
for (let i = 0; i < tasks.length; i += 1) { for (let i = 0; i < tasks.length; i += 1) {
const task = tasks[i]; const task = tasks[i];

View File

@ -11,7 +11,7 @@
* as well, there is no chance for this to be merged upstream * as well, there is no chance for this to be merged upstream
* *
* Links: * Links:
* express-session readmy with Session Store Implementation section: * express-session readme with Session Store Implementation section:
* https://github.com/expressjs/session#readme * https://github.com/expressjs/session#readme
* *
*/ */

View File

@ -60,13 +60,11 @@ function initializeDailyCron() {
const lastRun = now.getTime() const lastRun = now.getTime()
- now.getUTCHours() * HOUR - now.getUTCHours() * HOUR
- (now.getUTCMinutes() * 60 + now.getUTCSeconds()) * 1000; - (now.getUTCMinutes() * 60 + now.getUTCSeconds()) * 1000;
const cron = new Cron(24, lastRun); return new Cron(24, lastRun);
return cron;
} }
function initializeHourlyCron() { function initializeHourlyCron() {
const cron = new Cron(1); return new Cron(1);
return cron;
} }
export const DailyCron = initializeDailyCron(); export const DailyCron = initializeDailyCron();

View File

@ -1,6 +1,6 @@
/** /**
* *
* basic functions to get data fromheaders and parse IPs * basic functions to get data from headers and parse IPs
*/ */
import { USE_XREALIP } from '../core/config'; import { USE_XREALIP } from '../core/config';
@ -23,11 +23,10 @@ function ip4ToNum(ipString) {
)) { )) {
return null; return null;
} }
const ipNum = (ipArr[0] << 24) return (ipArr[0] << 24)
+ (ipArr[1] << 16) + (ipArr[1] << 16)
+ (ipArr[2] << 8) + (ipArr[2] << 8)
+ ipArr[3]; + ipArr[3];
return ipNum;
} }
/* /*
@ -106,7 +105,7 @@ export function isIPv6(ip) {
/* /*
* Set last digits of IPv6 to zero, * Set last digits of IPv6 to zero,
* needed because IPv6 assignes subnets to customers, we don't want to * needed because IPv6 assigns subnets to customers, we don't want to
* mess with individual ips * mess with individual ips
* @param ip ip as string (v4 or v6) * @param ip ip as string (v4 or v6)
* @return ip as string, and if v6, the last digits set to 0 * @return ip as string, and if v6, the last digits set to 0
@ -114,15 +113,16 @@ export function isIPv6(ip) {
export function getIPv6Subnet(ip) { export function getIPv6Subnet(ip) {
if (isIPv6(ip)) { if (isIPv6(ip)) {
// eslint-disable-next-line max-len // eslint-disable-next-line max-len
const ipv6sub = `${ip.split(':').slice(0, 4).join(':')}:0000:0000:0000:0000`; return `${ip.split(':')
return ipv6sub; .slice(0, 4)
.join(':')}:0000:0000:0000:0000`;
} }
return ip; return ip;
} }
/* /*
* Get numerical start and end of range * Get numerical start and end of range
* @param range sring of range in the format 'xxx.xxx.xxx.xxx - xxx.xxx.xxx.xxx' * @param range string of range in the format 'xxx.xxx.xxx.xxx - xxx.xxx.xxx.xxx'
* @return [start, end] with numerical IPs (32bit integer) * @return [start, end] with numerical IPs (32bit integer)
*/ */
function ip4RangeStrToRangeNum(range) { function ip4RangeStrToRangeNum(range) {
@ -161,7 +161,7 @@ function ip4RangeNumToCIDR([start, end]) {
/* /*
* Get Array of CIDRs for an IPv4 range * Get Array of CIDRs for an IPv4 range
* @param range sring of range in the format 'xxx.xxx.xxx.xxx - xxx.xxx.xxx.xxx' * @param range string of range in the format 'xxx.xxx.xxx.xxx - xxx.xxx.xxx.xxx'
* @return Array of CIDR strings * @return Array of CIDR strings
*/ */
export function ip4RangeToCIDR(range) { export function ip4RangeToCIDR(range) {

View File

@ -3,7 +3,7 @@
*/ */
/* /*
* gets prefered language out of localisation string * gets preferred language out of localisation string
* @param location string (like from accept-language header) * @param location string (like from accept-language header)
* @return language code * @return language code
*/ */
@ -45,6 +45,7 @@ const lang2CC = {
sr: 'rs', sr: 'rs',
be: 'by', be: 'by',
kk: 'kz', kk: 'kz',
da: 'dk',
}; };
export function langCodeToCC(lang) { export function langCodeToCC(lang) {
return lang2CC[lang] || lang; return lang2CC[lang] || lang;

View File

@ -94,7 +94,7 @@ export function validateCoorRange(ulcoor, brcoor, canvasSize) {
} else if (Number.isNaN(v)) { } else if (Number.isNaN(v)) {
error = 'y of bottom-right corner is not a valid number'; error = 'y of bottom-right corner is not a valid number';
} else if (u < x || v < y) { } else if (u < x || v < y) {
error = 'Corner coordinates are alligned wrong'; error = 'Corner coordinates are aligned wrong';
} }
if (error !== null) { if (error !== null) {
return error; return error;

View File

@ -170,7 +170,7 @@ function singleWhoisQuery(
} }
/* /*
* check if whois result is refering us to * check if whois result is referring us to
* a different whois server * a different whois server
*/ */
const referralKeys = [ const referralKeys = [
@ -219,8 +219,8 @@ export default async function whoisIp(
queryPrefix = '+ n'; queryPrefix = '+ n';
} else if (useHost === 'whois.ripe.net') { } else if (useHost === 'whois.ripe.net') {
/* /*
* flag to not return personal informations, otherwise * flag to not return personal information, otherwise
* RIPE is gonne rate limit and ban * RIPE is gonna rate limit and ban
*/ */
queryPrefix = '-r'; queryPrefix = '-r';
} }