From dfee2c2ca728b72063c80e7771456fbcfdaee7f1 Mon Sep 17 00:00:00 2001 From: Mariotaku Date: Tue, 18 Jun 2024 23:37:19 +0900 Subject: [PATCH] better descriptions --- package-lock.json | 8 +++--- package.json | 2 +- src/views/can-i-root/app.ts | 52 ++++++++++++++++++++++++++++--------- 3 files changed, 45 insertions(+), 17 deletions(-) diff --git a/package-lock.json b/package-lock.json index 9a04f96..322b1e7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,7 +11,7 @@ "dependencies": { "@fontsource/orbitron": "^5.0.19", "@popperjs/core": "^2.11.8", - "@webosbrew/caniroot": "^1.0.2", + "@webosbrew/caniroot": "^1.0.3", "bootstrap": "^5.3.3", "bootstrap-icons": "^1.11.3", "gsap": "^3.12.5", @@ -1139,9 +1139,9 @@ } }, "node_modules/@webosbrew/caniroot": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@webosbrew/caniroot/-/caniroot-1.0.2.tgz", - "integrity": "sha512-EEr0/WxdPZT6u3RWVwbR/gQzb3xfn4YpLzIoD+k1zftW3XVBNoN/TGjp6m8/nA8j6jZT8/w2ZtQoQJ4yyf9/rA==" + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@webosbrew/caniroot/-/caniroot-1.0.3.tgz", + "integrity": "sha512-J8eNMdgpFlgND+46OH+GlZbCsaUAQgfVp757BrUTPxOBy8zGry0SiI92xntYleSyKFuraBB7tL1E0g/DNazFvw==" }, "node_modules/@webpack-cli/configtest": { "version": "2.1.1", diff --git a/package.json b/package.json index 8c417fb..99970cd 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "dependencies": { "@fontsource/orbitron": "^5.0.19", "@popperjs/core": "^2.11.8", - "@webosbrew/caniroot": "^1.0.2", + "@webosbrew/caniroot": "^1.0.3", "bootstrap": "^5.3.3", "bootstrap-icons": "^1.11.3", "gsap": "^3.12.5", diff --git a/src/views/can-i-root/app.ts b/src/views/can-i-root/app.ts index ab04bd2..49342a7 100644 --- a/src/views/can-i-root/app.ts +++ b/src/views/can-i-root/app.ts @@ -23,7 +23,7 @@ interface SearchTerm { function parseSearchTerm(q?: string): SearchTerm | undefined { if (!q) return undefined; - const model = q.match(/[A-Z0-9-]{4,12}(?:\.[A-Z0-9]{2,4})?/)?.[0]; + const model = q.match(/[A-Z0-9-]{4,12}(?:\.[A-Z0-9]{2,4})?/)?.[0]?.toUpperCase(); const firmware = q.match(/\d{2}\.\d{2}\.\d{2}/)?.[0]; return {q, model, firmware}; } @@ -31,17 +31,17 @@ function parseSearchTerm(q?: string): SearchTerm | undefined { interface ExploitMethod { name: string; key: keyof DeviceExploitAvailabilities; + url:string; expert?: boolean; } class App extends Component { readonly exploits: ExploitMethod[] = [ - {name: 'DejaVuln', key: 'dejavuln'}, - {name: 'crashd', key: 'crashd'}, - {name: 'WTA', key: 'wta'}, - {name: 'rootmytv', key: 'rootmytv'}, - {name: 'NVM', key: 'nvm', expert: true}, + {name: 'DejaVuln', key: 'dejavuln', url: 'https://github.com/throwaway96/dejavuln-autoroot'}, + {name: 'crashd', key: 'crashd', url: 'https://gist.github.com/throwaway96/e811b0f7cc2a705a5a476a8dfa45e09f'}, + {name: 'WTA', key: 'wta', url: 'https://gist.github.com/throwaway96/b171240ef59d7f5fd6fb48fc6dfd2941'}, + {name: 'RootMy.TV', key: 'rootmytv', url: 'https://rootmy.tv/'}, ]; constructor(props: AppProps) { @@ -60,6 +60,11 @@ class App extends Component { let model = term && DeviceModel.findModel(term.model ?? ''); let availability = model && DeviceExploitAvailabilities.byOTAID(model.otaId); this.setState({term, model, availability}); + const url = new URL(location.href); + if (url.searchParams) { + url.searchParams.set('q', q); + history.pushState(null, '', url); + } }, 300); render(_props: RenderableProps, state: Readonly) { @@ -70,7 +75,7 @@ class App extends Component { onInput=${(e: TargetedInputEvent) => this.searchChanged(e.currentTarget.value)}/> ${state.term && (state.model ? html` -