Skip to content

Commit

Permalink
simplify website
Browse files Browse the repository at this point in the history
  • Loading branch information
pomdtr committed Feb 12, 2024
1 parent 0a62626 commit 626afdd
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 19 deletions.
12 changes: 1 addition & 11 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,22 +33,12 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "21"
- name: Build Website
run: npm ci && npm run build
env:
TWEETY_ORIGIN: http://localhost:9999
working-directory: frontend
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
with:
# Upload entire repository
path: 'frontend/dist'
path: website
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v3
14 changes: 6 additions & 8 deletions frontend/src/terminal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { Config } from "./config";
async function fetchTheme(name: string, origin?: string | URL) {
const themeUrl = new URL(
`/themes/${name}.json`,
origin || window.location.origin
origin || window.location.origin,
);
return fetchJSON(themeUrl) as Promise<ITheme>;
}
Expand All @@ -29,8 +29,6 @@ async function main() {
let origin: URL;
if (params.has("port")) {
origin = new URL(`http://localhost:${params.get("port")}`);
} else if (__TWEETY_ORIGIN__) {
origin = new URL(__TWEETY_ORIGIN__);
} else {
origin = new URL(window.location.origin);
}
Expand Down Expand Up @@ -82,7 +80,7 @@ async function main() {
const lightTheme = await fetchTheme(config.theme || "Tomorrow", origin);
const darkTheme = await fetchTheme(
config.themeDark || config.theme || "Tomorrow Night",
origin
origin,
);
const terminal = new Terminal({
cursorBlink: true,
Expand Down Expand Up @@ -158,7 +156,7 @@ async function main() {
tooltip!.remove();
});
},
}
},
);
let [mouseX, mouseY] = [0, 0];
document.addEventListener("mousemove", (e) => {
Expand All @@ -175,14 +173,14 @@ async function main() {
const terminalID = nanoid();
const websocketProtocol = origin.protocol === "https:" ? "wss" : "ws";
const websocketUrl = new URL(
`${websocketProtocol}://${origin.host}/pty/${terminalID}`
`${websocketProtocol}://${origin.host}/pty/${terminalID}`,
);

websocketUrl.searchParams.set("cols", terminal.cols.toString());
websocketUrl.searchParams.set("rows", terminal.rows.toString());

const profileID =
params.get("profile") || params.get("p") || config.defaultProfile;
const profileID = params.get("profile") || params.get("p") ||
config.defaultProfile;
const profile = config.profiles[profileID];
if (!profile) {
terminal.writeln(`Profile not found: ${profileID}`);
Expand Down
19 changes: 19 additions & 0 deletions website/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<html>
<head>
<title>Tweety</title>
<style>
body {
margin: 0;
}
iframe {
width: 100%;
height: 100%;
border: none;
}
</style>
</head>
<body>
<iframe src="http://localhost:9999"></iframe>
</body>
</html>
,

0 comments on commit 626afdd

Please sign in to comment.