Skip to content

Commit 77c07ea

Browse files
Merge pull request #227 from EhTagTranslation/feat/user-script
Feat/user script
2 parents 852d881 + 98e998c commit 77c07ea

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+3269
-5512
lines changed

.github/dependabot.yml

+10-11
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,14 @@
55

66
version: 2
77
updates:
8+
# Maintain dependencies for GitHub Actions
9+
- package-ecosystem: 'github-actions'
10+
directory: '/'
11+
schedule:
12+
interval: 'daily'
813

9-
# Maintain dependencies for GitHub Actions
10-
- package-ecosystem: "github-actions"
11-
directory: "/"
12-
schedule:
13-
interval: "daily"
14-
15-
# Maintain dependencies for npm
16-
- package-ecosystem: "npm"
17-
directory: "/"
18-
schedule:
19-
interval: "daily"
14+
# Maintain dependencies for npm
15+
- package-ecosystem: 'npm'
16+
directory: '/'
17+
schedule:
18+
interval: 'daily'

.github/workflows/build.yml

+11-9
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
name: build
22

33
on:
4-
- push
5-
- create
4+
push:
5+
create:
6+
pull_request:
67

78
jobs:
89
build:
@@ -15,19 +16,20 @@ jobs:
1516
node-version: 12
1617
- name: Install
1718
uses: bahmutov/npm-install@v1
18-
- name: update-db
19-
run: yarn update-db
2019
- name: yarn build
21-
run: yarn build
22-
- uses: actions/upload-artifact@master
20+
run: |
21+
yarn build:firefox
22+
yarn build:chrome
23+
yarn build:monkey
24+
- uses: actions/upload-artifact@v2
2325
with:
24-
name: EhSyringe
25-
path: release
26+
path: releases/*
2627
- name: publish to github release
2728
uses: ncipollo/release-action@v1
2829
if: github.event_name == 'create' && github.event.ref_type == 'tag'
2930
with:
3031
token: ${{ secrets.GITHUB_TOKEN }}
3132
body: |
3233
[更新日志](https://github.com/EhTagTranslation/EhSyringe/blob/master/CHANGELOG.md)
33-
artifacts: release/*
34+
artifacts: releases/*
35+
prerelease: ${{ contains(github.event.ref, '-') }}

.gitignore

+1-4
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@
22

33
# compiled output
44
/dist
5-
/artifacts
6-
/tmp
7-
/out-tsc
8-
/release
5+
/releases
96

107
# dependencies
118
/node_modules

.vscode/settings.json

+8-1
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,12 @@
1212
"[typescript]": {
1313
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
1414
},
15-
"typescript.tsdk": "node_modules\\typescript\\lib"
15+
"typescript.tsdk": "node_modules\\typescript\\lib",
16+
"json.schemas": [
17+
{
18+
"fileMatch": ["manifest.json"],
19+
"url": "http://json.schemastore.org/webextension"
20+
}
21+
],
22+
"cSpell.words": ["ehgt", "ehsyringe", "exhentai", "hentai", "omnibox", "typedi"]
1623
}

src/manifest.json manifest.json

+3-11
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
11
{
2-
"$schema": "http://json.schemastore.org/webextension",
32
"manifest_version": 2,
4-
"name": "${displayName}",
5-
"short_name": "${displayName}",
6-
"description": "${description}",
7-
"author": "${author}",
8-
"version": "${version}",
9-
"homepage_url": "${homepage}",
10-
"applications": {
3+
"__firefox__applications": {
114
"gecko": {
125
"id": "{759d5566-1dce-41ae-bae9-00dd5172c422}",
136
"strict_min_version": "57.0"
@@ -32,13 +25,12 @@
3225
"48": "assets/logo48.png",
3326
"128": "assets/logo128.png"
3427
},
35-
"default_title": "${displayName}",
36-
"default_popup": "template/popup.html"
28+
"default_popup": "assets/popup.html"
3729
},
3830
"content_scripts": [
3931
{
4032
"matches": ["*://exhentai.org/*", "*://e-hentai.org/*", "*://*.exhentai.org/*", "*://*.e-hentai.org/*"],
41-
"js": ["script/main.js"],
33+
"js": ["script/page.js"],
4234
"run_at": "document_start"
4335
}
4436
],

package.json

+30-17
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,22 @@
44
"version": "1.3.1",
55
"description": "E 站注射器,将中文翻译注入到 E 站体内。",
66
"author": "EhTagTranslation",
7-
"main": "syringe.js",
87
"scripts": {
9-
"start": "npm run dev:chrome",
10-
"dev:chrome": "webpack --mode=development --watch",
11-
"dev:firefox": "webpack --mode=development --watch --firefox",
12-
"dev:android": "webpack --mode=development --watch --android",
13-
"prebuild": "yarn clean",
14-
"build": "webpack --mode=production --pack && run-script-os ",
15-
"build:win32": "move release\\ehsyringe-*.zip release\\Ehsyringe.firefox.zip",
16-
"build:nix": "mv release/ehsyringe-*.zip release/Ehsyringe.firefox.zip",
8+
"prestart": "yarn clean",
9+
"start": "webpack --mode=development --watch",
10+
"start:ext": "yarn start --web-ext",
11+
"start:chrome": "yarn start:ext --vendor=chrome",
12+
"start:firefox": "yarn start:ext --vendor=firefox",
13+
"start:monkey": "yarn start --user-script",
14+
"build": "webpack --mode=production",
15+
"build:ext": "yarn build --web-ext",
16+
"build:chrome": "yarn build:ext --vendor=chrome && web-ext build -s dist -a releases -n ehsyringe.chrome.zip -o",
17+
"build:firefox": "yarn build:ext --vendor=firefox && web-ext build -s dist -a releases -n ehsyringe.firefox.zip -o",
18+
"build:monkey": "yarn build --user-script",
1719
"update-db": "node ./tools/update-db.js",
18-
"lint": "prettier --check . && eslint ./src/**/*.ts",
19-
"lint:fix": "prettier --write . && eslint --fix ./src/**/*.ts",
20-
"clean": "rimraf dist release"
20+
"lint": "eslint ./src/**/*.ts",
21+
"format": "prettier --ignore-path .gitignore --write .",
22+
"clean": "rimraf dist releases"
2123
},
2224
"repository": {
2325
"type": "git",
@@ -31,15 +33,19 @@
3133
"homepage": "https://github.com/EhTagTranslation/EhSyringe",
3234
"devDependencies": {
3335
"@types/chrome": "^0.0.121",
36+
"@types/escape-html": "^1.0.0",
37+
"@types/node": "^14.0.24",
3438
"@types/pako": "^1.0.1",
35-
"@typescript-eslint/eslint-plugin": "^3.6.1",
36-
"@typescript-eslint/parser": "^3.6.1",
39+
"@types/tampermonkey": "^4.0.0",
40+
"@typescript-eslint/eslint-plugin": "^3.7.0",
41+
"@typescript-eslint/parser": "^3.7.0",
3742
"copy-webpack-plugin": "^6.0.3",
3843
"css-loader": "^3.6.0",
3944
"cssnano": "^4.1.10",
4045
"eslint": "^7.5.0",
4146
"eslint-config-prettier": "^6.11.0",
4247
"eslint-plugin-prettier": "^3.1.4",
48+
"execa": "^4.0.3",
4349
"file-loader": "^6.0.0",
4450
"keypair": "^1.0.1",
4551
"less": "^3.12.2",
@@ -50,24 +56,31 @@
5056
"postcss-loader": "^3.0.0",
5157
"prettier": "^2.0.5",
5258
"rimraf": "^3.0.2",
53-
"run-script-os": "^1.1.1",
5459
"style-loader": "^1.2.1",
5560
"ts-loader": "^8.0.1",
61+
"tsconfig-paths-webpack-plugin": "^3.2.0",
62+
"type-fest": "^0.16.0",
5663
"typescript": "^3.9.7",
5764
"typescript-lit-html-plugin": "^0.9.0",
65+
"url-loader": "^4.1.0",
5866
"web-ext": "^4.3.0",
59-
"webext-webpack-plugin": "^0.0.8",
6067
"webpack": "^4.43.0",
6168
"webpack-cli": "^3.3.12",
62-
"zip-webpack-plugin": "^3.0.0"
69+
"webpack-userscript": "^2.5.4",
70+
"webpack-webextension-plugin": "^0.2.0",
71+
"yargs": "^15.4.1"
6372
},
6473
"dependencies": {
74+
"core-js": "^3.6.5",
6575
"emoji-regex": "^9.0.0",
76+
"escape-html": "^1.0.3",
6677
"lit-element": "^2.3.1",
6778
"lit-html": "^1.2.1",
6879
"normalize.css": "^8.0.1",
6980
"pako": "^1.0.11",
7081
"rxjs": "^6.6.0",
82+
"tslib": "^2.0.0",
83+
"typedi": "^0.8.0",
7184
"webextension-polyfill-ts": "^0.19.0"
7285
}
7386
}
File renamed without changes.

src/assets/tag.db

-457 KB
Binary file not shown.

src/background/context-menu.ts

-42
This file was deleted.

src/background/extension-updater.ts

-54
This file was deleted.

src/background/index.ts

-29
This file was deleted.

0 commit comments

Comments
 (0)