Skip to content

Commit f697563

Browse files
authored
Merge pull request #21 from Percslol/main
[chrome] more misc improvements
2 parents 66ff778 + c149ca6 commit f697563

File tree

14 files changed

+1744
-565
lines changed

14 files changed

+1744
-565
lines changed

CONTRIBUTING.md

Lines changed: 6 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,17 @@
11
# Development Setup
22

3-
Node.js 22+ and depot_tools are required for development
3+
Node.js 22+ and PNPM required for development
44

55
```bash
6-
update_depot_tools
7-
ensure_bootstrap
8-
git clone https://github.com/HeyPuter/browser.js --recursive
9-
cd browser.js
6+
git submodule update --init
107
pnpm i
11-
rustup update
12-
rustup install nightly
13-
rustup default nightly
14-
cargo install --git https://github.com/r58playz/wasm-snip
15-
cargo install wasm-bindgen-cli --version 0.2.100
16-
pnpm rewriter:build
17-
pnpm build
18-
cd dreamlandjs
19-
pnpm build
20-
cd ..
21-
cd chii
22-
pnpm init:front_end
23-
pnpm build
24-
cd ..
25-
cd playwright
26-
npm i
27-
npm run build
28-
cd web_builder
29-
npx rollup -c
30-
cd ../..
31-
cd chobitsu
32-
pnpm build
33-
cd ..
34-
cd page_inject
35-
npx rollup -c
36-
cd ..
37-
cd frontend
38-
pnpm vite build
8+
pnpm build:dreamland
9+
pnpm build (x2)
10+
pnpm dev
3911
```
4012

4113
# Incremental Build
4214

4315
```bash
44-
(cd playwright && npm run watch) &
45-
(cd playwright/web_builder && npx rollup -cw) &
46-
(pnpm dev) &
47-
(cd dreamlandjs && pnpm watch) &
48-
(cd chobitsu && pnpm webpack --watch --mode=development) &
49-
(cd page_inject && npx rollup -cw) &
50-
(cd frontend && pnpm dev) &
16+
pnpm dev
5117
```

devserver.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ const PAD_TOP = 1;
132132
const PAD_BOTTOM = 1;
133133

134134
function blackSpaces(count: number) {
135+
count = Math.abs(count);
135136
return black()(" ".repeat(count));
136137
}
137138

package.json

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,31 @@
22
"name": "browser.js",
33
"version": "1.0.0",
44
"description": "",
5+
"type": "module",
6+
"keywords": [],
7+
"author": "",
8+
"license": "AGPL-3.0-only",
9+
"packageManager": "[email protected]",
510
"scripts": {
11+
"build": "rspack build",
612
"build:dreamland": "cd external/dreamlandjs && pnpm build",
713
"build:chrome": "cd packages/chrome && pnpm build",
814
"dev": "node --no-warnings=ExperimentalWarning devserver.ts",
9-
"build": "rspack build",
1015
"watch": "rspack build --watch",
1116
"format": "prettier --write ."
1217
},
13-
"type": "module",
14-
"keywords": [],
15-
"author": "",
16-
"license": "AGPL-3.0-only",
17-
"packageManager": "[email protected]",
1818
"devDependencies": {
19-
"@mercuryworkshop/wisp-js": "^0.3.3",
20-
"@rsdoctor/rspack-plugin": "^1.2.3",
21-
"@rslib/core": "^0.13.3",
22-
"@rspack/cli": "^1.5.6",
23-
"@rspack/core": "^1.5.6",
19+
"@mercuryworkshop/wisp-js": "^0.4.0",
20+
"@rsdoctor/rspack-plugin": "^1.3.6",
21+
"@rslib/core": "^0.16.1",
22+
"@rspack/cli": "^1.5.8",
23+
"@rspack/core": "^1.5.8",
2424
"bufferutil": "^4.0.9",
2525
"chafa-wasm": "^0.3.1",
2626
"chalk": "^5.6.2",
2727
"server": "link:@mercuryworkshop/wisp-js/server",
28-
"ts-checker-rspack-plugin": "^1.1.5",
29-
"vite": "^7.1.11"
28+
"ts-checker-rspack-plugin": "^1.1.6",
29+
"vite": "^7.1.12"
3030
},
3131
"dependencies": {
3232
"prettier": "^3.6.2"

packages/chrome/package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,13 @@
99
"preview": "vite preview"
1010
},
1111
"devDependencies": {
12-
"typescript": "~5.8.3",
13-
"vite": "^6.3.5"
12+
"typescript": "~5.9.3",
13+
"vite": "^7.1.12"
1414
},
1515
"dependencies": {
1616
"@iconify/types": "^2.0.0",
1717
"@ktibow/iconset-ion": "^8.0.13",
18+
"@heyputer/puter.js": "^2.1.2",
1819
"@mercuryworkshop/bare-mux-custom": "workspace:*",
1920
"@mercuryworkshop/epoxy-transport": "workspace:*",
2021
"@mercuryworkshop/libcurl-transport": "workspace:*",
@@ -25,7 +26,7 @@
2526
"html-to-image": "^1.11.13",
2627
"html2canvas": "^1.4.1",
2728
"htmlparser2": "^10.0.0",
28-
"monaco-editor": "^0.52.2",
29+
"monaco-editor": "^0.54.0",
2930
"tldts": "^7.0.11",
3031
"vite-plugin-singlefile": "^2.3.0",
3132
"vite-plugin-static-copy": "^3.1.0"

packages/chrome/src/Browser.tsx

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { createDelegate } from "dreamland/core";
55
import type { SerializedHistoryState } from "./History";
66
import { HistoryState } from "./History";
77
import { focusOmnibox } from "./components/Omnibar/Omnibox";
8+
import { type AVAILABLE_SEARCH_ENGINES } from "./components/Omnibar/suggestions";
89

910
import * as tldts from "tldts";
1011
import { isPuter } from "./main";
@@ -62,13 +63,7 @@ export type Settings = {
6263
startupPage: "new-tab" | "continue";
6364
defaultZoom: number;
6465
showBookmarksBar: boolean;
65-
defaultSearchEngine:
66-
| "google"
67-
| "bing"
68-
| "duckduckgo"
69-
| "yahoo"
70-
| "ecosia"
71-
| "startpage";
66+
defaultSearchEngine: keyof typeof AVAILABLE_SEARCH_ENGINES;
7267
searchSuggestionsEnabled: boolean;
7368
blockTrackers: boolean;
7469
clearHistoryOnExit: boolean;

packages/chrome/src/components/BookmarksStrip.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,16 @@ export function BookmarksStrip(props: {}, cx: ComponentContext) {
2525
<button
2626
on:click={(e: MouseEvent) => {
2727
let b = createState<BookmarkEntry>({
28-
url: "",
29-
title: "New Bookmark",
28+
url: browser.activetab.url.toString(),
29+
title: browser.activetab.title || "Unknown",
30+
favicon: browser.activetab.icon,
3031
});
3132
createMenuCustom(
3233
{
3334
left: e.clientX,
3435
top: e.clientY,
3536
},
36-
<BookmarkPopup bookmark={b} new={false} />
37+
<BookmarkPopup bookmark={b} new={true} />
3738
);
3839
}}
3940
>

packages/chrome/src/components/Omnibar/suggestions.ts

Lines changed: 41 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export interface SearchEngine {
2323
}
2424

2525
/** Available search engines */
26-
export const AVAILABLE_SEARCH_ENGINES: Record<string, SearchEngine> = {
26+
export const AVAILABLE_SEARCH_ENGINES = {
2727
google: {
2828
name: "Google",
2929
searchUrlBuilder: (query) =>
@@ -37,6 +37,45 @@ export const AVAILABLE_SEARCH_ENGINES: Record<string, SearchEngine> = {
3737
return [];
3838
},
3939
},
40+
bing: {
41+
name: "Microsoft Bing",
42+
searchUrlBuilder: (query) =>
43+
`https://www.bing.com/search?q=${encodeURIComponent(query)}`,
44+
suggestUrlBuilder: (query) =>
45+
`https://www.bing.com/osjson.aspx?query=${encodeURIComponent(query)}`,
46+
suggestionParser: (data) => {
47+
if (Array.isArray(data) && data.length > 1 && Array.isArray(data[1])) {
48+
return data[1].map((item: any) => String(item)).filter(Boolean);
49+
}
50+
return [];
51+
},
52+
},
53+
yahoo: {
54+
name: "Yahoo!",
55+
searchUrlBuilder: (query) =>
56+
`https://search.yahoo.com/search?q=${encodeURIComponent(query)}`,
57+
suggestUrlBuilder: (query) =>
58+
`https://search.yahoo.com/sugg/chrome?output=fxjson&appid=crmas_sfp&command=${encodeURIComponent(query)}`,
59+
suggestionParser: (data) => {
60+
if (Array.isArray(data) && data.length > 1 && Array.isArray(data[1])) {
61+
return data[1].map((item: any) => String(item)).filter(Boolean);
62+
}
63+
return [];
64+
},
65+
},
66+
duckduckgo: {
67+
name: "DuckDuckGo",
68+
searchUrlBuilder: (query) =>
69+
`https://duckduckgo.com/?q=${encodeURIComponent(query)}`,
70+
suggestUrlBuilder: (query) =>
71+
`https://duckduckgo.com/ac/?q=${encodeURIComponent(query)}&type=list`,
72+
suggestionParser: (data) => {
73+
if (Array.isArray(data) && data.length > 1 && Array.isArray(data[1])) {
74+
return data[1].map((item: any) => String(item)).filter(Boolean);
75+
}
76+
return [];
77+
},
78+
},
4079
brave: {
4180
name: "Brave",
4281
searchUrlBuilder: (query) =>
@@ -46,7 +85,6 @@ export const AVAILABLE_SEARCH_ENGINES: Record<string, SearchEngine> = {
4685
suggestionParser: (data) => {
4786
// Google format
4887
if (Array.isArray(data) && data.length > 1 && Array.isArray(data[1])) {
49-
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
5088
return data[1].map((item: any) => String(item)).filter(Boolean);
5189
}
5290
// Brave Format
@@ -60,7 +98,7 @@ export const AVAILABLE_SEARCH_ENGINES: Record<string, SearchEngine> = {
6098
return [];
6199
},
62100
},
63-
};
101+
} as const satisfies Record<string, SearchEngine>;
64102

65103
function calculateRelevanceScore(result: OmniboxResult, query: string): number {
66104
if (!query) return 0;

packages/scramjet/package.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@
77
"author": "Mercury Workshop",
88
"license": "AGPL-3.0-only",
99
"packageManager": "[email protected]",
10+
"scripts": {},
1011
"devDependencies": {
11-
"@rsdoctor/rspack-plugin": "^1.2.3",
12-
"@rslib/core": "^0.13.2",
13-
"@rspack/cli": "^1.5.3",
14-
"@rspack/core": "^1.5.3"
12+
"@rsdoctor/rspack-plugin": "^1.3.6",
13+
"@rslib/core": "^0.16.1",
14+
"@rspack/cli": "^1.5.8",
15+
"@rspack/core": "^1.5.8"
1516
},
1617
"dependencies": {
1718
"prettier": "^3.6.2"

packages/scramjet/packages/core/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
"@mercuryworkshop/bare-as-module3": "^2.2.5",
7171
"@mercuryworkshop/epoxy-transport": "^2.1.28",
7272
"@mercuryworkshop/libcurl-transport": "^1.5.0",
73-
"@mercuryworkshop/wisp-js": "^0.3.3",
73+
"@mercuryworkshop/wisp-js": "^0.4.0",
7474
"@nebula-services/bare-server-node": "^2.0.4",
7575
"@playwright/test": "^1.55.0",
7676
"@reside-ic/typedoc-plugin-copy-doc": "^1.1.2",
@@ -79,7 +79,7 @@
7979
"@types/eslint": "^9.6.1",
8080
"@types/estree": "^1.0.8",
8181
"@types/node": "^24.3.1",
82-
"@types/serviceworker": "^0.0.152",
82+
"@types/serviceworker": "^0.0.160",
8383
"@typescript-eslint/eslint-plugin": "^8.43.0",
8484
"@typescript-eslint/parser": "^8.43.0",
8585
"actionlint": "^2.0.6",
@@ -102,7 +102,7 @@
102102
"typedoc": "^0.28.12",
103103
"typedoc-material-theme": "^1.4.0",
104104
"typedoc-plugin-frontmatter": "^1.3.0",
105-
"typedoc-plugin-include-example": "^2.1.2",
105+
"typedoc-plugin-include-example": "^3.0.2",
106106
"typedoc-plugin-markdown": "^4.8.1",
107107
"typedoc-plugin-mdn-links": "^5.0.9",
108108
"typescript": "^5.9.2"
@@ -111,7 +111,7 @@
111111
"dom-serializer": "^2.0.0",
112112
"domhandler": "^5.0.3",
113113
"domutils": "^3.2.2",
114-
"htmlparser2": "10.0.0",
114+
"htmlparser2": "^10.0.0",
115115
"idb": "^8.0.3",
116116
"parse-domain": "^8.2.2",
117117
"set-cookie-parser": "^2.7.1"
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
{
22
"name": "@mercuryworkshop/epoxy-transport",
3-
"version": "2.0.0",
4-
"description": "a bare transport that implements end-to-end encryption with libcurl.js and wisp",
5-
"author": "ading2210",
6-
"license": "AGPL-3.0-only",
3+
"version": "2.1.28",
4+
"description": "a bare transport that implements end-to-end encryption with epoxy-tls and wisp",
75
"type": "module",
6+
"main": "index.ts",
7+
"keywords": [],
8+
"author": "r58playz",
9+
"license": "AGPL-3.0-only",
810
"scripts": {
911
"build": "node esbuild.bundle.mjs; cp dist/index.cjs dist/index.js",
1012
"prepack": "npm run build"
1113
},
1214
"dependencies": {
1315
"@mercuryworkshop/bare-mux-custom": "workspace:*",
14-
"@mercuryworkshop/epoxy-tls": "2.1.18-1",
15-
"libcurl.js": "^0.7.1"
16-
},
17-
"main": "index.ts"
16+
"@mercuryworkshop/epoxy-tls": "2.1.18-1"
17+
}
1818
}

0 commit comments

Comments
 (0)