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

Dev #7

Merged
merged 32 commits into from
Jun 14, 2024
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
6f64825
fix(audiences): 支持Microsoft Edge浏览器获取做种体积 (#1851)
SHL-COOL May 8, 2024
4ce8bb9
fix: chrome as onBeforeSendHeaders default
IITII May 8, 2024
22ec753
build: full use vite to build pkg
Rhilip May 8, 2024
b2687d2
build: ignore extra `README.md` file in resource folder
Rhilip May 8, 2024
f98779a
fix(ts): add shim-env for vite
Rhilip May 8, 2024
03e88c2
fix(SSD): 修复SSD副标题显示问题
ronggang May 10, 2024
c405d31
deps: remove webpack loader
Rhilip May 10, 2024
dc72707
deps: use vite plugin to provide node polyfills
Rhilip May 10, 2024
38a99e4
Merge pull request #1853 from pt-plugins/dev_full_vite
Rhilip May 12, 2024
1511135
feat (x-ite): 搜索关键词替换, 结果更精确 (#1860)
davidxuang May 14, 2024
56846bf
feat: support x-ite (#1862)
davidxuang May 14, 2024
0beb6d4
build: disable rollup treeshake because we use eval
trim21 May 14, 2024
c77640a
fix(mt): 拖放链接到助手图标无效 #1870
IITII May 21, 2024
5d2a9da
feat: qb 自定义标签 #1883
IITII May 22, 2024
f348f26
fix(mt): keep upload task
fzlins May 22, 2024
d9b9ad6
fix(hh): level requirements
fzlins May 22, 2024
9ffcb05
fix(hdh): #1850 level requirements
fzlins May 22, 2024
b9bdab4
fix(ss): #1736 uploads
fzlins May 22, 2024
6f07eb1
site(YemaPT): 初步支持搜索和部分个人信息获取
Rhilip May 23, 2024
c9ade46
ci: lock pr action build version to `1.x.x.1`
Rhilip May 25, 2024
42143e4
fix(hdd): bonusPerHour
trim21 May 31, 2024
cad099c
fix fsm
trim21 May 31, 2024
2ae67af
fix(fsm): join time
trim21 May 31, 2024
cd45e79
fix(pig): HnR count (#1898)
hui-shao Jun 3, 2024
1c96fdf
fix(fsm): search result link
trim21 Jun 6, 2024
bd2e5df
feat: 适配新站点ToSky (#1886)
halehal Jun 7, 2024
6fc7fb9
feat(blu): remove domain xyz
ted423 Jun 7, 2024
5c6d343
fix(userData): 升级用户数据时,先并入最新的hosts下数据(如有)
Rhilip Jun 10, 2024
9b900e0
fix(ad): seeding and seedingSize
fzlins Jun 10, 2024
8afe832
feat(u3d): seeding status (#1901)
ted423 Jun 11, 2024
480e9a0
fix(xhb): 更新升级条件
LovelyBaibai Jun 12, 2024
be25504
fix(mt): 搜索页下载种子到本地 #1808
IITII Jun 13, 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
27 changes: 7 additions & 20 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,14 @@
"displayName": "PT 助手 Plus",
"homepage": "https://github.com/pt-plugins/PT-Plugin-Plus",
"scripts": {
"build": "yarn build:background && yarn build:content && yarn build:index",
"lint": "eslint ./src/ --ext ts,vue,js",
"background": "webpack --config webpack/prod-background.cjs && webpack --config webpack/prod-content.cjs",
"dev": "yarn dev:background && yarn dev:content && yarn dev:index",
"dev-s": "cd debug && yarn install && tsc && node ./dist/index.js",
"build": "yarn build:index && yarn build:content && yarn build:background",
"dev:index": "vite build --watch",
"dev:background": "webpack --config webpack/dev-background.cjs --progress",
"dev:content": "webpack --config webpack/dev-content.cjs --progress",
"dev:bc": "yarn dev:background && yarn dev:content",
"resource": "cd debug && yarn install && tsc && node ./dist/buildResource.js",
"dev:background": "yarn build:background -- --mode development",
"dev:content": "yarn build:content -- --mode development",
"build:index": "vite build",
"build:background": "webpack --config webpack/prod-background.cjs --progress",
"build:content": "webpack --config webpack/prod-content.cjs --progress"
"build:background": "vite build --config vite.config.background.ts",
"build:content": "vite build --config vite.config.content.ts"
},
"dependencies": {
"basiccontext": "^3.5.1",
Expand All @@ -36,12 +31,9 @@
"file-saver": "^2.0.5",
"highcharts": "^10.2.1",
"highcharts-vue": "^1.4.0",
"https-browserify": "^1.0.0",
"i18next": "^21.9.1",
"jszip": "^3.10.1",
"parse-torrent": "^11.0.16",
"path-browserify": "^1.0.1",
"stream-http": "^3.2.0",
"ua-parser-js": "^1.0.2",
"url-parse": "^1.5.10",
"vue": "~2.7.0",
Expand Down Expand Up @@ -69,20 +61,15 @@
"@typescript-eslint/parser": "^7.7.1",
"@vitejs/plugin-vue2": "^2.3.1",
"@vue/eslint-config-typescript": "^13.0.0",
"copy-webpack-plugin": "^12.0.2",
"esbuild-loader": "^4.1.0",
"eslint": "^8.57.0",
"eslint-plugin-vue": "^9.25.0",
"git-rev-sync": "^3.0.2",
"sass": "^1.75.0",
"sass-loader": "^14.2.1",
"typescript": "^5.4.5",
"vite": "^5.2.10",
"vue-template-compiler": "~2.7.0",
"vuetify-loader": "~1.7.3",
"webpack": "^5.91.0",
"webpack-cli": "^5.1.4",
"webpack-merge": "^5.10.0"
"vite-plugin-node-polyfills": "^0.21.0",
"vue-template-compiler": "~2.7.0"
},
"browserslist": [
"> 1%",
Expand Down
6 changes: 2 additions & 4 deletions public/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@
"libs/types.expand.js",
"libs/jquery/jquery-3.3.1.min.js",
"libs/Base64.js",
"js/background/libs.js",
"js/background/background.js"
"background/index.js"
]
},
"content_scripts": [{
Expand All @@ -65,8 +64,7 @@
"libs/notice/notice.js",
"libs/basicContext/basicContext.min.js",
"libs/drag.js",
"js/content/libs.js",
"js/content/content.js"
"contentScripts/index.js"
]
}],
"content_security_policy": "script-src 'self' 'unsafe-eval'; object-src 'self'",
Expand Down
7 changes: 5 additions & 2 deletions resource/sites/springsunday.net/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,7 @@
"searchEntryConfig": {
"fieldSelector": {
"subTitle": {
"selector": ["div.torrent-smalldescr:first"],
"filters": ["query.prop('lastChild').nodeValue.trim()"]
"selector": ["div.torrent-smalldescr:first > span"]
},
"progress": {
"selector": [".p_seeding", ".p_downloading", ".p_completed", ".p_inactive", ""],
Expand Down Expand Up @@ -222,6 +221,10 @@
}, {
"name": "⛔️",
"selector": "span.torrent-exclusive"
}, {
"name": "MiniDB",
"color": "amber",
"selector": "span.torrent-minibd"
}],
"selectors": {
"userBaseInfo": {
Expand Down
13 changes: 0 additions & 13 deletions src/options/shims-tsx.d.ts

This file was deleted.

2 changes: 1 addition & 1 deletion src/service/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import "./favicon";

let rootPath = "";
let isExtensionMode = false;
const isDebugMode = process.env.NODE_ENV === "development";
const isDebugMode = import.meta.env.DEV;
// 检测浏览器当前状态和模式
try {
let runtime = chrome.runtime as any;
Expand Down
2 changes: 2 additions & 0 deletions src/options/shims-vue.d.ts → src/shims-env.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/// <reference types="vite/client" />

declare module '*.vue' {
import Vue from 'vue'
export default Vue
Expand Down
46 changes: 46 additions & 0 deletions vite.config.background.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import path from 'node:path'
import {defineConfig} from 'vite'
import {sharedConfig} from "./vite.config";
import fs from "node:fs";
import git from 'git-rev-sync'
import { nodePolyfills } from 'vite-plugin-node-polyfills'
import buildResource from "./vite/buildResource";

// https://vitejs.dev/config/
export default defineConfig({
...sharedConfig,
build: {
outDir: path.resolve(__dirname, 'dist/background'),
lib: {
entry: path.resolve(__dirname, 'src/background/index.ts'),
name: 'background',
formats: ['iife']
},
rollupOptions: {
output: {
entryFileNames: 'index.js',
extend: true,
},
},
chunkSizeWarningLimit: Number.MAX_SAFE_INTEGER,
emptyOutDir: false,
copyPublicDir: false
},
plugins: [
nodePolyfills({
include: ['path'],
}),
buildResource(),
{
name: 'update_manifest_version',
closeBundle() {
const manifest_file_path = path.resolve(__dirname, './dist/manifest.json');
const manifest = JSON.parse(fs.readFileSync(manifest_file_path, 'utf-8'));
const build_number = git.count() % 65535;
manifest.version = `${manifest.version}.${build_number}`;

fs.writeFileSync(manifest_file_path, JSON.stringify(manifest, null, 2));
},
}
]
})
31 changes: 31 additions & 0 deletions vite.config.content.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import path from 'node:path'
import { defineConfig } from 'vite'
import { nodePolyfills } from 'vite-plugin-node-polyfills'
import {sharedConfig} from "./vite.config";

// https://vitejs.dev/config/
export default defineConfig({
...sharedConfig,
build: {
outDir: path.resolve(__dirname, 'dist/contentScripts'),
lib: {
entry: path.resolve(__dirname, 'src/content/index.ts'),
name: 'content',
formats: ['iife']
},
rollupOptions: {
output: {
entryFileNames: 'index.js',
extend: true,
},
},
chunkSizeWarningLimit: Number.MAX_SAFE_INTEGER,
emptyOutDir: false,
copyPublicDir: false
},
plugins: [
nodePolyfills({
include: ['path'],
}),
]
})
35 changes: 12 additions & 23 deletions vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,37 +1,26 @@
import { fileURLToPath, URL } from 'node:url'
import fs from 'node:fs'
import path from 'node:path'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue2'
import git from 'git-rev-sync'
import buildResource from "./vite/buildResource";

export const sharedConfig = {
publicDir: 'public',
resolve: {
extensions: ['.ts', '.js', '.tsx', '.vue'],
alias: {
'@': fileURLToPath(new URL('src', import.meta.url))
},
},
}

// https://vitejs.dev/config/
export default defineConfig({
...sharedConfig,
publicDir: 'public',
build: {
chunkSizeWarningLimit: 0,
chunkSizeWarningLimit: Number.MAX_SAFE_INTEGER,
emptyOutDir: false
},
plugins: [
vue(),
buildResource(),
{
name: 'update_manifest_version',
closeBundle() {
const manifest_file_path = path.resolve(__dirname, './dist/manifest.json');
const manifest = JSON.parse(fs.readFileSync(manifest_file_path, 'utf-8'));
const build_number = git.count() % 65535;
manifest.version = `${manifest.version}.${build_number}`;

fs.writeFileSync(manifest_file_path, JSON.stringify(manifest, null, 2));
},
}
],
resolve: {
extensions: ['.ts', '.js', '.tsx', '.vue'],
alias: {
'@': fileURLToPath(new URL('src', import.meta.url))
},
},
})
16 changes: 16 additions & 0 deletions vite/buildResource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,21 @@ export default function buildResource() {
const resourcePath = PATH.resolve(__dirname, '..', './dist/resource');
const resourceMap = ["sites", "schemas", "clients", "publicSites"];

/**
* 将resource目录复制到dist下
*/
function prepareResource() {
const rawResourcePath = PATH.resolve(__dirname, '..', './resource');
FS.cpSync(rawResourcePath, resourcePath, {
recursive: true, filter(source: string, destination: string) {
if (source.endsWith("README.md")) {
return false;
}
return true;
}
});
}

/**
* 创建资源文件列表
*/
Expand Down Expand Up @@ -260,6 +275,7 @@ export default function buildResource() {
return {
name: 'build_resource',
buildEnd() {
prepareResource();
buildResource();
getSupportedSites();
}
Expand Down
81 changes: 0 additions & 81 deletions webpack/common.cjs

This file was deleted.

Loading