Skip to content

Commit

Permalink
Merge branch 'devel' into modal-tooltip
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewjcasal authored Oct 5, 2024
2 parents 9065e6d + 0cff209 commit 5fd9dfc
Show file tree
Hide file tree
Showing 314 changed files with 2,184 additions and 1,964 deletions.
52 changes: 26 additions & 26 deletions Gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,27 @@ BACKEND = BACKEND.toUpperCase();
//BACKEND = 'PRODUCTION';
//BACKEND = 'LOCAL';

const spawn = require("child_process").spawn;
const fs = require("fs");
const gulp = require("gulp");
const path = require("path");
const execSync = require("child_process").execSync;
const livereload = require("gulp-livereload");
const stylus = require("gulp-stylus");
const sourcemaps = require("gulp-sourcemaps");
const rename = require("gulp-rename");
const pump = require("pump");
const autoprefixer = require("autoprefixer");
const postcss = require("gulp-postcss");
const cssnano = require("cssnano");
const inline_svg = require("postcss-inline-svg");
const gulpEslint = require("gulp-eslint-new");
const html_minifier = require("html-minifier").minify;
import { spawn, execSync } from "child_process";
import fs from "fs";
import gulp from "gulp";
import path from "path";
import livereload from "gulp-livereload";
import stylus from "gulp-stylus";
import sourcemaps from "gulp-sourcemaps";
import rename from "gulp-rename";
import pump from "pump";
import autoprefixer from "autoprefixer";
import postcss from "gulp-postcss";
import cssnano from "cssnano";
import inline_svg from "postcss-inline-svg";
import gulpEslint from "gulp-eslint-new";
import { minify as html_minifier } from "html-minifier";

import express from "express";
import body_parser from "body-parser";
import http from "http";
import proxy from "express-http-proxy";
import url from "url";

let ts_sources = ["src/**/*.ts", "src/**/*.tsx", "!src/**/*.test.ts", "!src/**/*.test.tsx"];

Expand Down Expand Up @@ -187,16 +192,11 @@ function dev_server(done) {
process.exit(1);
}

let express = require("express");
let body_parser = require("body-parser");
let http = require("http");
var proxy = require("express-http-proxy");
let url = require("url");
let dev_server = express();
dev_server.use(body_parser.json());
dev_server.use(body_parser.text());

http.createServer(dev_server).listen(port, null, function() {
http.createServer(dev_server).listen(port, null, function () {
console.info(`\n\n#############################################`);
console.info(`## Development server started on port ${port}`);
console.info(`## ( http://localhost:${port} )`);
Expand Down Expand Up @@ -226,13 +226,13 @@ function dev_server(done) {
let backend_proxy = (prefix) =>
proxy_wrapper(server_url, {
https: use_https,
proxyReqPathResolver: function(req) {
proxyReqPathResolver: function (req) {
let path = prefix + url.parse(req.url).path;
console.log("-->", path);
return path;
},
proxyReqOptDecorator: function(proxyReqOpts, srcReq) {
return new Promise(function(resolve, reject) {
proxyReqOptDecorator: function (proxyReqOpts, srcReq) {
return new Promise(function (resolve, reject) {
if (!("Content-Type" in srcReq.headers)) {
proxyReqOpts.headers["Content-Type"] = "application/json";
}
Expand Down Expand Up @@ -487,7 +487,7 @@ function getPreferredLanguage(req, supported_languages) {
return lang;
}
}
} catch (e) { }
} catch (e) {}

return "en";
}
2 changes: 1 addition & 1 deletion Makefile.production
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ purge-cdn-files:
dist/ogs.min.js: dist/ogs.js
npm run webpack -- --mode=production --optimization-minimize --devtool=source-map

dist/vendor.min.js: dist/vendor.js
dist/vendor.min.js:
npm run webpack -- --mode=production --optimization-minimize --devtool=source-map

dist/ogs.$(VERSION).css:
Expand Down
12 changes: 7 additions & 5 deletions i18n/audit-translations.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@

// cspell: words autotranslations conv "Türkçe" "hwat" "עִבְרִית" autotranslated autotranslation autotranslate

const deepl = require("deepl-node");
const fs = require("fs");
const PO = require("pofile");
const GoogleTranslate = require("@google-cloud/translate").v3.TranslationServiceClient;
const OpenAI = require("openai");
import fs from "fs";
import PO from "pofile";
import deepl from "deepl-node";
import GoogleTranslateModule from "@google-cloud/translate";
import OpenAI from "openai";

const GoogleTranslate = GoogleTranslateModule.v3.TranslationServiceClient;

let keys = fs.existsSync("./keys.json") ? JSON.parse(fs.readFileSync("./keys.json")) : null;

Expand Down
8 changes: 4 additions & 4 deletions i18n/create-unified-pot.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ performs the automatic translation of strings.

"use strict";

const fs = require("fs");
const XGettext = require("xgettext-js");
const SourceMapConsumer = require("source-map").SourceMapConsumer;
const PO = require("pofile");
import fs from "fs";
import XGettext from "xgettext-js";
import { SourceMapConsumer } from "source-map";
import PO from "pofile";

const MODE = process.argv[2] || "full";

Expand Down
4 changes: 2 additions & 2 deletions i18n/jsonify-po-files.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

// cspell: words autotranslations conv

const fs = require("fs");
const PO = require("pofile");
import fs from "fs";
import PO from "pofile";

async function main() {
const countries = JSON.parse(await fs.promises.readFile("./build/countries.json", "utf-8"));
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"url": "https://github.com/online-go/online-go.com/issues",
"license": "AGPL-3.0",
"private": true,
"type": "module",
"engine": {
"npm": ">=8.5.0"
},
Expand Down Expand Up @@ -60,7 +61,7 @@
"express-http-proxy": "^2.0.0",
"fork-ts-checker-webpack-plugin": "^9.0.0",
"globals": "^15.8.0",
"goban": "=8.3.50",
"goban": "=8.3.61",
"gulp": "^5.0.0",
"gulp-clean-css": "^4.3.0",
"gulp-eslint-new": "^2.2.0",
Expand Down Expand Up @@ -135,13 +136,12 @@
"react-datetime": "^3.0.4",
"react-dom": "^18.2.0",
"react-dropzone": "^12.0.5",
"react-dynamic-help": "^3.0.1",
"react-dynamic-help": "^3.1.2",
"react-linkify": "^1.0.0-alpha",
"react-number-format": "^3.0.2",
"react-router-dom": "=6.3.0",
"react-select": "^5.0.1",
"react-split": "^2.0.9",
"react-switch": "^5.0.1",
"react-switch": "7.0.0",
"react-table": "^6.10.0",
"react-tabs": "^6.0.2",
"react-virtualized": "^9.22.3",
Expand Down
2 changes: 1 addition & 1 deletion prettier.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = {
export default {
trailingComma: "all",
tabWidth: 4,
printWidth: 100,
Expand Down
16 changes: 8 additions & 8 deletions src/components/ACLModal/ACLModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@
*/

import * as React from "react";
import { _ } from "translate";
import { post, get, del } from "requests";
import { openModal, Modal } from "Modal";
import { Player } from "Player";
import { PlayerAutocomplete, PlayerAutocompleteRef } from "PlayerAutocomplete";
import { GroupAutocomplete } from "GroupAutocomplete";
import { errorAlerter } from "misc";
import { PlayerCacheEntry } from "src/lib/player_cache";
import { _ } from "@/lib/translate";
import { post, get, del } from "@/lib/requests";
import { openModal, Modal } from "@/components/Modal";
import { Player } from "@/components/Player";
import { PlayerAutocomplete, PlayerAutocompleteRef } from "@/components/PlayerAutocomplete";
import { GroupAutocomplete } from "@/components/GroupAutocomplete";
import { errorAlerter } from "@/lib/misc";
import { PlayerCacheEntry } from "@/lib/player_cache";

interface Events {}

Expand Down
4 changes: 2 additions & 2 deletions src/components/AIReviewStream/AIReviewStream.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
*/

import * as React from "react";
import { ai_socket } from "sockets";
import { ai_socket } from "@/lib/sockets";
import { MoveTree, GobanSocketEvents } from "goban";
import { IdType } from "src/lib/types";
import { IdType } from "@/lib/types";

const analysis_requests_made: { [id: string]: boolean } = {};

Expand Down
8 changes: 4 additions & 4 deletions src/components/AccountWarning/AccountWarning.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
// So the word "warning" kind of means "message" now.

import * as React from "react";
import { _, pgettext } from "translate";
import { get, patch } from "requests";
import { useMainGoban, useUser } from "hooks";
import { AutoTranslate } from "AutoTranslate";
import { _, pgettext } from "@/lib/translate";
import { get, patch } from "@/lib/requests";
import { useMainGoban, useUser } from "@/lib/hooks";
import { AutoTranslate } from "@/components/AutoTranslate";
import { useLocation } from "react-router";
import { CANNED_MESSAGES } from "./CannedMessages";

Expand Down
31 changes: 28 additions & 3 deletions src/components/AccountWarning/CannedMessages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

import { _, interpolate } from "translate";
import { _, interpolate, llm_pgettext } from "@/lib/translate";

// These are the "canned messages" that Community Moderators can vote for.

Expand Down Expand Up @@ -290,11 +290,36 @@ moderator to let them know.
),
bot_owner_notified: (bot) =>
interpolate(
_(`
llm_pgettext(
"Message to acknowledge a report of a bot",
`
Thanks for your recent report about {{bot}}.
We've notified the owner of that bot.
`),
`,
),
{ bot },
),
ack_suspended: (reported) =>
interpolate(
llm_pgettext(
"Message to acknowledge a report of a repeat offender",
`
Thank you for your report. {{reported}} is a repeat offender, their account has been suspended.
`,
),
{ reported },
),

ack_suspended_and_annul: (reported) =>
interpolate(
llm_pgettext(
"Message to acknowledge a report of a repeat offender and annul a game",
`
Thank you for your report. {{reported}} is a repeat offender, their has been suspended. \
The reported game has been annulled.
`,
),
{ reported },
),
};
2 changes: 1 addition & 1 deletion src/components/Achievements/AchievementList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/

import * as React from "react";
//import * as preferences from "preferences";
//import * as preferences from "@/lib/preferences";

interface AchievementEntry {
name: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
*/

import * as React from "react";
import { _ } from "translate";
import { GameList } from "GameList";
import { PlayerCacheEntry } from "src/lib/player_cache";
import { _ } from "@/lib/translate";
import { GameList } from "@/components/GameList";
import { PlayerCacheEntry } from "@/lib/player_cache";

interface UserType {
id: number;
Expand Down
10 changes: 5 additions & 5 deletions src/components/Announcements/ActiveAnnouncements.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@

import * as React from "react";
import { Link } from "react-router-dom";
import { interpolate, _ } from "translate";
import { Card, PopupMenu, PopupMenuItem } from "material";
import { interpolate, _ } from "@/lib/translate";
import { Card, PopupMenu, PopupMenuItem } from "@/components/material";

import {
active_announcements,
Expand All @@ -28,10 +28,10 @@ import {
} from "./Announcements";
import { getBlocks, setAnnouncementBlock } from "../BlockPlayer";

import * as data from "data";
import * as preferences from "preferences";
import * as data from "@/lib/data";
import * as preferences from "@/lib/preferences";

import { alert } from "swal_config";
import { alert } from "@/lib/swal_config";

// Holds the expirations dates of cleared announcements
const hard_cleared_announcements: { [id: number]: number } = data.get(
Expand Down
16 changes: 8 additions & 8 deletions src/components/Announcements/Announcements.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@

import * as React from "react";
import { Link } from "react-router-dom";
import { get } from "requests";
import { UIPush } from "UIPush";
import { TypedEventEmitter } from "TypedEventEmitter";
import { errorLogger } from "misc";
import * as moment from "moment";
import ITC from "ITC";
import * as data from "data";
import { get } from "@/lib/requests";
import { UIPush } from "@/components/UIPush";
import { TypedEventEmitter } from "@/lib/TypedEventEmitter";
import { errorLogger } from "@/lib/misc";
import moment from "moment";
import ITC from "@/lib/ITC";
import * as data from "@/lib/data";
import { getBlocks } from "../BlockPlayer";
import * as preferences from "preferences";
import * as preferences from "@/lib/preferences";

interface Events {
announcement: any;
Expand Down
6 changes: 3 additions & 3 deletions src/components/Announcements/TournamentIndicator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@

import * as React from "react";
import { Link } from "react-router-dom";
import * as data from "data";
import * as moment from "moment";
import { usePreference } from "preferences";
import * as data from "@/lib/data";
import moment from "moment";
import { usePreference } from "@/lib/preferences";

export function TournamentIndicator(): JSX.Element | null {
const [tournament, setTournament] = React.useState<any>(null);
Expand Down
12 changes: 6 additions & 6 deletions src/components/AnnulQueueModal/AnnulQueueModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
*/

import * as React from "react";
import { _ } from "translate";
import { MiniGoban } from "MiniGoban";
import { _ } from "@/lib/translate";
import { MiniGoban } from "@/components/MiniGoban";
import { GobanRenderer } from "goban";
import { AIReview, GameTimings, ChatMode, GameChat, GobanContext } from "Game";
import { Player } from "Player";
import { Resizable } from "Resizable";
import { post, put } from "requests";
import { AIReview, GameTimings, ChatMode, GameChat, GobanContext } from "@/views/Game";
import { Player } from "@/components/Player";
import { Resizable } from "@/components/Resizable";
import { post, put } from "@/lib/requests";

// Define the AnnulQueueModalProps interface
interface AnnulQueueModalProps {
Expand Down
6 changes: 3 additions & 3 deletions src/components/AutoTranslate/AutoTranslate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
*/

import * as React from "react";
import { post } from "requests";
import { current_language, pgettext } from "translate";
import { Markdown } from "Markdown";
import { post } from "@/lib/requests";
import { current_language, pgettext } from "@/lib/translate";
import { Markdown } from "@/components/Markdown";

interface AutoTranslateProps {
source: string | null | undefined;
Expand Down
Loading

0 comments on commit 5fd9dfc

Please sign in to comment.