Skip to content

Commit

Permalink
Merge pull request online-go#2449 from online-go/fixes
Browse files Browse the repository at this point in the history
Minor fixes found while working on strict mode stuff
  • Loading branch information
anoek authored Dec 17, 2023
2 parents 1e96ad8 + bfa2b76 commit ea44956
Show file tree
Hide file tree
Showing 71 changed files with 393 additions and 588 deletions.
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ package-lock.json
report.*.json
neovide_backtraces.log



i18n/data/
i18n/import/
i18n/prep-import.js
Expand Down
1 change: 1 addition & 0 deletions .vscode/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.log
27 changes: 27 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"annulable",
"anoek",
"apikey",
"appinfo",
"automatch",
"automatcher",
"automatchers",
Expand All @@ -18,6 +19,8 @@
"Baduk",
"badukpop",
"benjito",
"bitfield",
"boardsize",
"byoyomi",
"cacheable",
"chillout",
Expand All @@ -26,16 +29,23 @@
"crosshairs",
"csrfmiddlewaretoken",
"csrftoken",
"cssnano",
"DATETIME",
"dedup",
"deinit",
"deinitialize",
"Dismissable",
"dont",
"DOTCSS",
"DOTJS",
"enableable",
"Errcode",
"fakelink",
"fuggly",
"Fuseki",
"gamedata",
"gamelist",
"gettext",
"glicko",
"goban",
"Gobans",
Expand All @@ -53,9 +63,11 @@
"joseki",
"josekipedia",
"josekis",
"jsonify",
"Kata",
"katago",
"kidsgoserver",
"kyus",
"Leela",
"lerp",
"localstorage",
Expand All @@ -66,50 +78,65 @@
"minigoban",
"misclick",
"misclicks",
"modlog",
"msgid",
"ngettext",
"nochallenge",
"nodetails",
"noextracontrols",
"nolink",
"npgettext",
"nums",
"offtopic",
"omnisearch",
"opengotha",
"pgettext",
"playouts",
"pluralidx",
"postback",
"rengo",
"replot",
"roundrobin",
"rrule",
"seekgraph",
"Seki",
"semeai",
"sepa",
"shadowban",
"shadowbanned",
"shownotesindicator",
"Sitewide",
"slowstrobe",
"sodos",
"styl",
"sublicensable",
"subprops",
"subselect",
"subtool",
"superchat",
"superko",
"swal",
"sweetalert",
"tenuki",
"testuser",
"tesuji",
"Timecop",
"tock",
"traceback",
"tsumegodojo",
"tygem",
"tzoffset",
"uffizzi",
"unannulable",
"unhighlight",
"unitify",
"Unranked",
"unstarted",
"uservoice",
"usgc",
"wbaduk",
"Weiqi",
"xgettext",
"yesno",
"yike",
"yomi",
Expand Down
47 changes: 24 additions & 23 deletions Gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,20 +191,20 @@ function dev_server(done) {
let http = require("http");
var proxy = require("express-http-proxy");
let url = require("url");
let devserver = express();
devserver.use(body_parser.json());
devserver.use(body_parser.text());
let dev_server = express();
dev_server.use(body_parser.json());
dev_server.use(body_parser.text());

http.createServer(devserver).listen(port, null, function () {
http.createServer(dev_server).listen(port, null, function () {
console.info(`#############################################`);
console.info(`## Development server started on port ${port}`);
console.info(`## ( http://localhost:${port} )`);
console.info(`## pointing at ${BACKEND} (${server_url})`);
console.info(`#############################################`);
});

devserver.use(express.static("dist"));
devserver.use(express.static("assets"));
dev_server.use(express.static("dist"));
dev_server.use(express.static("assets"));

// Based on https://github.com/villadora/express-http-proxy/issues/127
const isMultipartRequest = (req) => {
Expand Down Expand Up @@ -237,19 +237,19 @@ function dev_server(done) {
},
});

devserver.use("/api", backend_proxy("/api"));
devserver.use("/termination-api", backend_proxy("/termination-api"));
devserver.use("/merchant", backend_proxy("/merchant"));
devserver.use("/billing", backend_proxy("/billing"));
devserver.use("/sso", backend_proxy("/sso"));
devserver.use("/oauth2", backend_proxy("/oauth2"));
devserver.use("/complete", backend_proxy("/complete"));
devserver.use("/disconnect", backend_proxy("/disconnect"));
devserver.use("/OGSScoreEstimator", backend_proxy("/OGSScoreEstimator"));
devserver.use("/oje", backend_proxy("/oje"));
devserver.use("/firewall", backend_proxy("/firewall"));

devserver.get("/locale/*", (req, res) => {
dev_server.use("/api", backend_proxy("/api"));
dev_server.use("/termination-api", backend_proxy("/termination-api"));
dev_server.use("/merchant", backend_proxy("/merchant"));
dev_server.use("/billing", backend_proxy("/billing"));
dev_server.use("/sso", backend_proxy("/sso"));
dev_server.use("/oauth2", backend_proxy("/oauth2"));
dev_server.use("/complete", backend_proxy("/complete"));
dev_server.use("/disconnect", backend_proxy("/disconnect"));
dev_server.use("/OGSScoreEstimator", backend_proxy("/OGSScoreEstimator"));
dev_server.use("/oje", backend_proxy("/oje"));
dev_server.use("/firewall", backend_proxy("/firewall"));

dev_server.get("/locale/*", (req, res) => {
let options = {
hostname: "storage.googleapis.com",
port: 80,
Expand Down Expand Up @@ -277,7 +277,7 @@ function dev_server(done) {
req2.end();
});

devserver.get("/goban.js", (req, res) => {
dev_server.get("/goban.js", (req, res) => {
console.info(`GET ${req.path} -> node_modules/goban/lib/goban.js`);
let js = fs.readFileSync("node_modules/goban/lib/goban.js", { encoding: "utf-8" });
res.setHeader("Content-Type", "application/javascript; charset=utf-8");
Expand All @@ -288,7 +288,7 @@ function dev_server(done) {
res.status(200).send(js);
});

devserver.get("/goban.js.map", (req, res) => {
dev_server.get("/goban.js.map", (req, res) => {
console.info(`GET ${req.path} -> node_modules/goban/lib/goban.js.map`);
let js = fs.readFileSync("node_modules/goban/lib/goban.js.map", { encoding: "utf-8" });
res.setHeader("Content-Type", "application/javascript; charset=utf-8");
Expand All @@ -299,7 +299,7 @@ function dev_server(done) {
res.status(200).send(js);
});

devserver.get("/index.js.map", (req, res) => {
dev_server.get("/index.js.map", (req, res) => {
let js = fs.readFileSync("node_modules/goban/lib/index.js.map", { encoding: "utf-8" });
res.setHeader("Content-Type", "application/javascript; charset=utf-8");
res.setHeader("Cache-Control", "no-cache, no-store, must-revalidate");
Expand All @@ -309,7 +309,7 @@ function dev_server(done) {
res.status(200).send(js);
});

devserver.get("*", (req, res) => {
dev_server.get("*", (req, res) => {
console.info(`GET ${req.path}`);

if (req.path === "ogs.js") {
Expand Down Expand Up @@ -370,6 +370,7 @@ function dev_server(done) {
return JSON.stringify(supported_languages);

case "AMEX_CLIENT_ID":
/* cspell: disable-next-line */
return "kvEB9qXE6jpNUv3fPkdbWcPaZ7nQAXyg";
case "AMEX_ENV":
return "qa";
Expand Down
4 changes: 2 additions & 2 deletions src/components/Chat/ChatChannelList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ interface ChatChannelListProperties {
channel: string;
}

function autojoin_channels() {
function auto_join_channels() {
const joined_channels = data.get("chat.joined", {});
const parted_channels = data.get("chat.parted", {});

Expand Down Expand Up @@ -93,7 +93,7 @@ function autojoin_channels() {
}

export function ChatChannelList({ channel }: ChatChannelListProperties): JSX.Element {
autojoin_channels();
auto_join_channels();

const joined_channels = data.get("chat.joined", {});
const using_resolved_channel = !(
Expand Down
2 changes: 1 addition & 1 deletion src/components/Chat/ChatDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ export function ChatDetails(props: ChatDetailsProperties): JSX.Element {
</>
)}
{props.partFunc ? (
<button className="xs noshadow reject" onClick={leave}>
<button className="xs no-shadow reject" onClick={leave}>
<i className="fa fa-times" /> {leave_text}
</button>
) : null}
Expand Down
12 changes: 7 additions & 5 deletions src/components/Chat/ChatLine.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,29 +41,29 @@ data.watch("config.user", (user) => {

interface ChatLineInterface {
line: ChatMessage;
lastline?: ChatMessage;
lastLine?: ChatMessage;
}

export function ChatLine(props: ChatLineInterface): JSX.Element {
const line = props.line;
const lastline = props.lastline;
const last_line = props.lastLine;
const user = line;

if (line.system) {
return <div className="chat-line system">{chat_markup(line.message.m)}</div>;
}

const message = line.message;
const ts_ll = lastline ? new Date(lastline.message.t * 1000) : null;
const ts_ll = last_line ? new Date(last_line.message.t * 1000) : null;
const ts = message.t ? new Date(message.t * 1000) : null;
let third_person = false;
let body = message.m;
let show_date: JSX.Element | null = null;

if (!lastline || (ts && ts_ll)) {
if (!last_line || (ts && ts_ll)) {
if (ts) {
if (
!lastline ||
!last_line ||
moment(ts).format("YYYY-MM-DD") !== moment(ts_ll).format("YYYY-MM-DD")
) {
show_date = <div className="date">{moment(ts).format("LL")}</div>;
Expand All @@ -89,7 +89,9 @@ export function ChatLine(props: ChatLineInterface): JSX.Element {
body = generateChatSearchLine("https://www.google.com/#q=", "/google ", body);
}

/* cspell:disable-next-line */
if (body.substr(0, 8) === "/lmgtfy ") {
/* cspell:disable-next-line */
body = generateChatSearchLine("https://www.lmgtfy.com/?q=", "/lmgtfy ", body);
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/components/Chat/ChatList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ interface ChatListProperties {
closing_toggle?: () => void;
collapse_state_store_name?: keyof DataSchema;
fakelink?: boolean;
partFunc?: (channel: string, dont_autoset_active: boolean, dont_clear_joined: boolean) => void;
partFunc?: (channel: string, dont_auto_set_active: boolean, dont_clear_joined: boolean) => void;
}

interface ChatListState {
Expand All @@ -69,7 +69,7 @@ interface ChatListState {
highlight_active_channel: boolean;
active_channel: string;
fakelink: boolean;
partFunc?: (channel: string, dont_autoset_active: boolean, dont_clear_joined: boolean) => void;
partFunc?: (channel: string, dont_auto_set_active: boolean, dont_clear_joined: boolean) => void;
}

export class ChatList extends React.PureComponent<ChatListProperties, ChatListState> {
Expand Down
18 changes: 6 additions & 12 deletions src/components/Chat/ChatLog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ interface ChatLogProperties {
updateTitle?: boolean;
hideTopic?: boolean;
forceShowGames?: boolean;
inputPlaceholdertText?: string;
inputPlaceholderText?: string;
onShowChannels?: (tf: boolean) => void;
onShowUsers?: (tf: boolean) => void;
/* if properties are added to this, don't forget to
Expand All @@ -66,7 +66,7 @@ interface InternalChatLogProperties extends ChatLogProperties {
onShowGames?: (tf: boolean) => void;
showingGames?: boolean;
canShowGames?: boolean;
inputPlaceholdertext?: string;
inputPlaceholderText?: string;
}

let deferred_chat_update: Timeout | null = null;
Expand Down Expand Up @@ -352,12 +352,6 @@ function ChannelTopic({
)}

<i className={"header-icon fa fa-gear"} onClick={channelDetails} />
{/*channel_leavable &&
<i className={'header-icon fa fa-times'}
title={pgettext("Leave the selected channel.", "Leave Channel")}
onClick={partChannel}
/>
*/}

<i
className={"header-icon fa fa-users" + (showingUsers ? " active" : "")}
Expand Down Expand Up @@ -495,7 +489,7 @@ function ChatLines({
const ll = last_line;
last_line = line;
return (
<ChatLine key={line.message.i || `system-${idx}`} line={line} lastline={ll} />
<ChatLine key={line.message.i || `system-${idx}`} line={line} lastLine={ll} />
);
})}
</div>
Expand All @@ -505,7 +499,7 @@ function ChatLines({
function ChatInput({
channel,
autoFocus,
inputPlaceholdertText,
inputPlaceholderText,
}: InternalChatLogProperties): JSX.Element {
const user = useUser();
const rtl_mode = !!global_channels_by_id[channel]?.rtl;
Expand Down Expand Up @@ -550,8 +544,8 @@ function ChatInput({
[channel, proxy],
);

const placeholder = inputPlaceholdertText
? inputPlaceholdertText
const placeholder = inputPlaceholderText
? inputPlaceholderText
: pgettext(
"This is the placeholder text for the chat input field in games, chat channels, and private messages",
interpolate("Message {{who}}", { who: channel_name || "..." }),
Expand Down
Loading

0 comments on commit ea44956

Please sign in to comment.