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 {
updateBackupRedis,
createPngBackup,
incrementialBackupRedis,
incrementalBackupRedis,
updateBackupRedis,
} from './core/tilesBackup';
import canvases from './core/canvases';
@ -122,8 +122,7 @@ function getDateFolder() {
if (month < 10) month = `0${month}`;
if (day < 10) day = `0${day}`;
const dayDir = `${date.getUTCFullYear()}/${month}/${day}`;
const backupDir = `${dir}/${dayDir}`;
return backupDir;
return `${dir}/${dayDir}`;
}
async function dailyBackup() {
@ -139,25 +138,25 @@ async function dailyBackup() {
await createPngBackup(backupRedis, canvases, backupDir);
} catch (e) {
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');
}
async function incrementialBackup() {
async function incrementalBackup() {
const backupDir = getDateFolder();
if (!fs.existsSync(backupDir)) {
fs.mkdirSync(backupDir, { recursive: true });
}
try {
await incrementialBackupRedis(
await incrementalBackupRedis(
canvasRedis,
backupRedis,
canvases,
backupDir,
);
} 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)) {
await dailyBackup();
} else {
await incrementialBackup();
await incrementalBackup();
}
if (CMD) {
runCmd(CMD);

View File

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

View File

@ -63,7 +63,7 @@ const BanInfo = ({ close }) => {
return (
<div style={{ userSelect: 'text' }}>
<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
role="button"
tabIndex={0}

View File

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

View File

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

View File

@ -5,7 +5,7 @@
import React, { useMemo } from 'react';
import { useSelector, useDispatch } from 'react-redux';
import { selectWindowType, selectWIndowArgs } from '../store/selectors/popup';
import { selectWindowType, selectWindowArgs } from '../store/selectors/popup';
import {
setWindowArgs,
setWindowTitle,
@ -16,7 +16,7 @@ import COMPONENTS from './windows';
const UIPopUp = () => {
const windowType = useSelector(selectWindowType);
const args = useSelector(selectWIndowArgs);
const args = useSelector(selectWindowArgs);
const [Content] = COMPONENTS[windowType];
@ -27,7 +27,7 @@ const UIPopUp = () => {
setArgs: (newArgs) => dispatch(setWindowArgs(newArgs)),
setTitle: (title) => dispatch(setWindowTitle(title)),
// 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]);
return (

View File

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

View File

@ -40,10 +40,10 @@ const Window = ({ id }) => {
const resizeRef = useRef();
const selectWindowById = useMemo(() => makeSelectWindowById(id), []);
const selectWIndowPosById = useMemo(() => makeSelectWindowPosById(id), []);
const selectWindowPosById = useMemo(() => makeSelectWindowPosById(id), []);
const selectWindowArgs = useMemo(() => makeSelectWindowArgs(id), []);
const win = useSelector(selectWindowById);
const position = useSelector(selectWIndowPosById);
const position = useSelector(selectWindowPosById);
const showWindows = useSelector(selectShowWindows);
const args = useSelector(selectWindowArgs);
@ -54,7 +54,7 @@ const Window = ({ id }) => {
setArgs: (newArgs) => dispatch(setWindowArgs(id, newArgs)),
setTitle: (title) => dispatch(setWindowTitle(id, title)),
// 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]);
const {

View File

@ -15,7 +15,7 @@ import {
} from '../../store/actions/windows';
/*
* return [ chatOpen, chatHiden ]
* return [ chatOpen, chatHidden ]
* chatOpen: if any chat window or modal is open
* 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
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[4] > c2[4]) return -1;
if (c2[4] > c1[4]) return 1;

View File

@ -1,6 +1,6 @@
/*
* 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
*/
import React from 'react';
@ -18,7 +18,7 @@ function stripCol(str) {
const urlStr = '/@';
const Odysee = ({ url }) => {
let oid = null;
let oid;
let posA = url.indexOf(urlStr);
if (posA !== -1) {
oid = url.substring(url.indexOf('/', posA + urlStr.length) + 1);
@ -60,10 +60,7 @@ export default [
return false;
}
posA = urlPart.indexOf('/', posA + urlStr.length);
if (posA === -1 || posA + 2 >= urlPart.length) {
return false;
}
return true;
return !(posA === -1 || posA + 2 >= urlPart.length);
}
// https://odysee.com/why-we-were-wrong-about-ukraine:6bd300b38bf1b30fa56e53c191b0652682c2ae6f
posA = urlPart.indexOf('//');
@ -71,10 +68,7 @@ export default [
posA = 0;
}
posA = urlPart.indexOf('/', posA + 2);
if (posA === -1 || posA + 2 >= urlPart.length) {
return false;
}
return true;
return !(posA === -1 || posA + 2 >= urlPart.length);
},
(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
* as long as active is true
* @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
*/
export function useConditionalClickOutside(insideRefs, active, callback) {

View File

@ -1,5 +1,5 @@
/*
* mouse draging
* mouse dragging
*/
/* eslint-disable consistent-return */
@ -9,7 +9,7 @@ import { useEffect, useCallback } from 'react';
/*
* @param elRef element reference from useRef
* @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) {
const startDrag = useCallback((event) => {

View File

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

View File

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

View File

@ -241,11 +241,8 @@ export class ChatProvider {
return true;
}
const { lang } = user;
if (this.langChannels[lang]
&& this.langChannels[lang].id === cid) {
return true;
}
return false;
return !!(this.langChannels[lang]
&& this.langChannels[lang].id === cid);
}
checkIfDm(user, cid) {
@ -308,7 +305,7 @@ export class ChatProvider {
return 'No legit country defined';
}
if (!ret) {
return `Cuntry ${cc} is already muted`;
return `Country ${cc} is already muted`;
}
if (ret) {
this.broadcastChatMessage(
@ -331,7 +328,7 @@ export class ChatProvider {
return 'No legit country defined';
}
if (!ret) {
return `Cuntry ${cc} is not muted`;
return `Country ${cc} is not muted`;
}
this.broadcastChatMessage(
'info',
@ -379,7 +376,7 @@ export class ChatProvider {
}
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`;
} if (allowed === 101) {
// 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) {
return t`You are banned`;
} if (allowed === 3) {
@ -474,14 +471,14 @@ export class ChatProvider {
let displayCountry = country;
if (user.userlvl !== 0) {
displayCountry = 'zz';
/*
* meme names disabled for now
* TODO think about activating it again after fixing accounts and
* mute evasions
*
} else if (name.endsWith('berg') || name.endsWith('stein')) {
displayCountry = 'il';
/ */
/*
* meme names disabled for now
* TODO think about activating it again after fixing accounts and
* mute evasions
*
} else if (name.endsWith('berg') || name.endsWith('stein')) {
displayCountry = 'il';
/ */
} else if (user.id === 2927) {
/*
* hard coded flag for Manchukuo_1940
@ -495,8 +492,8 @@ export class ChatProvider {
}
for (let i = 0; i < this.substitutes.length; i += 1) {
const subsitute = this.substitutes[i];
message = message.replace(subsitute.regexp, subsitute.replace);
const substitute = this.substitutes[i];
message = message.replace(substitute.regexp, substitute.replace);
}
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)
* @param canvasId numerical ID of 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)
* @param canvasId numerical ID of canvas
* @param x X coordinate on canvas

View File

@ -63,10 +63,10 @@ export class MailProvider {
const { t } = getTTag(lang);
logger.info(`Sending verification mail to ${to} / ${name}`);
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 />
${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 />
<img alt="" src="https://assets.pixelplanet.fun/tile.png" style="height:64px; width:64px" />`;
this.sendMail(to, subject, html);
@ -132,7 +132,7 @@ export class MailProvider {
/*
* 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) {
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
static cleanUsers() {
// delete users that requier verification for more than 4 days
// delete users that require verification for more than 4 days
RegUser.destroy({
where: {
verificationReqAt: {

View File

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

View File

@ -167,7 +167,7 @@ class RpgEvent {
// make sure that its the center of a 3x3 area
const i = 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);
const timestamp = await nextEvent();
const x = i * TILE_SIZE - canvasSize / 2;
@ -194,7 +194,7 @@ class RpgEvent {
async runEventLoop() {
/*
* 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()) {
this.iAmNotImportant = true;
@ -281,7 +281,7 @@ class RpgEvent {
}
setTimeout(this.runEventLoop, 1000);
} 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) {
this.eventState = 9;
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.
*
* */
@ -492,7 +492,7 @@ async function createEmptyTile(
/*
* created 4096x4096 texture of default canvas
* @param canvasId numberical Id of canvas
* @param canvasId numerical Id of canvas
* @param canvas canvas data
* @param canvasTileFolder root folder where to save texture
*

View File

@ -29,7 +29,7 @@ class Void {
// Uint8Array to log pixels in area
area;
userArea;
// current numberical data
// current numerical data
curRadius;
curAngle;
curAngleDelta;
@ -129,7 +129,7 @@ class Void {
while (true) {
this.curAngle += this.curAngleDelta;
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;
if (this.curRadius > TARGET_RADIUS) {
this.cancel();

View File

@ -48,7 +48,7 @@ import rollbackCanvasArea from './rollback';
/*
* Execute IP based actions (banning, whitelist, etc.)
* @param action what to do with the ip
* @param ip already sanizized ip
* @param ip already sanitized ip
* @return text of success
*/
export async function executeIPAction(action, ips, logger = null) {
@ -79,7 +79,7 @@ export async function executeIPAction(action, ips, logger = null) {
/*
* Execute IID based actions
* @param action what to do with the iid
* @param iid already sanizized iid
* @param iid already sanitized iid
* @return text of success
*/
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) => {
if (action === 'getIIDSummary') {
@ -466,7 +466,7 @@ export async function executeProtAction(
const width = u - x + 1;
const height = v - y + 1;
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 pxlCount = await protectCanvasArea(

View File

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

View File

@ -51,7 +51,7 @@ export const HOURLY_EVENT = parseInt(process.env.HOURLY_EVENT, 10) || false;
// Accounts
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)
? 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
// to established tiling convetions.
// to established tiling conventions.
// (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
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
* @param user user that can be registered, but doesn't have to
* @param canvasId
* @param i Chunk coordinates
* @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 is the offset of the pixel within the chunk
* @return Promise<Object>
@ -74,7 +74,7 @@ export default async function drawByOffsets(
if (curReqIPs.has(ip)) {
// already setting a pixel somewhere
logger.warn(
`Got simultanious requests from ${user.ip}`,
`Got simultaneous requests from ${user.ip}`,
);
throw new Error(13);
}
@ -95,12 +95,12 @@ export default async function drawByOffsets(
*/
if (i >= canvasSize / tileSize) {
// 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);
}
if (j >= canvasSize / tileSize) {
// 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);
}

View File

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

View File

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

View File

@ -173,7 +173,7 @@ export async function getIIDPixels(
/*
* Get summary of users placing in area of current day
* @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 iid Limit on one user (optional)
* @return array of parsed pixel log lines
@ -266,9 +266,9 @@ export async function getSummaryFromArea(
} else {
let { pcheck } = ipInfo;
if (pcheck) {
const seperator = pcheck.indexOf(',');
if (seperator !== -1) {
pcheck = pcheck.slice(0, seperator);
const separator = pcheck.indexOf(',');
if (separator !== -1) {
pcheck = pcheck.slice(0, separator);
}
}
row.push(

View File

@ -40,7 +40,7 @@ passport.use(new JsonStrategy({
usernameProp: 'nameoremail',
passwordProp: 'password',
}, 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
// NOTE: could allow @ in the future by making an OR query,
// 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 color Pixel color
* @param i Chunk coordinates
* @param j
* @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
* @param canvasRedis redis from where to get the data
* @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) {
const ids = Object.keys(canvases);
@ -25,7 +25,7 @@ export async function updateBackupRedis(canvasRedis, backupRedis, canvases) {
const id = ids[i];
const canvas = canvases[id];
if (canvas.v || canvas.hid) {
// ignore 3D and hiddedn canvases
// ignore 3D and hidden canvases
continue;
}
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 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,
backupRedis,
canvases,
@ -108,7 +108,7 @@ export async function incrementialBackupRedis(
const palette = new Palette(canvas.colors);
const chunksXY = (canvas.size / TILE_SIZE);
console.log('Creating Incremential Backup...');
console.log('Creating Incremental Backup...');
const startTime = Date.now();
let amount = 0;
for (let x = 0; x < chunksXY; x++) {
@ -198,7 +198,7 @@ export async function incrementialBackupRedis(
} catch (error) {
console.error(
// 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;
}
@ -223,15 +223,14 @@ export async function incrementialBackupRedis(
} catch (error) {
console.error(
// 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;
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
* @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
*/
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
*/
registerChunkChange(chunk) {

View File

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

View File

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

View File

@ -1,10 +1,10 @@
/*
* .vox file exporter for 3D canvas
* .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
* 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,
* 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
* 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
* is currently looking at as .vox. The file should just have one model.
*/
@ -101,12 +101,12 @@ async function exportVox(
// Main Chunk
// 4 bytes MAIN
// 4 bytes size (0)
// 4 bythes size children chnks
// 4 bytes size children chunks
const mainChildrenChunkSize = sizeChunkLength
+ xyziChunkLength + rgbaChunkLength;
const mainChunkLength = 4 + 4 + 4 + mainChildrenChunkSize;
// 4 bytes 'VOX '
// 4 bythes version number
// 4 bytes version number
const fileLength = 4 + 4 + mainChunkLength;
const voxFile = new ArrayBuffer(fileLength);
@ -164,7 +164,7 @@ async function exportVox(
return voxFile;
// can then be saved from the UI with react-file-downloader
// aka js-file-doanloader
// aka js-file-downloader
}
export default exportVox;

View File

@ -159,7 +159,7 @@ export async function needCaptcha(ip) {
* force ip to get captcha
* @param ip
* @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) {
if (CAPTCHA_TIME < 0) {

View File

@ -22,7 +22,7 @@ const PREFIX = 'cd';
* @param ip ip of request
* @param id userId
* @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 pxls Array with offsets of pixels
* @return see lua/placePixel.lua

View File

@ -1,9 +1,9 @@
-- 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
-- in RedisCanvas.js
-- Keys:
-- isAlloweed: 'isal:ip' (proxycheck, blacklist, whitelist)
-- Keys:
-- isAllowed: 'isal:ip' (proxycheck, blacklist, whitelist)
-- isHuman 'human:ip' captcha needed when expired,
-- 'nope' if no captcha should be checked
-- ipCD: 'cd:canvasId:ip:ip'
@ -17,16 +17,16 @@
-- prevTop: sorted set of yesterdays top 10
-- Args:
-- 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)
-- cds: max cooldown of canvas
-- userId: '0' if not logged in
-- cc country code
-- req: requirements of canvas
-- 'nope', unsigned integer or 'top'
-- off1, chonk offset of first pixel
-- off2, chonk offset of second pixel
-- ..., infinie pixels possible
-- off1, chunk offset of first pixel
-- off2, chunk offset of second pixel
-- ..., infinite pixels possible
-- Returns:
-- {
-- 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
*/
expires: {

View File

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

View File

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

View File

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

View File

@ -63,9 +63,9 @@ router.get('/reddit/return', passport.authenticate('reddit', {
// eslint-disable-next-line no-unused-vars
router.use((err, req, res, next) => {
const host = getHostFromRequest(req);
logger.info(`Authentification error: ${err.message}`);
logger.info(`Authentication error: ${err.message}`);
const index = getHtml(
'OAuth Authentification',
'OAuth Authentication',
err.message, host, req.lang,
);
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) {
const name = await MailProvider.verify(email, token);
if (name) {
// notify websoecket to reconnect user
// thats a bit counter productive because it directly links to the websocket
// notify websocket to reconnect user
// that's a bit counter productive because it directly links to the websocket
socketEvents.reloadUser(name);
// ---
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';

View File

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

View File

@ -60,7 +60,7 @@ router.use(session);
/*
* passport authenticate
* and deserlialize
* and deserialize
* (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
*/

View File

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

View File

@ -81,12 +81,12 @@ router.post('/', async (req, res) => {
}
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(
null,
null,
lang,
t`Passowrd successfully changed.`,
t`Password successfully changed.`,
);
res.status(200).send(html);
});

View File

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

View File

@ -222,7 +222,7 @@ class APISocketServer {
} else if (even === 'online') {
ws.subOnline = true;
} 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}`);
return;

View File

@ -141,7 +141,7 @@ class MessageBroker extends SocketEvents {
(buffer) => this.onShardBinaryMessage(buffer, message),
true,
);
// immediately give new shards informations
// immediately give new shards information
this.publisher.publish(BROADCAST_CHAN, this.thisShard);
return;
}
@ -285,7 +285,7 @@ class MessageBroker extends SocketEvents {
}
} catch (err) {
// 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
* 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
*/
req(type, ...args) {
@ -104,7 +104,7 @@ class SocketEvents extends EventEmitter {
/*
* 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 chunk [i,j] chunk coordinates
*/
@ -152,8 +152,8 @@ class SocketEvents extends EventEmitter {
* broadcast chat message to all users in channel
* @param name chatname
* @param message Message to send
* @param sendapi If chat message should get boradcasted to api websockets
* (usefull if the api is supposed to not answer to its own messages)
* @param sendapi If chat message should get broadcasted to api websockets
* (useful if the api is supposed to not answer to its own messages)
*/
broadcastChatMessage(
name,

View File

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

View File

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

View File

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

View File

@ -25,7 +25,7 @@ export const shardOrigin = shardHost
&& `${window.location.protocol}//${shardHost}`;
/*
* Adds customizeable timeout to fetch
* Adds customizable timeout to fetch
* defaults to 8s
*/
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
* @return error string or null if successful
*/
@ -210,7 +210,7 @@ export async function requestBlockDm(block) {
/*
* 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
*/
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) {

View File

@ -23,7 +23,7 @@ export function receiveChatMessage(
return (dispatch, getState) => {
channel = Number(channel);
const state = getState();
let isRead = false;
let isRead;
if (state.windows) {
isRead = state.windows.windows.some(
(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 {

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';

View File

@ -33,7 +33,7 @@ export type CanvasState = {
historicalDate: string,
historicalTime: string,
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,
// last canvas view, scale, selectedColor and viewscale
// 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
* @param canvases Object with all canvas informations
* @param canvases Object with all canvas information
* @return view, viewscale and scale for state
*/
function getViewFromURL(canvases) {
@ -331,7 +331,7 @@ export default function canvasReducer(
scale,
isHistoricalView,
historicalCanvasSize,
// rember view, scale and viewscale
// remember view, scale and viewscale
prevCanvasCoords: {
...state.prevCanvasCoords,
[prevCanvasId]: {

View File

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

View File

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

View File

@ -9,7 +9,7 @@ const initialState = {
mailreg: false,
// blocking all Dms
blockDm: false,
// privile is private
// profile is private
priv: false,
// if user is using touchscreen
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
*/
function correctPositions(state) {
@ -189,7 +189,7 @@ export default function windows(
switch (action.type) {
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)
*/
const {

View File

@ -4,4 +4,4 @@
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;

View File

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

View File

@ -5,7 +5,7 @@ import Chunk from './Chunk';
class Chunk2D extends Chunk {
// HTMLCanvasElement of chunk
image;
// boolean if chunk loeaded (request done)
// boolean if chunk loaded (request done)
ready;
// boolean if chunk is empty
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() {
let cnt = 0;
this.buffer = new Uint8Array(THREE_TILE_SIZE * THREE_TILE_SIZE * THREE_CANVAS_HEIGHT);
@ -156,13 +156,13 @@ class Chunk3D extends Chunk {
let faceCnt = 0;
for (let z = THREE_TILE_SIZE - 1; z >= 0; --z) {
for (let x = THREE_TILE_SIZE - 1; x >= 0; --x) {
let heighestPixel = 0;
let highestPixel = 0;
const startOffset = x + z * THREE_TILE_SIZE;
let u = startOffset;
for (let y = 0; y < THREE_CANVAS_HEIGHT; ++y) {
if (buffer[u] !== 0) {
// heighest pixel fo x,z in heightmap
heighestPixel = y;
// highest pixel fo x,z in heightmap
highestPixel = y;
// number of faces to render
if (x === 0
|| buffer[u - 1] === 0) {
@ -191,11 +191,11 @@ class Chunk3D extends Chunk {
}
u += rowVolume;
}
heightMap[startOffset] = heighestPixel;
if (heighestPixel > totalHeight) {
heightMap[startOffset] = highestPixel;
if (highestPixel > totalHeight) {
// last total pixel
totalHeight = heighestPixel;
lastPixel = Chunk3D.getOffsetOfVoxel(x, heighestPixel, z);
totalHeight = highestPixel;
lastPixel = Chunk3D.getOffsetOfVoxel(x, highestPixel, z);
}
}
}
@ -281,7 +281,7 @@ class Chunk3D extends Chunk {
const colors = new Uint8Array(faceCnt * 4 * 3);
const indices = new Uint32Array(faceCnt * 6);
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 x = 0; x < THREE_TILE_SIZE; ++x) {
const startOffset = x + z * THREE_TILE_SIZE;

View File

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

View File

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

View File

@ -66,8 +66,8 @@ class PixelNotify {
while (index > 0) {
index--;
const [setTime, x, y] = this.pixelList[index];
const timePasseded = curTime - setTime;
if (timePasseded > PixelNotify.NOTIFICATION_TIME) {
const timePassed = curTime - setTime;
if (timePassed > PixelNotify.NOTIFICATION_TIME) {
this.pixelList.pop();
continue;
}
@ -75,7 +75,7 @@ class PixelNotify {
.map((z) => z + this.scale / 2);
// 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;
viewportCtx.save();
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
*/
import { t } from 'ttag';
@ -132,7 +132,7 @@ class PixelTransferController {
store.dispatch(notify(t`Pixel protected!`));
break;
case 9:
// pixestack used up
// pixelstack used up
break;
case 10:
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
// avoiding unneccessary stuff is important
// avoiding unnecessary stuff is important
renderMain(
state,
) {
@ -631,7 +631,7 @@ class Renderer2D extends Renderer {
} else {
context.fillRect(x, y, TILE_SIZE, TILE_SIZE);
}
// incremential chunks
// incremental chunks
if (historicalTime === '0000') continue;
chunk = this.chunkLoader
.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
// avoiding unneccessary stuff is important
// avoiding unnecessary stuff is important
renderHistorical(
state,
) {

View File

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

View File

@ -79,7 +79,7 @@ Sky.SkyShader = {
// wavelength of used primaries, according to preetham
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))
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 ) );
// extinction (absorbtion + out scattering)
// extinction (absorption + out scattering)
// rayleigh coefficients
vBetaR = totalRayleigh * rayleighCoefficient;

View File

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

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) {
const count = this.map.get(item) || 0;
return count;
return this.map.get(item) || 0;
}
add(item) {

View File

@ -11,13 +11,13 @@ import { HourlyCron } from './cron';
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,
* which is good for fallback, if something goes wrong
*/
class PcKeyProvider {
/*
* @param pcKeys comma seperated list of keys
* @param pcKeys comma separated list of keys
*/
constructor(pcKeys, logger) {
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
*/
async getKeysUsage(keys) {
@ -346,7 +346,7 @@ class ProxyCheck {
try {
res = await this.reqProxyCheck(values);
} catch (err) {
this.logger.error(`Eroor: ${err.message}`);
this.logger.error(`Error: ${err.message}`);
}
for (let i = 0; i < tasks.length; i += 1) {
const task = tasks[i];

View File

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

View File

@ -60,13 +60,11 @@ function initializeDailyCron() {
const lastRun = now.getTime()
- now.getUTCHours() * HOUR
- (now.getUTCMinutes() * 60 + now.getUTCSeconds()) * 1000;
const cron = new Cron(24, lastRun);
return cron;
return new Cron(24, lastRun);
}
function initializeHourlyCron() {
const cron = new Cron(1);
return cron;
return new Cron(1);
}
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';
@ -23,11 +23,10 @@ function ip4ToNum(ipString) {
)) {
return null;
}
const ipNum = (ipArr[0] << 24)
return (ipArr[0] << 24)
+ (ipArr[1] << 16)
+ (ipArr[2] << 8)
+ ipArr[3];
return ipNum;
}
/*
@ -106,7 +105,7 @@ export function isIPv6(ip) {
/*
* 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
* @param ip ip as string (v4 or v6)
* @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) {
if (isIPv6(ip)) {
// eslint-disable-next-line max-len
const ipv6sub = `${ip.split(':').slice(0, 4).join(':')}:0000:0000:0000:0000`;
return ipv6sub;
return `${ip.split(':')
.slice(0, 4)
.join(':')}:0000:0000:0000:0000`;
}
return ip;
}
/*
* 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)
*/
function ip4RangeStrToRangeNum(range) {
@ -161,7 +161,7 @@ function ip4RangeNumToCIDR([start, end]) {
/*
* 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
*/
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)
* @return language code
*/
@ -45,6 +45,7 @@ const lang2CC = {
sr: 'rs',
be: 'by',
kk: 'kz',
da: 'dk',
};
export function langCodeToCC(lang) {
return lang2CC[lang] || lang;

View File

@ -94,7 +94,7 @@ export function validateCoorRange(ulcoor, brcoor, canvasSize) {
} else if (Number.isNaN(v)) {
error = 'y of bottom-right corner is not a valid number';
} else if (u < x || v < y) {
error = 'Corner coordinates are alligned wrong';
error = 'Corner coordinates are aligned wrong';
}
if (error !== null) {
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
*/
const referralKeys = [
@ -219,8 +219,8 @@ export default async function whoisIp(
queryPrefix = '+ n';
} else if (useHost === 'whois.ripe.net') {
/*
* flag to not return personal informations, otherwise
* RIPE is gonne rate limit and ban
* flag to not return personal information, otherwise
* RIPE is gonna rate limit and ban
*/
queryPrefix = '-r';
}