Skip to content

Commit

Permalink
onlinetool.io => tools.arslexis.io; fix logging of events
Browse files Browse the repository at this point in the history
  • Loading branch information
kjk committed Apr 25, 2024
1 parent bdcc629 commit 8821c62
Show file tree
Hide file tree
Showing 24 changed files with 87 additions and 84 deletions.
8 changes: 4 additions & 4 deletions docs/.vitepress/config.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
export default {
title: "onlinetool.io",
description: "Documentation for onlintool.io tools",
title: "tools.arslexis.io",
description: "Documentation for tools.arslexis.io",
cleanUrls: true,
base: "/docs/",
srcDir: "./markdown",
outDir: "../dist/docs",

themeConfig: {
siteTitle: "onlinetool.io",
siteTitle: "tools.arslexis.io",
editLink: {
pattern: "https://github.com/kjk/onlinetool/edit/main/docs/:path",
pattern: "https://github.com/kjk/tools.arslexis.io/edit/main/docs/:path",
},
sidebar: [
{
Expand Down
2 changes: 1 addition & 1 deletion docs/markdown/gist-editor.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Gist Editor

[Gist Editor](https://onlinetool.io/gisteditor/) is a better editor / manager for GitHub Gists.
[Gist Editor](https://tools.arslexis.io/gisteditor/) is a better editor / manager for GitHub Gists.

Log in with GitHub to:
* edit existing gists
Expand Down
4 changes: 2 additions & 2 deletions docs/markdown/index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# onlinetool.io
# tools.arslexis.io

[onlinetool.io](https://onlinetool.io) is a collection of useful tools in the browser:
[tools.arslexis.io](https://tools.arslexis.io) is a collection of useful tools in the browser:

* notepad2 : a lightweight (but capable) text / code editor. A web-based clone of notepad2 editor for Windows
* Gist Editor : better editor / manager for GitHub gists
Expand Down
2 changes: 1 addition & 1 deletion docs/markdown/notepad2-differences.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ Major reasons for differences:
* differences between Scintilla editing component used by notepad2 and Code Mirror 6 editing component used by us
* features that I haven't yet implemented

Feel free to [request features](https://github.com/kjk/onlinetool.io/labels/notepad2) that are most important to you.
Feel free to [request features](https://github.com/kjk/tools.arslexis.io/labels/notepad2) that are most important to you.
2 changes: 1 addition & 1 deletion docs/markdown/notepad2.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Notepad2 for web

[Notepad2 for web](https://onlinetool.io/notepad2/) is a web browser re-implementation of [notepad2](https://github.com/zufuliu/notepad2), a lightweight text / code editor for Windows.
[Notepad2 for web](https://tools.arslexis.io/notepad2/) is a web browser re-implementation of [notepad2](https://github.com/zufuliu/notepad2), a lightweight text / code editor for Windows.

We try to faithfully recreate notepad2, within the limits of what's possible in the browser.

Expand Down
2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "onlinetool.io",
"name": "tools.arslexis.io",
"license": "UNLICENSED",
"version": "0.1.0",
"type": "module",
Expand Down
10 changes: 5 additions & 5 deletions frontend/src/Main.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
<div class="flex">
<a
class="px-1 py-1 mr-1 hover:underline text-xs"
href="https://github.com/kjk/onlinetool.io/discussions"
href="https://github.com/kjk/tools.arslexis.io/discussions"
target="_blank"
rel="noreferrer"
>
feedback
</a>
<a
class="px-1 py-1 mr-1 hover:bg-gray-100"
href="https://github.com/kjk/onlinetool.io"
href="https://github.com/kjk/tools.arslexis.io"
target="_blank"
rel="noreferrer"
>
Expand Down Expand Up @@ -207,19 +207,19 @@
<div>Have feedback?</div>
<a
class="underline"
href="https://github.com/kjk/onlinetool.io/discussions"
href="https://github.com/kjk/tools.arslexis.io/discussions"
target="_blank">discuss</a
>
<div>&bull;</div>
<a
class="underline"
href="https://github.com/kjk/onlinetool.io/issues"
href="https://github.com/kjk/tools.arslexis.io/issues"
target="_blank">request features</a
>
<div>&bull;</div>
<a
class="underline"
href="https://github.com/kjk/onlinetool.io/issues"
href="https://github.com/kjk/tools.arslexis.io/issues"
target="_blank">report bugs</a
>
<div>&bull;</div>
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/TopNav.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import Twitter from "./icons/Twitter.svelte";
import GitHub from "./icons/GitHub.svelte";
export let gitHubURL = "https://github.com/kjk/onlinetool.io";
export let gitHubURL = "https://github.com/kjk/tools.arslexis.io";
</script>

<div class="flex items-center mx-4 pt-1 pb-2">
Expand All @@ -17,7 +17,7 @@
<div class="grow" />
<a
class="px-1 py-1 mr-1 hover:underline text-xs"
href="https://github.com/kjk/onlinetool.io/discussions"
href="https://github.com/kjk/tools.arslexis.io/discussions"
target="_blank"
rel="noreferrer"
>
Expand Down
29 changes: 26 additions & 3 deletions frontend/src/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,36 @@ import { httpPostJSON } from "./httputil";

export let disableEvents = false;

/**
* @param {Object} o
*/
export function logEventRaw(o) {
fetch("/event", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify(o),
})
.then((response) => {
if (!response.ok) {
console.error("failed to log event:", response.statusText);
} else {
console.log("event logged:", o);
}
})
.catch((err) => {
console.error("failed to log event:", err);
});
}

export function logEvent(name, durMs = 0, meta = {}) {
if (disableEvents || window.location.host !== "onlinetool.io") {
if (disableEvents) {
return;
}
if (durMs > 0) {
meta.dur = durMs.toFixed(0);
}
httpPostJSON(`/event/${name}`, meta);
// console.log(`ev '${name}' took ${durMs} ms`);
meta.name = name;
logEventRaw(meta);
}
2 changes: 1 addition & 1 deletion frontend/src/gisteditor/About.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<div class="flex justify-end mt-2">
<a
class="btn abtn"
href="https://onlinetool.io/docs/gist-editor"
href="https://tools.arslexis.io/docs/gist-editor"
target="_blank"
rel="noreferrer"
>
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/gisteditor/EditorCodeMirror.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -949,7 +949,7 @@
{/each}
<!-- <div>
<a
href="https://onlinetool.io/docs/gist-editor"
href="https://tools.arslexis.io/docs/gist-editor"
target="_blank"
rel="noreferrer"
>
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/gisteditor/GistEditorNav.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<div class="ml-8">
<a
class="px-3 py-1 hover:bg-gray-100"
href="https://onlinetool.io/docs/gist-editor"
href="https://tools.arslexis.io/docs/gist-editor"
on:click|preventDefault={() => (showingAbout = !showingAbout)}
target="_blank"
rel="noreferrer"
Expand All @@ -38,7 +38,7 @@
<div>
<a
class="px-3 py-1 hover:bg-gray-100"
href="https://onlinetool.io/docs/gist-editor"
href="https://tools.arslexis.io/docs/gist-editor"
target="_blank"
rel="noreferrer"
>
Expand Down
11 changes: 7 additions & 4 deletions frontend/src/gisteditor/HelpButton.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<div>
<a
on:click={hideMenu}
href="https://onlinetool.io/docs/gist-editor"
href="https://tools.arslexis.io/docs/gist-editor"
target="_blank"
rel="noreferrer"
>
Expand All @@ -29,7 +29,7 @@
<div>
<a
on:click={hideMenu}
href="https://onlinetool.io/docs/gist-editor"
href="https://tools.arslexis.io/docs/gist-editor"
target="_blank"
rel="noreferrer"
>
Expand Down Expand Up @@ -62,7 +62,9 @@
.help {
cursor: pointer;
user-select: none;
transition: opacity 700ms ease 0s, color 700ms ease 0s;
transition:
opacity 700ms ease 0s,
color 700ms ease 0s;
position: absolute;
display: flex;
align-items: center;
Expand All @@ -74,7 +76,8 @@
height: 36px;
border-radius: 100%;
font-size: 20px;
box-shadow: rgba(15, 15, 15, 0.1) 0px 0px 0px 1px,
box-shadow:
rgba(15, 15, 15, 0.1) 0px 0px 0px 1px,
rgba(15, 15, 15, 0.1) 0px 2px 4px;
z-index: 40;
opacity: 1;
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/gisteditor/NoGist.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<div class="ml-4">
<a
class="abtn"
href="https://onlinetool.io/docs/gist-editor"
href="https://tools.arslexis.io/docs/gist-editor"
target="_blank"
rel="noreferrer"
>
Expand All @@ -29,7 +29,7 @@
<div class="ml-4">
<a
class="abtn"
href="https://onlinetool.io/docs/gist-editor"
href="https://tools.arslexis.io/docs/gist-editor"
target="_blank"
rel="noreferrer"
>
Expand Down
4 changes: 3 additions & 1 deletion frontend/src/gisteditor/langs.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,9 @@ const docsForLang = {
export function docsForFile(fileName) {
fileName = fileName.toLowerCase();
if (fileName === "codeeval.yml") {
return [["codeeval.yml syntax", "https://onlinetool.io/docs/gist-editor"]];
return [
["codeeval.yml syntax", "https://tools.arslexis.io/docs/gist-editor"],
];
}
const li = getLangInfoFromFileName(fileName);
if (!li) {
Expand Down
12 changes: 7 additions & 5 deletions frontend/src/gisteditor/store.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
import { writable } from "svelte/store";
import { len, startTimer } from "../util.js";
import { clearMessage, showError, showMessage } from "../Messages.svelte";
import { setOnGitHubLogin } from "../github_login.js";
import {
addHeader,
addToken,
checkForError,
checkResponse,
getLinkNext,
} from "../githubapi.js";
import { logEvent } from "../events.js";
import { clearMessage, showError, showMessage } from "../Messages.svelte";
import { len, startTimer } from "../util.js";

// @ts-ignore
import Dexie from "https://esm.sh/[email protected]";
import { getLoggedUser } from "../github_login.js";
import { logEvent } from "../events.js";
import { writable } from "svelte/store";

// localStorage key for gists
export const cacheKeyGistsForLoggedUser = "gists_for_logged_user";
Expand Down Expand Up @@ -236,6 +237,7 @@ export async function getGistsForLoggedUser() {
const gists = v.result;
const meta = {
fromCache: v.fromCache,
user: getLoggedUser(),
};
logEvent("getGistsForLoggedUser", elapsedFn(), meta);
console.log(`getGistsForLoggedUser: ${len(gists)} in ${elapsedFn()} ms`);
Expand Down
9 changes: 5 additions & 4 deletions frontend/src/github_login.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { writable, get } from "svelte/store";
import * as githubapi from "./githubapi.js";

import { get, writable } from "svelte/store";
import { getLocalStorageAsJSON, setLocalStorageFromJSON } from "./util.js";
import popup from "./popup.js";

import { logEvent } from "./events.js";
import * as githubapi from "./githubapi.js";
import popup from "./popup.js";
import { showError } from "./Messages.svelte";
import { gistsSummary } from "./gisteditor/store.js";

// localStorage key for github token
export const keyGitHubToken = "codeeval:gh-token";
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/notepad2/DialogAbout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@
class="ml-2 underline focus-within:outline"
rel="noreferrer"
target="_blank"
href="https://onlinetool.io/docs/notepad2">read documentation</a
href="https://tools.arslexis.io/docs/notepad2">read documentation</a
>
<a
class="ml-2 underline focus-within:outline"
rel="noreferrer"
target="_blank"
href="https://github.com/kjk/onlinetool.io/issues"
href="https://github.com/kjk/tools.arslexis.io/issues"
>report bugs, request features</a
>
<a
Expand All @@ -46,7 +46,7 @@
class="ml-2 underline focus-within:outline"
rel="noreferrer"
target="_blank"
href="https://github.com/kjk/onlinetool.io">see source code</a
href="https://github.com/kjk/tools.arslexis.io">see source code</a
>

<div class="mt-1">Credits:</div>
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/notepad2/DialogBrowse.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@
target="_blank"
rel="noreferrer"
class="text-blue-700 underline mr-2"
href="https://onlinetool.io/docs/notepad2-browse-files"
href="https://tools.arslexis.io/docs/notepad2-browse-files"
>
help</a
>
Expand Down
12 changes: 6 additions & 6 deletions frontend/src/notepad2/Notepad2.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -1630,21 +1630,21 @@
clearClipboard();
break;
case m.IDM_HELP_PROJECT_HOME:
window.open("https://onlinetool.io/docs/notepad2", "_blank");
window.open("https://tools.arslexis.io/docs/notepad2", "_blank");
break;
case m.IDM_HELP_REPORT_ISSUE:
case m.IDM_HELP_FEATURE_REQUEST:
window.open(
"https://github.com/kjk/onlinetool.io/labels/notepad2",
"https://github.com/kjk/tools.arslexis.io/labels/notepad2",
"_blank"
);
break;
case m.IDM_HELP_SOURCE_CODE:
window.open("https://github.com/kjk/onlinetool.io", "_blank");
window.open("https://github.com/kjk/tools.arslexis.io", "_blank");
break;
case m.IDM_HELP_DISCUSS:
window.open(
"https://github.com/kjk/onlinetool.io/discussions/categories/notepad2",
"https://github.com/kjk/tools.arslexis.io/discussions/categories/notepad2",
"_blank"
);
break;
Expand Down Expand Up @@ -1918,15 +1918,15 @@
<div class="grow" />
<a
class="px-1 py-1 mr-1 hover:underline text-xs"
href="https://github.com/kjk/onlinetool.io/discussions"
href="https://github.com/kjk/tools.arslexis.io/discussions"
target="_blank"
rel="noreferrer"
>
feedback
</a>
<a
class="px-1 py-1 mr-1 hover:bg-gray-100"
href="https://github.com/kjk/onlinetool.io"
href="https://github.com/kjk/tools.arslexis.io"
target="_blank"
rel="noreferrer"
>
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/notepad2/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { httpPostJSON } from "../httputil";
export let disableEvents = false;

export function logNpEvent(name, durMs = 0, meta = {}) {
if (disableEvents || window.location.host !== "onlinetool.io") {
if (disableEvents) {
return;
}
if (durMs > 0) {
Expand Down
Loading

0 comments on commit 8821c62

Please sign in to comment.