Skip to content
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

feat: add new ruleset grammar #490

Merged
merged 36 commits into from
Jun 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
3210434
implement new grammar
iorate May 12, 2024
5aa69d0
trivial change of grammar
iorate May 14, 2024
8cbfebf
rewrite match pattern
iorate May 25, 2024
f82d401
update grammar
iorate May 25, 2024
588b61b
minor refactoring of match pattern
iorate May 25, 2024
24406bf
rename MatchPatternBatch to MatchPatternSet
iorate May 25, 2024
1df1e7e
rename MatchPatternBatch to MatchPatternSet
iorate May 25, 2024
2d241aa
implement ruleset
iorate May 26, 2024
4ae0a94
minor refactoring
iorate Jun 1, 2024
1f1a694
allow dollar sign in identifier
iorate Jun 1, 2024
093a598
add props
iorate Jun 2, 2024
16769fd
update third party notices
iorate Jun 2, 2024
845ffcd
set scheme/host/path in InteractiveRuleset
iorate Jun 3, 2024
9b69727
$ can be used only at beginning of identifier
iorate Jun 3, 2024
c66117e
fix precedence of !
iorate Jun 3, 2024
12a8b43
refactor grammar
iorate Jun 4, 2024
7b3b818
remove octal escape sequences
iorate Jun 4, 2024
7ed6b1f
rename $engine to $site
iorate Jun 6, 2024
6c4de1a
read names from metadata of subscriptions
iorate Jun 8, 2024
00338db
add kagi support
iorate Jun 9, 2024
8417f07
change regexp match operator: "=~" -> "~="
iorate Jun 9, 2024
ac5007a
change grammar of identifier
iorate Jun 10, 2024
1e3cb1a
fix: add URL parts when creating patch
iorate Jun 10, 2024
09afc68
update grammar
iorate Jun 10, 2024
76c9087
add documents for expressions
iorate Jun 10, 2024
0122e9f
add documents for YAML frontmatter
iorate Jun 10, 2024
0e4d1a7
<all_urls> is supported
iorate Jun 10, 2024
80d2aef
<all_urls> is supported
iorate Jun 10, 2024
d832464
expression including undefine properties return false
iorate Jun 10, 2024
c64d08c
minor refactoring
iorate Jun 10, 2024
1530a69
remove description about name in subscription URL
iorate Jun 10, 2024
43ce7d2
move link to subscriptions page
iorate Jun 10, 2024
984e992
fix typo
iorate Jun 11, 2024
21d5b81
minor refactoring
iorate Jun 12, 2024
74d8f86
remove compiledRules from subscriptions
iorate Jun 15, 2024
c6e522d
ddg: add props to news card in web search
iorate Jun 15, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,23 @@ This extension is available in the below search engines.
To publish a ruleset as a subscription, place a ruleset file encoded in UTF-8 on a suitable HTTP(S) server, and publish the URL. Here is an example hosted on GitHub:<br>
https://raw.githubusercontent.com/iorate/ublacklist-example-subscription/master/uBlacklist.txt

In uBlacklist >=6.6.0 for _Chrome_, subscription links are available. To add a subscription with `name` and `url`, the following URL can be used as a shortcut to the options page:
You can prepend YAML frontmatter to your ruleset. It is recommended that you set the `name` variable.

```
https://iorate.github.io/ublacklist/subscribe?name={urlEncode(name)}&url={urlEncode(url)}
---
name: Your ruleset name
---
*://*.example.com/*
```

In uBlacklist >=6.6.0 for _Chrome_, subscription links are available. To add a subscription with `url`, the following URL can be used as a shortcut to the options page:

```
https://iorate.github.io/ublacklist/subscribe?url={urlEncode(url)}
```

For the above example:<br>
https://iorate.github.io/ublacklist/subscribe?name=Example&url=https%3A%2F%2Fraw.githubusercontent.com%2Fiorate%2Fublacklist-example-subscription%2Fmaster%2FuBlacklist.txt
https://iorate.github.io/ublacklist/subscribe?url=https%3A%2F%2Fraw.githubusercontent.com%2Fiorate%2Fublacklist-example-subscription%2Fmaster%2FuBlacklist.txt

## For developers

Expand Down
2 changes: 1 addition & 1 deletion biome.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
"files": {
"ignore": ["**/package.json"]
"ignore": ["**/package.json", "**/parser.js"]
},
"vcs": {
"enabled": true,
Expand Down
9 changes: 8 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,20 @@
"version": "0.0.0",
"dependencies": {
"@codemirror/commands": "^6.5.0",
"@codemirror/lang-yaml": "^6.1.1",
"@codemirror/language": "^6.10.1",
"@codemirror/lint": "^6.7.0",
"@codemirror/state": "^6.4.1",
"@codemirror/view": "^6.26.3",
"@lezer/common": "^1.2.1",
"@lezer/highlight": "^1.2.0",
"@lezer/lr": "^1.4.0",
"@mdi/svg": "^7.4.47",
"colord": "^2.9.3",
"dayjs": "^1.11.11",
"goober": "2.1.10",
"is-mobile": "^4.0.0",
"js-yaml": "^4.1.0",
"punycode": "^2.3.1",
"react": "^18.3.1",
"react-colorful": "^5.6.1",
Expand All @@ -21,7 +26,9 @@
},
"devDependencies": {
"@biomejs/biome": "^1.7.3",
"@lezer/generator": "^1.7.0",
"@types/fs-extra": "^11.0.4",
"@types/js-yaml": "^4.0.9",
"@types/license-checker": "^25.0.6",
"@types/node": "^20.12.8",
"@types/punycode": "^2.1.4",
Expand Down Expand Up @@ -56,8 +63,8 @@
"fix": "pnpm run /^fix:/",
"fix:biome": "biome check --apply .",
"fix:prettier": "prettier --write .",
"generate-ruleset-parser": "lezer-generator src/scripts/ruleset/ruleset.grammar -o src/scripts/ruleset/parser.js --noTerms",
"generate-third-party-notices": "tsx scripts/generate-third-party-notices.ts",
"postinstall": "pnpm generate-third-party-notices",
"test": "tsx scripts/test.ts"
},
"type": "module",
Expand Down
87 changes: 87 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion scripts/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ async function createBuildScripts(
bundle: true,
define: defineProcessEnv(context),
entryPoints: sources.map((file) => path.join(srcDir, file)),
format: "esm",
format: "iife",
jsx: "automatic",
jsxDev: debug,
// https://github.com/evanw/esbuild/issues/3418
Expand Down
8 changes: 8 additions & 0 deletions src/_locales/en/messages.json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -344,12 +344,20 @@ export default exportAsMessages({
// The title of the add-subscription dialog.
options_addSubscriptionDialog_title: "Add a subscription",

// UNUSED
// The label for the name input on the add-subscription dialog.
options_addSubscriptionDialog_nameLabel: "Name",

// The label for the URL input on the add-subscription dialog.
options_addSubscriptionDialog_urlLabel: "URL",

// The label for the alternative name input on the add-subscription dialog.
options_addSubscriptionDialog_altNameLabel: "Alternative name (optional)",

// The helper text for the alternative name input on the add-subscription dialog.
options_addSubscriptionDialog_altNameDescription:
"The alternative name used when a downloaded ruleset does not contain a name.",

// The text of the add button on the add-subscription dialog.
options_addSubscriptionDialog_addButton: "Add",

Expand Down
3 changes: 3 additions & 0 deletions src/_locales/ja/messages.json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@ export default exportAsMessages({
options_addSubscriptionDialog_title: "購読を追加する",
options_addSubscriptionDialog_nameLabel: "名前",
options_addSubscriptionDialog_urlLabel: "URL",
options_addSubscriptionDialog_altNameLabel: "代替の名前 (オプション)",
options_addSubscriptionDialog_altNameDescription:
"ダウンロードしたルールセットに名前が含まれないときに、代わりに使用される名前です。",
options_addSubscriptionDialog_addButton: "追加",
options_showSubscriptionDialog_blacklistLabel: "ルールのリスト",
options_updateInterval: "更新の間隔",
Expand Down
2 changes: 2 additions & 0 deletions src/common/locales.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ export type MessageName =
| "options_addSubscriptionDialog_title"
| "options_addSubscriptionDialog_nameLabel"
| "options_addSubscriptionDialog_urlLabel"
| "options_addSubscriptionDialog_altNameLabel"
| "options_addSubscriptionDialog_altNameDescription"
| "options_addSubscriptionDialog_addButton"
| "options_showSubscriptionDialog_blacklistLabel"
| "options_updateInterval"
Expand Down
Loading
Loading