remane some files, continue with popups

This commit is contained in:
HF 2022-09-04 01:17:59 +02:00
parent bed2ae48e2
commit 8b361a2965
22 changed files with 621 additions and 445 deletions

View File

@ -111,6 +111,11 @@ msgstr ""
msgid "Loading..."
msgstr ""
#: src/ssr/Win.jsx:55
#: src/ssr/Win.jsx:56
msgid "PixelPlanet.Fun PopUp"
msgstr ""
#: src/ssr/Main.jsx:54
msgid "PixelPlanet.Fun"
msgstr ""
@ -119,14 +124,6 @@ msgstr ""
msgid "Place color pixels on an map styled canvas with other players online"
msgstr ""
#: src/ssr/Win.jsx:31
msgid "PixelPlanet.Fun Window"
msgstr ""
#: src/ssr/Win.jsx:32
msgid "PixelPlanet.Fun Windows"
msgstr ""
#: src/core/mail.js:71
#, javascript-format
msgid ""
@ -350,26 +347,6 @@ msgid ""
"request a new one."
msgstr ""
#: src/routes/api/auth/register.js:26
msgid "No Captcha given"
msgstr ""
#: src/routes/api/auth/register.js:29
msgid "E-Mail already in use."
msgstr ""
#: src/routes/api/auth/register.js:31
msgid "Username already in use."
msgstr ""
#: src/routes/api/auth/register.js:84
msgid "Failed to create new user :("
msgstr ""
#: src/routes/api/auth/register.js:100
msgid "Failed to establish session after register :("
msgstr ""
#: src/routes/api/auth/logout.js:11
msgid "You are not even logged in."
msgstr ""
@ -391,6 +368,26 @@ msgstr ""
msgid "Incorrect password!"
msgstr ""
#: src/routes/api/auth/register.js:26
msgid "No Captcha given"
msgstr ""
#: src/routes/api/auth/register.js:29
msgid "E-Mail already in use."
msgstr ""
#: src/routes/api/auth/register.js:31
msgid "Username already in use."
msgstr ""
#: src/routes/api/auth/register.js:84
msgid "Failed to create new user :("
msgstr ""
#: src/routes/api/auth/register.js:100
msgid "Failed to establish session after register :("
msgstr ""
#: src/ssr/RedirectionPage.jsx:19
msgid "PixelPlanet.fun Accounts"
msgstr ""

View File

@ -203,22 +203,6 @@ msgstr ""
msgid "Server answered with gibberish :("
msgstr ""
#: src/store/actions/windows.js:98
msgid "Register New Account"
msgstr ""
#: src/store/actions/windows.js:105
msgid "Restore my Password"
msgstr ""
#: src/store/actions/windows.js:112
msgid "Welcome to PixelPlanet.fun"
msgstr ""
#: src/store/actions/windows.js:118
msgid "Look at past Canvases"
msgstr ""
#: src/store/middleware/notifications.js:33
msgid "Your next pixels are ready"
msgstr ""
@ -237,7 +221,7 @@ msgstr ""
#: src/components/Converter.jsx:561
#: src/components/CoordinatesBox.jsx:31
#: src/components/ModWatchtools.jsx:364
#: src/components/ModWatchtools.jsx:360
msgid "Copy to Clipboard"
msgstr ""
@ -253,11 +237,6 @@ msgstr ""
msgid "Pixels placed"
msgstr ""
#: src/components/buttons/CanvasSwitchButton.jsx:22
#: src/components/windows/index.js:19
msgid "Canvas Selection"
msgstr ""
#: src/components/buttons/ChatButton.jsx:88
msgid "Close Chat"
msgstr ""
@ -274,33 +253,25 @@ msgstr ""
msgid "Open Menu"
msgstr ""
#: src/components/Admintools.jsx:101
#: src/components/ModCanvastools.jsx:232
#: src/components/ModWatchtools.jsx:113
#: src/components/Window.jsx:141
#: src/components/Window.jsx:210
#: src/components/contextmenus/ChannelContextMenu.jsx:68
msgid "Close"
#: src/components/buttons/CanvasSwitchButton.jsx:22
#: src/components/windows/index.js:19
msgid "Canvas Selection"
msgstr ""
#: src/components/Window.jsx:151
msgid "Restore"
#: src/store/actions/windows.js:98
msgid "Register New Account"
msgstr ""
#: src/components/Window.jsx:186
msgid "Clone"
#: src/store/actions/windows.js:105
msgid "Restore my Password"
msgstr ""
#: src/components/Window.jsx:194
msgid "Move"
#: src/store/actions/windows.js:112
msgid "Welcome to PixelPlanet.fun"
msgstr ""
#: src/components/Window.jsx:202
msgid "Maximize"
msgstr ""
#: src/components/Window.jsx:218
msgid "Resize"
#: src/store/actions/windows.js:118
msgid "Look at past Canvases"
msgstr ""
#: src/components/HistorySelect.jsx:144
@ -311,6 +282,39 @@ msgstr ""
msgid "Select Date above"
msgstr ""
#: src/components/Admintools.jsx:101
#: src/components/ModCanvastools.jsx:221
#: src/components/ModWatchtools.jsx:110
#: src/components/Window.jsx:153
#: src/components/Window.jsx:254
#: src/components/contextmenus/ChannelContextMenu.jsx:59
msgid "Close"
msgstr ""
#: src/components/Window.jsx:169
msgid "PopUp"
msgstr ""
#: src/components/Window.jsx:180
msgid "Restore"
msgstr ""
#: src/components/Window.jsx:215
msgid "Clone"
msgstr ""
#: src/components/Window.jsx:223
msgid "Move"
msgstr ""
#: src/components/Window.jsx:246
msgid "Maximize"
msgstr ""
#: src/components/Window.jsx:262
msgid "Resize"
msgstr ""
#: src/components/BanInfo.jsx:76
#: src/components/buttons/HelpButton.jsx:22
#: src/components/windows/index.js:13
@ -343,8 +347,32 @@ msgstr ""
msgid "Open Palette"
msgstr ""
#: src/components/windows/index.js:16
msgid "Registration"
msgstr ""
#: src/components/windows/index.js:17
msgid "Forgot Password"
msgstr ""
#: src/components/windows/index.js:18
msgid "Chat"
msgstr ""
#: src/components/windows/index.js:20
msgid "Canvas Archive"
msgstr ""
#: src/components/BanInfo.jsx:67
msgid "You are banned. You think it is unjustifed? Check out the "
msgstr ""
#: src/components/BanInfo.jsx:77
msgid " on how to appeal."
msgstr ""
#: src/components/BanInfo.jsx:81
#: src/components/Captcha.jsx:77
#: src/components/Captcha.jsx:76
#: src/components/ChangeMail.jsx:72
#: src/components/ChangeName.jsx:58
#: src/components/ChangePassword.jsx:79
@ -356,28 +384,6 @@ msgstr ""
msgid "Error"
msgstr ""
#: src/components/ChangeMail.jsx:93
#: src/components/ChangeName.jsx:70
#: src/components/ChangePassword.jsx:115
#: src/components/DeleteAccount.jsx:68
#: src/components/GlobalCaptcha.jsx:47
#: src/components/windows/ForgotPassword.jsx:88
#: src/components/windows/Register.jsx:131
msgid "Cancel"
msgstr ""
#: src/components/GlobalCaptcha.jsx:53
msgid "Send"
msgstr ""
#: src/components/BanInfo.jsx:67
msgid "You are banned. You think it is unjustifed? Check out the "
msgstr ""
#: src/components/BanInfo.jsx:77
msgid " on how to appeal."
msgstr ""
#: src/components/BanInfo.jsx:86
#: src/components/ModIIDtools.jsx:72
msgid "Reason"
@ -412,69 +418,18 @@ msgstr ""
msgid "Why?"
msgstr ""
#: src/components/windows/index.js:16
msgid "Registration"
#: src/components/ChangeMail.jsx:93
#: src/components/ChangeName.jsx:70
#: src/components/ChangePassword.jsx:115
#: src/components/DeleteAccount.jsx:68
#: src/components/GlobalCaptcha.jsx:47
#: src/components/windows/ForgotPassword.jsx:88
#: src/components/windows/Register.jsx:131
msgid "Cancel"
msgstr ""
#: src/components/windows/index.js:17
msgid "Forgot Password"
msgstr ""
#: src/components/windows/index.js:18
msgid "Chat"
msgstr ""
#: src/components/windows/index.js:20
msgid "Canvas Archive"
msgstr ""
#: src/components/contextmenus/UserContextMenu.jsx:60
msgid "Ping"
msgstr ""
#: src/components/contextmenus/UserContextMenu.jsx:87
msgid "DM"
msgstr ""
#: src/components/contextmenus/UserContextMenu.jsx:97
msgid "Block"
msgstr ""
#: src/components/contextmenus/ChannelContextMenu.jsx:56
msgid "Mute"
msgstr ""
#: src/components/Captcha.jsx:50
#: src/components/Captcha.jsx:105
msgid "Could not load captcha"
msgstr ""
#: src/components/Captcha.jsx:68
msgid "Type the characters from the following image:"
msgstr ""
#: src/components/Captcha.jsx:71
msgid "Tip: Not case-sensitive; I and l are the same"
msgstr ""
#: src/components/Captcha.jsx:114
msgid "Load Captcha"
msgstr ""
#: src/components/Captcha.jsx:119
msgid "Click to Load Captcha"
msgstr ""
#: src/components/Captcha.jsx:124
msgid "Can't read? Reload:"
msgstr ""
#: src/components/Captcha.jsx:128
msgid "Reload"
msgstr ""
#: src/components/Captcha.jsx:138
msgid "Enter Characters"
#: src/components/GlobalCaptcha.jsx:53
msgid "Send"
msgstr ""
#: src/components/windows/Help.jsx:42
@ -777,27 +732,16 @@ msgstr ""
#: src/components/Admintools.jsx:152
#: src/components/Admintools.jsx:236
#: src/components/ModCanvastools.jsx:314
#: src/components/ModCanvastools.jsx:396
#: src/components/ModCanvastools.jsx:471
#: src/components/ModCanvastools.jsx:564
#: src/components/ModCanvastools.jsx:301
#: src/components/ModCanvastools.jsx:381
#: src/components/ModCanvastools.jsx:454
#: src/components/ModCanvastools.jsx:545
#: src/components/ModIIDtools.jsx:134
#: src/components/windows/ForgotPassword.jsx:86
#: src/components/windows/Register.jsx:125
msgid "Submit"
msgstr ""
#: src/components/windows/CanvasSelect.jsx:27
msgid ""
"Select the canvas you want to use. Every canvas is unique and has "
"different palettes, cooldown and requirements. Archive of closed canvases "
"can be accessed here:"
msgstr ""
#: src/components/windows/CanvasSelect.jsx:35
msgid "Archive"
msgstr ""
#: src/components/windows/UserArea.jsx:31
#: src/components/windows/UserArea.jsx:50
msgid "Profile"
@ -823,6 +767,17 @@ msgstr ""
msgid "Consider joining us on Guilded:"
msgstr ""
#: src/components/windows/CanvasSelect.jsx:27
msgid ""
"Select the canvas you want to use. Every canvas is unique and has "
"different palettes, cooldown and requirements. Archive of closed canvases "
"can be accessed here:"
msgstr ""
#: src/components/windows/CanvasSelect.jsx:35
msgid "Archive"
msgstr ""
#: src/components/windows/Archive.jsx:16
msgid ""
"While we tend to not delete canvases, some canvases are started for fun or "
@ -856,19 +811,19 @@ msgid ""
"how the canvas was at that time."
msgstr ""
#: src/components/windows/Chat.jsx:143
#: src/components/windows/Chat.jsx:176
msgid "Start chatting here"
msgstr ""
#: src/components/windows/Chat.jsx:183
#: src/components/windows/Chat.jsx:213
msgid "Chat here"
msgstr ""
#: src/components/windows/Chat.jsx:205
#: src/components/windows/Chat.jsx:239
msgid "You must be logged in to chat"
msgstr ""
#: src/components/windows/Chat.jsx:233
#: src/components/windows/Chat.jsx:268
msgid "Channel settings"
msgstr ""
@ -880,6 +835,39 @@ msgstr ""
msgid "Enter your mail address and we will send you a new password:"
msgstr ""
#: src/components/Captcha.jsx:50
#: src/components/Captcha.jsx:104
msgid "Could not load captcha"
msgstr ""
#: src/components/Captcha.jsx:68
msgid "Type the characters from the following image:"
msgstr ""
#: src/components/Captcha.jsx:71
msgid "Tip: Not case-sensitive; I and l are the same"
msgstr ""
#: src/components/Captcha.jsx:113
msgid "Load Captcha"
msgstr ""
#: src/components/Captcha.jsx:118
msgid "Click to Load Captcha"
msgstr ""
#: src/components/Captcha.jsx:123
msgid "Can't read? Reload:"
msgstr ""
#: src/components/Captcha.jsx:127
msgid "Reload"
msgstr ""
#: src/components/Captcha.jsx:137
msgid "Enter Characters"
msgstr ""
#: src/utils/validation.js:17
msgid "Email can't be empty."
msgstr ""
@ -943,51 +931,6 @@ msgstr ""
msgid "Save"
msgstr ""
#: src/components/CanvasItem.jsx:29
msgid "Online Users"
msgstr ""
#: src/components/CanvasItem.jsx:34
msgid "Cooldown"
msgstr ""
#: src/components/CanvasItem.jsx:40
msgid "Stacking till"
msgstr ""
#: src/components/CanvasItem.jsx:42
msgid "Ranked"
msgstr ""
#: src/components/CanvasItem.jsx:44
msgid "Yes"
msgstr ""
#: src/components/CanvasItem.jsx:44
msgid "No"
msgstr ""
#: src/components/CanvasItem.jsx:50
msgid "Requirements"
msgstr ""
#: src/components/CanvasItem.jsx:53
msgid "User Account"
msgstr ""
#: src/components/CanvasItem.jsx:55
#, javascript-format
msgid "and ${ canvas.req } Pixels set"
msgstr ""
#: src/components/CanvasItem.jsx:58
msgid "Top 10 Daily Ranking"
msgstr ""
#: src/components/CanvasItem.jsx:64
msgid "Dimensions"
msgstr ""
#: src/components/LogInArea.jsx:20
msgid "Login to access more features and stats."
msgstr ""
@ -1070,7 +1013,7 @@ msgid "Ranking updates every 5 min. Daily rankings get reset at midnight UTC."
msgstr ""
#: src/components/Converter.jsx:190
#: src/components/ModCanvastools.jsx:236
#: src/components/ModCanvastools.jsx:225
msgid "Choose Canvas"
msgstr ""
@ -1148,6 +1091,51 @@ msgstr ""
msgid "Download Template"
msgstr ""
#: src/components/CanvasItem.jsx:29
msgid "Online Users"
msgstr ""
#: src/components/CanvasItem.jsx:34
msgid "Cooldown"
msgstr ""
#: src/components/CanvasItem.jsx:40
msgid "Stacking till"
msgstr ""
#: src/components/CanvasItem.jsx:42
msgid "Ranked"
msgstr ""
#: src/components/CanvasItem.jsx:44
msgid "Yes"
msgstr ""
#: src/components/CanvasItem.jsx:44
msgid "No"
msgstr ""
#: src/components/CanvasItem.jsx:50
msgid "Requirements"
msgstr ""
#: src/components/CanvasItem.jsx:53
msgid "User Account"
msgstr ""
#: src/components/CanvasItem.jsx:55
#, javascript-format
msgid "and ${ canvas.req } Pixels set"
msgstr ""
#: src/components/CanvasItem.jsx:58
msgid "Top 10 Daily Ranking"
msgstr ""
#: src/components/CanvasItem.jsx:64
msgid "Dimensions"
msgstr ""
#: src/components/LogInForm.jsx:77
msgid "Name or Email"
msgstr ""
@ -1156,20 +1144,6 @@ msgstr ""
msgid "LogIn"
msgstr ""
#: src/components/UserMessages.jsx:28
msgid ""
"Please verify your mail address or your account could get deleted after a "
"few days."
msgstr ""
#: src/components/UserMessages.jsx:49
msgid "A new verification mail is getting sent to you."
msgstr ""
#: src/components/UserMessages.jsx:53
msgid "Click here to request a new verification mail."
msgstr ""
#: src/components/ChangePassword.jsx:21
msgid "Passwords do not match."
msgstr ""
@ -1204,6 +1178,20 @@ msgstr ""
msgid "New Mail"
msgstr ""
#: src/components/UserMessages.jsx:28
msgid ""
"Please verify your mail address or your account could get deleted after a "
"few days."
msgstr ""
#: src/components/UserMessages.jsx:49
msgid "A new verification mail is getting sent to you."
msgstr ""
#: src/components/UserMessages.jsx:53
msgid "Click here to request a new verification mail."
msgstr ""
#: src/components/DeleteAccount.jsx:66
msgid "Yes, Delete My Account!"
msgstr ""
@ -1220,127 +1208,99 @@ msgstr ""
msgid "You have no users blocked"
msgstr ""
#: src/components/ModCanvastools.jsx:174
#: src/components/ModCanvastools.jsx:167
msgid "Build image on canvas."
msgstr ""
#: src/components/ModCanvastools.jsx:177
#: src/components/ModCanvastools.jsx:170
msgid "Build image and set it to protected."
msgstr ""
#: src/components/ModCanvastools.jsx:180
#: src/components/ModCanvastools.jsx:173
msgid "Build image, but reset cooldown to unset-pixel cd."
msgstr ""
#: src/components/ModCanvastools.jsx:190
#: src/components/ModCanvastools.jsx:183
msgid "Clean spare pixels that are surrounded by unset pixels"
msgstr ""
#: src/components/ModCanvastools.jsx:194
#: src/components/ModCanvastools.jsx:187
msgid ""
"Clean spare pixels that are surrounded by unset pixels and up to 1 other "
"set pixels"
msgstr ""
#: src/components/ModCanvastools.jsx:198
#: src/components/ModCanvastools.jsx:191
msgid ""
"Clean spare pixels that are surrounded by a single other color or unset "
"pixels (VERY AGGRESSIVE ON CANVASES THAT ALLOW UNSET PIXELS (where there "
"are two cooldowns)!)"
msgstr ""
#: src/components/ModCanvastools.jsx:213
#: src/components/ModCanvastools.jsx:202
msgid "Status: Not running"
msgstr ""
#: src/components/ModCanvastools.jsx:255
#: src/components/ModCanvastools.jsx:244
msgid "Image Upload"
msgstr ""
#: src/components/ModCanvastools.jsx:256
#: src/components/ModCanvastools.jsx:245
msgid "Upload images to canvas"
msgstr ""
#: src/components/ModCanvastools.jsx:258
#: src/components/ModCanvastools.jsx:247
msgid "File"
msgstr ""
#: src/components/ModCanvastools.jsx:279
#: src/components/ModCanvastools.jsx:268
msgid "Coordinates in X_Y format:"
msgstr ""
#: src/components/ModCanvastools.jsx:319
#: src/components/ModCanvastools.jsx:306
msgid "Pixel Protection"
msgstr ""
#: src/components/ModCanvastools.jsx:321
#: src/components/ModCanvastools.jsx:308
msgid ""
"Set protection of areas (if you need finer grained control, "
"use protect with image upload and alpha layers)"
msgstr ""
#: src/components/ModCanvastools.jsx:342
#: src/components/ModCanvastools.jsx:417
#: src/components/ModCanvastools.jsx:502
#: src/components/ModWatchtools.jsx:169
#: src/components/ModCanvastools.jsx:329
#: src/components/ModCanvastools.jsx:402
#: src/components/ModCanvastools.jsx:485
#: src/components/ModWatchtools.jsx:166
msgid "Top-left corner"
msgstr ""
#: src/components/ModCanvastools.jsx:360
#: src/components/ModCanvastools.jsx:435
#: src/components/ModCanvastools.jsx:520
#: src/components/ModWatchtools.jsx:187
#: src/components/ModCanvastools.jsx:346
#: src/components/ModCanvastools.jsx:419
#: src/components/ModCanvastools.jsx:502
#: src/components/ModWatchtools.jsx:183
msgid "Bottom-right corner"
msgstr ""
#: src/components/ModCanvastools.jsx:402
#: src/components/ModCanvastools.jsx:387
msgid "Rollback to Date"
msgstr ""
#: src/components/ModCanvastools.jsx:404
#: src/components/ModCanvastools.jsx:389
msgid "Rollback an area of the canvas to a set date (00:00 UTC)"
msgstr ""
#: src/components/ModCanvastools.jsx:477
#: src/components/ModCanvastools.jsx:460
msgid "Canvas Cleaner"
msgstr ""
#: src/components/ModCanvastools.jsx:479
#: src/components/ModCanvastools.jsx:462
msgid "Apply a filter to clean trash in large canvas areas."
msgstr ""
#: src/components/ModCanvastools.jsx:582
#: src/components/ModCanvastools.jsx:563
msgid "Stop Cleaner"
msgstr ""
#: src/components/ModWatchtools.jsx:45
msgid "Interval is invalid"
msgstr ""
#: src/components/ModWatchtools.jsx:117
msgid "Check who placed in an area"
msgstr ""
#: src/components/ModWatchtools.jsx:118
msgid "Canvas"
msgstr ""
#: src/components/ModWatchtools.jsx:135
msgid "Interval"
msgstr ""
#: src/components/ModWatchtools.jsx:151
msgid "IID (optional)"
msgstr ""
#: src/components/ModWatchtools.jsx:233
msgid "Get Pixels"
msgstr ""
#: src/components/ModWatchtools.jsx:264
msgid "Get Users"
msgstr ""
#: src/components/Admintools.jsx:107
msgid "IP Actions"
msgstr ""
@ -1373,6 +1333,34 @@ msgstr ""
msgid "User Name"
msgstr ""
#: src/components/ModWatchtools.jsx:45
msgid "Interval is invalid"
msgstr ""
#: src/components/ModWatchtools.jsx:114
msgid "Check who placed in an area"
msgstr ""
#: src/components/ModWatchtools.jsx:115
msgid "Canvas"
msgstr ""
#: src/components/ModWatchtools.jsx:134
msgid "Interval"
msgstr ""
#: src/components/ModWatchtools.jsx:149
msgid "IID (optional)"
msgstr ""
#: src/components/ModWatchtools.jsx:228
msgid "Get Pixels"
msgstr ""
#: src/components/ModWatchtools.jsx:259
msgid "Get Users"
msgstr ""
#: src/components/ModIIDtools.jsx:19
msgid "You must enter a duration"
msgstr ""
@ -1393,6 +1381,22 @@ msgstr ""
msgid "(0 = infinite)"
msgstr ""
#: src/components/contextmenus/ChannelContextMenu.jsx:46
msgid "Mute"
msgstr ""
#: src/components/contextmenus/UserContextMenu.jsx:49
msgid "Ping"
msgstr ""
#: src/components/contextmenus/UserContextMenu.jsx:75
msgid "DM"
msgstr ""
#: src/components/contextmenus/UserContextMenu.jsx:86
msgid "Block"
msgstr ""
#: src/components/windows/Help.jsx:15
#: src/components/windows/Settings.jsx:87
msgctxt "keybinds"

View File

@ -8,26 +8,26 @@ import { createRoot } from 'react-dom/client';
import { IconContext } from 'react-icons';
import Style from './Style';
import UIWin from './UIWin';
import UIPopUp from './UIPopUp';
const iconContextValue = { style: { verticalAlign: 'middle' } };
const AppWin = () => (
const AppPopUp = () => (
<>
<Style />
<IconContext.Provider value={iconContextValue}>
<UIWin />
<UIPopUp />
</IconContext.Provider>
</>
);
function renderAppWin(domParent, store) {
function renderAppPopUp(domParent, store) {
const root = createRoot(domParent);
root.render(
<Provider store={store}>
<AppWin />
<AppPopUp />
</Provider>,
);
}
export default renderAppWin;
export default renderAppPopUp;

View File

@ -0,0 +1,43 @@
/*
* UI for single-window popUp
*/
import React, { useCallback } from 'react';
import { useSelector, useDispatch } from 'react-redux';
import { selectWindowType, selectWIndowArgs } from '../store/selectors/popup';
import { setWindowArgs, setWindowTitle } from '../store/actions/popup';
import COMPONENTS from './windows';
const UIPopUp = () => {
const windowType = useSelector(selectWindowType);
const args = useSelector(selectWIndowArgs);
const [Content] = COMPONENTS[windowType];
const dispatch = useDispatch();
const setArgs = useCallback(
(newArgs) => dispatch(setWindowArgs(newArgs),
), [dispatch]);
const setTitle = useCallback(
(title) => dispatch(setWindowTitle(title),
), [dispatch]);
return (
<div
className="window show"
style={{
width: '100%',
height: '100%',
overflow: 'auto',
}}
>
{(windowType)
? <Content args={args} setArgs={setArgs} setTitle={setTitle} />
: <h1>Loading</h1>}
</div>
);
};
export default React.memo(UIPopUp);

View File

@ -1,32 +0,0 @@
/*
*
*/
import React from 'react';
import { useSelector } from 'react-redux';
import { selectWindowType } from '../store/selectors/win';
import COMPONENTS from './windows';
const UIWin = () => {
const windowType = useSelector(selectWindowType);
const [Content, name] = COMPONENTS[windowType];
return (
<div
className="window show"
style={{
width: '100%',
height: '100%',
overflow: 'auto',
}}
>
{(windowType)
? <Content />
: <h1>Loading</h1>}
</div>
);
};
export default React.memo(UIWin);

View File

@ -28,6 +28,7 @@ import {
} from '../store/selectors/windows';
import useDrag from './hooks/drag';
import COMPONENTS from './windows';
import popUpTypes, { buildPopUpUrl } from './windows/popUpAvailable';
const Window = ({ id }) => {
const [render, setRender] = useState(false);
@ -81,11 +82,6 @@ const Window = ({ id }) => {
width, height,
} = position;
const popUp = useCallback((evt) => {
openPopUp(xPos, yPos, width, height);
close(evt);
}, [xPos, yPos, width, height]);
useDrag(
titleBarRef,
focus,
@ -157,15 +153,23 @@ const Window = ({ id }) => {
title={t`Close`}
tabIndex={-1}
></div>
<div
onClick={popUp}
className="modal-topbtn pop"
role="button"
label="close"
key="popbtn"
title={t`PopUp`}
tabIndex={-1}
>G</div>
{(popUpTypes[windowType]) && (
<div
onClick={(evt) => {
openPopUp(
buildPopUpUrl(windowType, args),
xPos, yPos, width, height,
);
close(evt);
}}
className="modal-topbtn pop"
role="button"
label="close"
key="popbtn"
title={t`PopUp`}
tabIndex={-1}
>G</div>
)}
{(showWindows) && (
<div
onClick={toggleMaximize}
@ -220,13 +224,21 @@ const Window = ({ id }) => {
>
{windowTitle}
</span>
<span
className="win-topbtn"
key="pobtn"
onClick={popUp}
>
G
</span>
{(popUpTypes[windowType]) && (
<span
className="win-topbtn"
key="pobtnm"
onClick={(evt) => {
openPopUp(
buildPopUpUrl(windowType, args),
xPos, yPos, width, height,
);
close(evt);
}}
>
G
</span>
)}
<span
className="win-topbtn"
key="maxbtn"

View File

@ -20,3 +20,9 @@ export default {
ARCHIVE: [Archive, t`Canvas Archive`],
/* other windows */
};
/*
* NOTE:
* set windows that should be accessable via popup / url
* also in ./popUpAvailable.js
*/

View File

@ -0,0 +1,40 @@
/*
* windows that can be opened as pop-up
*/
export const argsTypes = {
USERAREA: ['activeTab'],
CHAT: ['chatChannel'],
};
export function buildPopUpUrl(windowType, args) {
let path = `/${windowType.toLowerCase()}`;
const typeArr = argsTypes[windowType];
for (let i = 0; i < typeArr.length; i += 1) {
const key = typeArr[i];
if (args[key]) {
path += `/${args[key]}`;
delete args[key];
}
}
let searchParams = new URLSearchParams();
const keys = Object.keys(args);
for (let i = 0; i < keys.length; i += 1) {
const key = keys[i];
searchParams.append(key, args[key]);
}
searchParams = searchParams.toString();
if (searchParams) {
path += `?${searchParams}`;
}
return path;
}
export default [
'HELP',
'SETTINGS',
'USERAREA',
'CHAT',
'CANVAS_SELECTION',
'ARCHIVE',
];

View File

@ -52,7 +52,7 @@ class PopUps {
const popUps = new PopUps();
export function openPopUp(xPos, yPos, width, height) {
export function openPopUp(url, xPos, yPos, width, height) {
let left;
let top;
try {
@ -74,8 +74,9 @@ export function openPopUp(xPos, yPos, width, height) {
}
try {
return window.open(
'./win',
'lol',
url,
url,
// eslint-disable-next-line max-len
`popup=yes,width=${width},height=${height},left=${left},top=${top},toolbar=no,status=no,directories=no,menubar=no`,
);
} catch {

23
src/popup.js Normal file
View File

@ -0,0 +1,23 @@
/*
* Main Script for windows (pop-ups and stuff)
*/
import store from './store/storePopUp';
import {
urlChange,
} from './store/actions';
import renderAppPopUp from './components/AppPopUp';
function init() {
window.addEventListener('popstate', () => {
store.dispatch(urlChange());
});
}
init();
document.addEventListener('DOMContentLoaded', () => {
// eslint-disable-next-line no-console
console.log('hello');
renderAppPopUp(document.getElementById('app'), store);
});

View File

@ -19,9 +19,10 @@ import api from './api';
import { assets } from '../core/assets';
import { expressTTag } from '../core/ttag';
import generateGlobePage from '../ssr/Globe';
import generateWinPage from '../ssr/Win';
import generatePopUpPage from '../ssr/PopUp';
import generateMainPage from '../ssr/Main';
import AVAILABLE_POPUPS from '../components/windows/popUpAvailable';
import { MONTH } from '../core/constants';
import { GUILDED_INVITE } from '../core/config';
@ -122,26 +123,30 @@ router.get('/globe', (req, res) => {
});
//
// Windows (like chat pop-up etc.)
// PopUps
// -----------------------------------------------------------------------------
const winEtag = etag(
assets.win.js,
assets.popup.js,
{ weak: true },
);
router.get('/win', async (req, res) => {
res.set({
'Cache-Control': `private, max-age=${15 * 60}`, // seconds
'Content-Type': 'text/html; charset=utf-8',
ETag: globeEtag,
});
if (req.headers['if-none-match'] === winEtag) {
res.status(304).end();
return;
}
router.get(
`/:t(${AVAILABLE_POPUPS.map((p) => p.toLowerCase()).join('|')})`,
async (req, res) => {
res.set({
'Cache-Control': `private, max-age=${15 * 60}`, // seconds
'Content-Type': 'text/html; charset=utf-8',
ETag: winEtag,
});
res.status(200).send(generateWinPage(req.lang));
});
if (req.headers['if-none-match'] === winEtag) {
res.status(304).end();
return;
}
res.status(200).send(generatePopUpPage(req.lang));
},
);
//
// Main Page (react generated)

View File

@ -18,22 +18,6 @@ import logger from '../core/logger';
import { APISOCKET_KEY } from '../core/config';
async function verifyClient(info, done) {
const { req } = info;
const { headers } = req;
const ip = getIPFromRequest(req);
if (!headers.authorization
|| !APISOCKET_KEY
|| headers.authorization !== `Bearer ${APISOCKET_KEY}`) {
logger.warn(`API ws request from ${ip} authenticated`);
return done(false);
}
logger.warn(`API ws request from ${ip} successfully authenticated`);
return done(true);
}
class APISocketServer {
wss; // WebSocket.Server
@ -47,7 +31,6 @@ class APISocketServer {
// path: "/mcws",
// server,
noServer: true,
verifyClient,
});
this.wss = wss;
@ -86,6 +69,24 @@ class APISocketServer {
setInterval(this.ping, 45 * 1000);
}
handleUpgrade(request, socket, head) {
const { headers } = request;
const ip = getIPFromRequest(request);
if (!headers.authorization
|| !APISOCKET_KEY
|| headers.authorization !== `Bearer ${APISOCKET_KEY}`) {
logger.warn(`API ws request from ${ip} not authenticated`);
socket.write('HTTP/1.1 401 Unauthorized\r\n\r\n');
socket.destroy();
}
logger.warn(`API ws request from ${ip} successfully authenticated`);
this.wss.handleUpgrade(request, socket, head, (ws) => {
this.wss.emit('connection', ws, request);
});
}
broadcastChatMessage(
name,
msg,

View File

@ -1,5 +1,5 @@
/*
* create html for Window page
* create html for popup page
*
*/
@ -36,14 +36,14 @@ if (BACKUP_URL) {
* @param lang language code
* @return html of mainpage
*/
function generateWinPage(lang) {
function generatePopUpPage(lang) {
const ssvR = {
...ssv,
lang: lang === 'default' ? 'en' : lang,
};
const script = (assets[`win-${lang}`])
? assets[`win-${lang}`].js
: assets.win.js;
const script = (assets[`popup-${lang}`])
? assets[`popup-${lang}`].js
: assets.popup.js;
const { t } = getTTag(lang);
@ -52,8 +52,8 @@ function generateWinPage(lang) {
<html lang="${lang}">
<head>
<meta charset="UTF-8" />
<title>${t`PixelPlanet.Fun Window`}</title>
<meta name="description" content="${t`PixelPlanet.Fun Windows`}" />
<title>${t`PixelPlanet.Fun PopUp`}</title>
<meta name="description" content="${t`PixelPlanet.Fun PopUp`}" />
<meta name="google" content="nopagereadaloud" />
<meta name="theme-color" content="#cae3ff" />
<meta name="viewport"
@ -75,4 +75,4 @@ function generateWinPage(lang) {
return html;
}
export default generateWinPage;
export default generatePopUpPage;

View File

@ -468,12 +468,6 @@ export function unmuteChatChannel(cid) {
};
}
export function reloadUrl() {
return {
type: 'RELOAD_URL',
};
}
export function onViewFinishChange() {
return {
type: 'ON_VIEW_FINISH_CHANGE',
@ -489,7 +483,9 @@ export function selectHistoricalTime(date, time) {
}
export function urlChange() {
return reloadUrl();
return {
type: 'RELOAD_URL',
};
}
export function unload() {

View File

@ -0,0 +1,17 @@
/*
* Actions taht are used only within popup
*/
export function setWindowArgs(args) {
return {
type: 'SET_WIN_ARGS',
args,
};
}
export function setWindowTitle(title) {
return {
type: 'SET_WIN_TITLE',
title,
};
}

View File

@ -0,0 +1,33 @@
/*
* set URL and querys in pupup window
*/
import { buildPopUpUrl } from '../../components/windows/popUpAvailable';
export default (store) => (next) => (action) => {
const ret = next(action);
switch (action.type) {
case 'SET_WIN_TITLE': {
const { windowType } = store.getState().popup;
const { title } = action;
const name = windowType[0] + windowType.substring(1).toLowerCase();
document.title = (title) ? `${name} - ${title}` : name;
break;
}
case 'SET_WIN_ARGS': {
const {
args,
windowType,
} = store.getState().popup;
const url = buildPopUpUrl(windowType, args);
window.history.pushState({}, undefined, url);
break;
}
default:
// nothing
}
return ret;
};

View File

@ -0,0 +1,73 @@
/*
* state for single-window page (popup)
*/
import { argsTypes } from '../../components/windows/popUpAvailable';
function getWinDataFromURL() {
const path = window.location.pathname.split('/').slice(1);
/*
* first part of path is windowType
*/
const windowType = path[0].toUpperCase();
/*
* get args from path
*/
const argsArr = path.slice(1);
const args = {};
const typeArr = argsTypes[windowType];
if (typeArr) {
let i = Math.min(typeArr.length, argsArr.length);
while (i > 0) {
i -= 1;
args[typeArr[i]] = argsArr[i];
}
}
/*
* get args from query
*/
const urlSearchParams = new URLSearchParams(window.location.search);
const params = Object.fromEntries(urlSearchParams.entries());
return {
windowType,
args: {
...args,
...params,
},
};
}
const initialState = {
windowType: 'SETTINGS',
title: '',
args: {},
isPopup: window.opener && !window.opener.closed,
...getWinDataFromURL(),
};
export default function popup(
state = initialState,
action,
) {
switch (action.type) {
case 'RELOAD_URL': {
return {
...state,
...getWinDataFromURL(),
};
}
case 'SET_WIN_ARGS': {
return {
...state,
args: {
...action.args,
},
};
}
default:
return state;
}
}

View File

@ -1,21 +0,0 @@
/*
* state for single-window page (popup)
*/
const initialState = {
// windowType: null,
windowType: 'SETTINGS',
title: '',
args: {},
isPopup: window.opener && !window.opener.closed,
};
export default function win(
state = initialState,
action,
) {
switch (action.type) {
default:
return state;
}
}

View File

@ -3,3 +3,5 @@
*/
export const selectWindowType = (state) => state.win.windowType;
export const selectWIndowArgs = (state) => state.win.args;

View File

@ -1,5 +1,5 @@
/*
* redux store for windows / popups
* redux store for popups
*/
/* eslint-disable no-console */
@ -15,7 +15,7 @@ import { persistStore } from 'redux-persist';
*/
import sharedReducers from './sharedReducers';
import canvas from './reducers/canvas';
import win from './reducers/win';
import popup from './reducers/popup';
/*
* middleware
@ -25,7 +25,7 @@ import parent from './middleware/parent';
const reducers = combineReducers({
...sharedReducers,
canvas,
win,
popup,
});
const store = createStore(

View File

@ -1,24 +0,0 @@
/*
* Main Script for windows (pop-ups and stuff)
*/
import store from './store/storeWin';
import renderAppWin from './components/AppWin';
function init() {
// window.addEventListener('message', store.dispatch);
}
init();
document.addEventListener('DOMContentLoaded', () => {
// eslint-disable-next-line no-console
console.log('hello');
renderAppWin(document.getElementById('app'), store);
/*
* check if popup or independent window
*/
if (!window.opener || window.opener.closed) {
}
});

View File

@ -68,8 +68,8 @@ function buildWebpackClientConfig(
[path.resolve('src', 'client.js')],
[(locale !== 'default') ? `globe-${locale}` : 'globe']:
[path.resolve('src', 'globe.js')],
[(locale !== 'default') ? `win-${locale}` : 'win']:
[path.resolve('src', 'win.js')],
[(locale !== 'default') ? `popup-${locale}` : 'popup']:
[path.resolve('src', 'popup.js')],
},
output: {