Skip to content

Commit 3772564

Browse files
juniorbutyeahjuniorbutyeah
andauthored
Remove unused files, drop prettier, fix biome issues (#303)
* Remove unused files, drop prettier, fix biome issues * Revert accidental bundle formatting --------- Co-authored-by: juniorbutyeah <juniorbutyeah@github.com>
1 parent 0d141c1 commit 3772564

19 files changed

Lines changed: 5648 additions & 171 deletions

File tree

.github/workflows/biome.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
- name: Setup Biome
2020
uses: biomejs/setup-biome@v2
2121
with:
22-
version: 1.9.4
22+
version: 2.3.9
2323

2424
- name: Run Biome
25-
run: biome ci .
25+
run: biome check .

.prettierignore

Lines changed: 0 additions & 18 deletions
This file was deleted.

biome.json

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"$schema": "https://biomejs.dev/schemas/2.3.9/schema.json",
33
"files": {
44
"ignoreUnknown": true,
5-
"includes": ["**", "!**/src/global.css", "!**/.astro"]
5+
"includes": ["**", "!**/src/global.css", "!**/.astro", "!**/dist", "!**/public/assets"]
66
},
77
"assist": { "actions": { "source": { "organizeImports": "on" } } },
88
"linter": {
@@ -46,6 +46,16 @@
4646
}
4747
}
4848
}
49+
},
50+
{
51+
"includes": ["index.ts"],
52+
"linter": {
53+
"rules": {
54+
"suspicious": {
55+
"noExplicitAny": "off"
56+
}
57+
}
58+
}
4959
}
5060
]
5161
}

index.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,14 @@ import path from "node:path";
88
import zlib from "node:zlib";
99

1010
EventEmitter.defaultMaxListeners = 50;
11+
1112
import fastifyMiddie from "@fastify/middie";
1213
import fastifyStatic from "@fastify/static";
1314
import { server as wisp } from "@mercuryworkshop/wisp-js/server";
1415
import { build } from "astro";
1516
import Fastify from "fastify";
1617
import INConfig from "./config";
17-
import { generateMaps, getClientScript, type ObfuscationMaps, transformCss, transformHtml, transformJs, ROUTES, ASSET_FOLDERS } from "./src/lib/obfuscate";
18+
import { ASSET_FOLDERS, generateMaps, getClientScript, type ObfuscationMaps, ROUTES, transformCss, transformHtml, transformJs } from "./src/lib/obfuscate";
1819

1920
let obfuscationMaps: ObfuscationMaps | null = null;
2021

@@ -107,12 +108,13 @@ async function Start() {
107108
if (req.headers) {
108109
req.headers["accept-encoding"] = "identity";
109110
}
110-
if ((req.raw as { headers?: Record<string, string> }).headers) {
111-
(req.raw as { headers?: Record<string, string> }).headers!["accept-encoding"] = "identity";
111+
const rawHeaders = (req.raw as { headers?: Record<string, string> }).headers;
112+
if (rawHeaders) {
113+
rawHeaders["accept-encoding"] = "identity";
112114
}
113115

114116
const [urlPath, query] = req.url.split("?");
115-
let pathParts = urlPath.split("/").filter(Boolean);
117+
const pathParts = urlPath.split("/").filter(Boolean);
116118
let modified = false;
117119

118120
if (pathParts.length > 0) {
@@ -213,10 +215,7 @@ self.addEventListener("fetch", (event) => {
213215
);
214216
});
215217
`;
216-
reply
217-
.header("Service-Worker-Allowed", "/")
218-
.type("application/javascript")
219-
.send(swCode);
218+
reply.header("Service-Worker-Allowed", "/").type("application/javascript").send(swCode);
220219
});
221220

222221
app.get(`/assets/${scramjetFolder}/*`, (req, reply) => {

package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"astro": "astro",
1313
"disable": "bunx astro telemetry disable",
1414
"precommit": "bun run typecheck && bun run check",
15-
"check": "prettier --write . && biome check --write ."
15+
"check": "biome check --write ."
1616
},
1717
"dependencies": {
1818
"@astrojs/check": "^0.9.6",
@@ -50,8 +50,6 @@
5050
"@types/react-dom": "19.2.3",
5151
"autoprefixer": "^10.4.23",
5252
"postcss": "^8",
53-
"prettier": "^3.4.2",
54-
"prettier-plugin-astro": "^0.14.1",
5553
"tailwindcss": "^3.4.19"
5654
},
5755
"overrides": {

prettier.config.js

Lines changed: 0 additions & 18 deletions
This file was deleted.

public/assets/scramjet/scramjet.all.js

Lines changed: 5568 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/assets/scramjet/scramjet.sync.js

Lines changed: 39 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/components/Browser.tsx

Lines changed: 11 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,11 @@
11
import { ChevronLeft, ChevronRight, Home, Lock, Maximize2, Plus, RotateCw, Star, X } from "lucide-react";
2-
import { useEffect, useMemo, useRef, useState } from "react";
2+
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
33
import { actionBarClass, addressInputClass, classNames, closeButtonClass, encodeProxyUrl, formatUrl, getActualUrl, getDefaultUrl, iconButtonClass, type Tab, tabButtonClass } from "@/lib/tabs";
44

55
type ScramjetWindow = Window & { __scramjet$config?: unknown };
66

77
const IconButton = ({ onClick, icon: Icon, className = "", disabled = false, title = "" }: { onClick?: () => void; icon: React.ComponentType<{ className?: string }>; className?: string; disabled?: boolean; title?: string }) => (
8-
<button
9-
type="button"
10-
onClick={onClick}
11-
disabled={disabled}
12-
title={title}
13-
className={classNames(iconButtonClass, "disabled:opacity-30 disabled:cursor-not-allowed", className)}
14-
>
8+
<button type="button" onClick={onClick} disabled={disabled} title={title} className={classNames(iconButtonClass, "disabled:opacity-30 disabled:cursor-not-allowed", className)}>
159
<Icon className="h-4 w-4" />
1610
</button>
1711
);
@@ -21,15 +15,15 @@ export default function Browser() {
2115
const [url, setUrl] = useState("about:blank");
2216
const [favicons, setFavicons] = useState<Record<number, string>>({});
2317
const [bookmarks, setBookmarks] = useState<Array<{ Title: string; url: string; favicon?: string }>>([]);
24-
const [proxyReadyTick, setProxyReadyTick] = useState(0);
18+
const [_proxyReadyTick, setProxyReadyTick] = useState(0);
2519
const [proxyReady, setProxyReady] = useState(false);
2620
const activeTab = useMemo(() => tabs.find((tab) => tab.active), [tabs]);
2721
const iframeRefs = useRef<Record<number, HTMLIFrameElement | null>>({});
2822

29-
const openInNewTab = (url: string) => {
23+
const openInNewTab = useCallback((url: string) => {
3024
const newId = Date.now();
3125
setTabs((prev) => [...prev.map((t) => ({ ...t, active: false })), { id: newId, title: "New Tab", url, active: true, reloadKey: 0 }]);
32-
};
26+
}, []);
3327

3428
useEffect(() => {
3529
let firstTabUrl = getDefaultUrl();
@@ -82,7 +76,7 @@ export default function Browser() {
8276
cancelled = true;
8377
window.clearInterval(timer);
8478
};
85-
}, [proxyReadyTick]);
79+
}, []);
8680

8781
useEffect(() => {
8882
if (!activeTab) return;
@@ -97,7 +91,7 @@ export default function Browser() {
9791
if (url === "about:blank" && activeTab.url !== "about:blank") {
9892
setUrl(activeTab.url);
9993
}
100-
}, [activeTab, url, proxyReadyTick]);
94+
}, [activeTab, url]);
10195

10296
useEffect(() => {
10397
if (!activeTab) return;
@@ -281,7 +275,7 @@ export default function Browser() {
281275
}
282276
} catch (_e) {}
283277
};
284-
}, [activeTab]);
278+
}, [activeTab, openInNewTab]);
285279

286280
useEffect(() => {
287281
const handleKeyDown = (e: KeyboardEvent) => {
@@ -416,17 +410,7 @@ export default function Browser() {
416410
<div className="flex h-screen flex-col bg-background">
417411
<div className="flex items-center gap-1 bg-background-secondary/50 px-2 py-1.5 border-b border-border/50">
418412
{tabs.map((tab) => (
419-
<button
420-
key={tab.id}
421-
type="button"
422-
onClick={() => setActiveTab(tab.id)}
423-
className={classNames(
424-
tabButtonClass,
425-
tab.active
426-
? "bg-background text-text border border-border/50"
427-
: "text-text-secondary hover:text-text hover:bg-white/5"
428-
)}
429-
>
413+
<button key={tab.id} type="button" onClick={() => setActiveTab(tab.id)} className={classNames(tabButtonClass, tab.active ? "bg-background text-text border border-border/50" : "text-text-secondary hover:text-text hover:bg-white/5")}>
430414
<div className="flex min-w-0 flex-1 items-center gap-2">
431415
{favicons[tab.id] ? (
432416
<img
@@ -455,12 +439,7 @@ export default function Browser() {
455439
</button>
456440
</button>
457441
))}
458-
<button
459-
type="button"
460-
className="inline-flex h-6 w-6 items-center justify-center rounded text-text-secondary hover:text-accent hover:bg-white/5 transition-all"
461-
onClick={addNewTab}
462-
aria-label="Add tab"
463-
>
442+
<button type="button" className="inline-flex h-6 w-6 items-center justify-center rounded text-text-secondary hover:text-accent hover:bg-white/5 transition-all" onClick={addNewTab} aria-label="Add tab">
464443
<Plus className="h-3.5 w-3.5" />
465444
</button>
466445
</div>
@@ -476,13 +455,7 @@ export default function Browser() {
476455
<div className="flex-1">
477456
<div className={actionBarClass}>
478457
<Lock className="h-3.5 w-3.5 text-text-placeholder" />
479-
<input
480-
className={addressInputClass}
481-
value={url}
482-
placeholder="Search or enter address"
483-
onChange={(e) => setUrl(e.target.value)}
484-
onKeyDown={(e) => e.key === "Enter" && handleNavigate(e.currentTarget.value)}
485-
/>
458+
<input className={addressInputClass} value={url} placeholder="Search or enter address" onChange={(e) => setUrl(e.target.value)} onKeyDown={(e) => e.key === "Enter" && handleNavigate(e.currentTarget.value)} />
486459
</div>
487460
</div>
488461

src/components/Obfuscated.astro

Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
 (0)