-
Notifications
You must be signed in to change notification settings - Fork 5
Redesign repo structure and get domains list from multiple sources #44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 8 commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
3eb385d
refactor: design monorepos
piquark6046 1b9724c
ci: fix ESLint chain
piquark6046 2973ddc
ci: expand ESLint checking to all Typescript files
piquark6046 f2bf1af
refactor: split IAB sellers downloader
piquark6046 0173bdb
refactor: update pacakge.json in `builder`
piquark6046 b7c2fd8
fix: `baseUrl` in `tsconfig.json` leads fatal of `tsx` execution
piquark6046 45468db
chore: add http-server utils
piquark6046 e4dcb6a
chore: update .gitignore and package.json for new monorepo structure
piquark6046 f2532bd
Potential fix for code scanning alert no. 4: Uncontrolled data used i…
piquark6046 f6f448f
chore: follow PascalCase
piquark6046 785d139
Potential fix for code scanning alert no. 9: Uncontrolled data used i…
piquark6046 57f8f26
feat: add `IndexAdShieldDomainsFromAG` func to refer AG Base filters …
piquark6046 5d8fdcf
feat: add checking func to discard all CDN domains owned by Ad-Shield
piquark6046 0b7640a
feat: add `IndexAdShieldDomainsFromUBO` func to refer uBO filters list
piquark6046 c0bf75c
feat: add `FetchAdShieldDomains` func to refer AG Base and uBO filter…
piquark6046 b253d9b
chore: remove unnecessary import
piquark6046 4be8bd9
ci: run ESLint workflow for all branches
piquark6046 5a5ad11
chore: rename `FetchAdShieldDomainsFromFiltersLists`
piquark6046 79f1ab5
feat: add `FetchAdShieldDomains` func to refer all references
piquark6046 5dab3b1
feat: provide `CustomDefinedMatches` Set
piquark6046 b1c9c84
feat: add building cache for caching remote domains
piquark6046 9fb4d9f
feat: create `CreateBanner` func
piquark6046 33f3ae6
fix: path is not resolved correctly if `npm run` is used
piquark6046 3b37419
feat: use new builder
piquark6046 4f8b980
chore: add `SubscriptionUrl` customization for debugging
piquark6046 efef1c4
fix: chokidar does not built-in glob support
piquark6046 b12ec19
fix: typo
piquark6046 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| node_modules | ||
| dist | ||
| sources/src/#generated-*.ts | ||
| sources/src/#generated-*.ts | ||
| .buildcache |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| { | ||
| "name": "@filteringdev/tinyshield-builder", | ||
| "private": true, | ||
| "type": "module", | ||
| "scripts": { | ||
| "lint": "tsc --noEmit && eslint **/*.ts", | ||
| "build": "tsx source/build.ts", | ||
| "debug": "tsx source/debug.ts", | ||
| "cache": "tsx source/cache.ts", | ||
| "clean": "rm -rf dist && rm -rf .buildcache" | ||
| }, | ||
| "dependencies": { | ||
| "@types/node": "^24.10.8" | ||
| }, | ||
| "devDependencies": { | ||
| "@adguard/agtree": "^3.4.3", | ||
| "@npmcli/package-json": "^7.0.4", | ||
| "@types/npmcli__package-json": "^4.0.4", | ||
| "@types/semver": "^7.7.1", | ||
| "@typescriptprime/parsing": "^1.0.4", | ||
| "@typescriptprime/securereq": "^1.0.1", | ||
| "chokidar": "^5.0.0", | ||
| "esbuild": "^0.27.2", | ||
| "eslint": "^9.39.2", | ||
| "semver": "^7.7.3", | ||
| "tldts": "^7.0.19", | ||
| "tsx": "^4.21.0", | ||
| "typescript": "^5.9.3", | ||
| "typescript-eslint": "^8.53.0", | ||
| "zod": "^4.3.5" | ||
| } | ||
| } | ||
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,38 @@ | ||||||
| import * as Zod from 'zod' | ||||||
| import { HTTPSRequest } from '@typescriptprime/securereq' | ||||||
|
|
||||||
|
|
||||||
| const IABSellersJsonURL = 'https://info.ad-shield.io/sellers.json' | ||||||
|
|
||||||
| export async function FetchIABSellersJsonData(): Promise<string[]> { | ||||||
| const IABSellersJsonResponse: { StatusCode: number, Headers: Record<string, string | string[]>, Body: unknown } = await HTTPSRequest(new URL(IABSellersJsonURL), { ExpectedAs: 'JSON' }) | ||||||
| let IABSellersJsonData =IABSellersJsonResponse.Body as { | ||||||
|
||||||
| let IABSellersJsonData =IABSellersJsonResponse.Body as { | |
| let IABSellersJsonData = IABSellersJsonResponse.Body as { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| import * as HTTP from 'node:http' | ||
| import * as Fs from 'node:fs' | ||
|
|
||
| function IsLoopBack(IP: string) { | ||
| return IP === '127.0.0.1' || IP === '::1' || IP === '::ffff:127.0.0.1' | ||
| } | ||
|
|
||
| export function RunDebugServer(Port: number, FileName: string[], ShouldPreventHTTPResponse: boolean) { | ||
| const HTTPServer = HTTP.createServer((Req, Res) => { | ||
| if (!FileName.includes(Req.url?.substring(1) || '')) { | ||
| Res.writeHead(404) | ||
| Res.end() | ||
| return | ||
| } else if (!IsLoopBack(Req.socket.remoteAddress)) { | ||
| Res.writeHead(403) | ||
| Res.end() | ||
| return | ||
| } else if (ShouldPreventHTTPResponse || !Fs.existsSync(`${process.cwd()}/dist/${Req.url?.substring(1)}`)) { | ||
|
|
||
| Res.writeHead(503) | ||
| Res.end('File not built yet.') | ||
| return | ||
| } | ||
|
|
||
| const Content = Fs.readFileSync(`${process.cwd()}/dist/${Req.url?.substring(1)}`, 'utf-8') | ||
|
|
||
| Res.writeHead(200, { | ||
| 'content-type': 'application/javascript; charset=utf-8', | ||
| 'content-length': new TextEncoder().encode(Content).byteLength.toString() | ||
| }) | ||
| Res.end(Content) | ||
| }) | ||
|
|
||
| HTTPServer.listen(Port) | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| { | ||
| "extends": "../tsconfig.json", | ||
| "include": [ | ||
| "source/**/*.ts", | ||
| "test/**/*.ts" | ||
| ] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,7 +8,7 @@ | |
| "build:userscript": "tsx builder.ts -- production", | ||
| "build": "npm run build:interface && npm run build:userscript", | ||
| "debug": "tsx builder.ts -- development", | ||
| "lint": "tsc --noEmit && eslint sources/**/*.ts" | ||
| "lint": "npm run lint -w builder && npm run lint -w userscript" | ||
| }, | ||
| "keywords": [ | ||
| "Ad-Shield" | ||
|
|
@@ -28,20 +28,9 @@ | |
| "url": "git+https://github.com/FilteringDev/tinyShield.git" | ||
| }, | ||
| "license": "MPL-2.0", | ||
| "dependencies": { | ||
| "@types/node": "^24.9.2" | ||
| }, | ||
| "devDependencies": { | ||
| "@npmcli/package-json": "^7.0.4", | ||
| "@types/npmcli__package-json": "^4.0.4", | ||
| "@types/semver": "^7.7.1", | ||
| "esbuild": "^0.27.0", | ||
| "eslint": "^9.38.0", | ||
| "semver": "^7.7.3", | ||
| "tsx": "^4.21.0", | ||
| "typescript": "^5.9.3", | ||
| "typescript-eslint": "^8.46.2", | ||
| "zod": "^4.3.5" | ||
| }, | ||
| "packageManager": "[email protected]+" | ||
| "packageManager": "[email protected]+", | ||
| "workspaces": [ | ||
| "userscript", | ||
| "builder" | ||
| ] | ||
| } | ||
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| { | ||
| "name": "@filteringdev/tinyshield-userscript", | ||
| "private": true, | ||
| "type": "module", | ||
| "scripts": { | ||
| "lint": "tsc --noEmit && eslint **/*.ts" | ||
| }, | ||
| "devDependencies": { | ||
| "@types/web": "^0.0.317" | ||
| } | ||
| } |
File renamed without changes.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| { | ||
| "extends": "../tsconfig.json", | ||
| "include": [ | ||
| "source/**/*.ts" | ||
| ] | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The esbuild version 0.27.2 appears to be outdated. As of January 2025, esbuild was at version 0.24.x or higher. Consider updating to a more recent version.