├── .eslintrc.json ├── .github ├── ISSUE_TEMPLATE │ ├── bug.yml │ └── feature.yml └── workflows │ ├── release.yml │ ├── test.yml │ └── update-info.yml ├── .gitignore ├── .prettierrc ├── .vscode ├── launch.json └── settings.json ├── .workflow-script ├── index.d.ts ├── index.html ├── index.mjs ├── package.json └── pnpm-lock.yaml ├── LICENSE ├── README.md ├── bump.cjs ├── electron.vite.config.ts ├── imgs ├── 1.png ├── 2.gif └── 3.png ├── manifest.json ├── manifest_schema.json ├── package-lock.json ├── package.json ├── src ├── assets │ ├── icon.svg │ ├── list-item.html │ └── view.html ├── global.d.ts ├── main │ ├── index.ts │ └── utils.ts ├── preload │ └── index.ts └── renderer │ ├── components.ts │ ├── index.ts │ └── utils.ts ├── tsconfig.json ├── tsconfig.node.json └── tsconfig.web.json /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "browser": true, 4 | "es2021": true, 5 | "node": true 6 | }, 7 | "extends": [ 8 | "eslint:recommended", 9 | "plugin:@typescript-eslint/recommended" 10 | // '@electron-toolkit/eslint-config-ts/recommended', 11 | ], 12 | "overrides": [ 13 | { 14 | "env": { 15 | "node": true 16 | }, 17 | "files": [ 18 | ".eslintrc.{js,cjs}" 19 | ], 20 | "parserOptions": { 21 | "sourceType": "script" 22 | } 23 | } 24 | ], 25 | "ignorePatterns": [ 26 | "node_modules/**/*", 27 | "dist/**/*" 28 | ], 29 | "parser": "@typescript-eslint/parser", 30 | "parserOptions": { 31 | "ecmaVersion": "latest", 32 | "sourceType": "module" 33 | }, 34 | "plugins": [ 35 | "@typescript-eslint" 36 | ], 37 | "rules": { 38 | "@typescript-eslint/naming-convention": [ 39 | "warn", 40 | { 41 | "selector": "import", 42 | "format": [ 43 | "camelCase", 44 | "PascalCase" 45 | ] 46 | } 47 | ], 48 | "@typescript-eslint/semi": "off", 49 | "eqeqeq": "warn", 50 | "no-throw-literal": "warn", 51 | "@typescript-eslint/no-explicit-any": "off", 52 | "@typescript-eslint/no-unused-vars": "warn", 53 | "no-extra-semi": "off" 54 | } 55 | } -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug.yml: -------------------------------------------------------------------------------- 1 | name: BUG 提交 2 | description: 插件不正常的情况 3 | # title: "[bug] 这里自己填" 4 | labels: 5 | - bug 6 | # assignees: ltxhhz 7 | body: 8 | - type: markdown 9 | attributes: 10 | value: | 11 | **提交 issue 前请先搜索查看其他 issue,避免重复提交** 12 | - type: markdown 13 | attributes: 14 | value: | 15 | ## 环境信息 16 | 填写版本信息或者提供版本的截图 17 | **不提供会被关闭** 18 | - type: input 19 | id: qq-version 20 | # validations: 21 | # required: true 22 | attributes: 23 | label: qq版本 24 | description: 在设置中LiteLoader分页里查看 25 | - type: input 26 | id: ll-version 27 | # validations: 28 | # required: true 29 | attributes: 30 | label: LiteLoader 版本 31 | description: 在设置中LiteLoader分页里查看 32 | - type: textarea 33 | id: versions 34 | attributes: 35 | label: 版本信息 36 | description: 把设置中LiteLoader分页里最上方的版本信息截图粘贴到这里 37 | - type: input 38 | id: version 39 | validations: 40 | required: true 41 | attributes: 42 | label: list-viewer 插件版本 43 | description: 在设置中LiteLoader分页里查看 44 | - type: dropdown 45 | id: LL-is-release 46 | validations: 47 | required: true 48 | attributes: 49 | label: LiteLoader 是否为发布版本(release) 50 | options: 51 | - 是 52 | - 否 53 | - type: input 54 | id: platform 55 | validations: 56 | required: true 57 | attributes: 58 | label: 使用平台 59 | description: 系统和版本 60 | - type: markdown 61 | attributes: 62 | value: "## 详细信息" 63 | - type: textarea 64 | id: what-happened 65 | attributes: 66 | label: 问题描述 67 | description: 简要描述您碰到的问题 68 | validations: 69 | required: true 70 | - type: textarea 71 | id: how-happened 72 | attributes: 73 | label: 重现步骤 74 | description: 如果操作可以重现该问题 75 | validations: 76 | required: true 77 | - type: textarea 78 | id: expect 79 | attributes: 80 | label: 期待的正确结果 81 | - type: textarea 82 | id: logs 83 | attributes: 84 | label: 相关日志输出 85 | description: 请复制并粘贴任何相关的日志输出(如果你会打开控制台或终端)。 这将自动格式化为代码,因此无需反引号 86 | render: shell 87 | - type: textarea 88 | id: additional-information 89 | attributes: 90 | label: 附加信息 91 | description: 如果你还有其他需要提供的信息,可以在这里填写(截图、视频等) 92 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature.yml: -------------------------------------------------------------------------------- 1 | name: 需求建议 2 | description: 提出针对本项目的想法和建议 3 | title: '[feature]' 4 | labels: 5 | - enhancement 6 | # assignees: ltxhhz 7 | body: 8 | - type: markdown 9 | attributes: 10 | value: | 11 | **提交 issue 前请先搜索查看其他 issue,避免重复提交** 12 | - type: markdown 13 | attributes: 14 | value: | 15 | ## 环境信息 16 | 填写版本信息或者提供版本的截图 17 | **不提供会被关闭** 18 | - type: input 19 | id: qq-version 20 | # validations: 21 | # required: true 22 | attributes: 23 | label: qq版本 24 | description: 在设置中LiteLoader分页里查看 25 | - type: input 26 | id: ll-version 27 | # validations: 28 | # required: true 29 | attributes: 30 | label: LiteLoader 版本 31 | description: 在设置中LiteLoader分页里查看 32 | - type: textarea 33 | id: versions 34 | attributes: 35 | label: 版本信息 36 | description: 把设置中LiteLoader分页里最上方的版本信息截图粘贴到这里 37 | - type: input 38 | id: version 39 | validations: 40 | required: true 41 | attributes: 42 | label: list-viewer 插件版本 43 | description: 在设置中LiteLoader分页里查看 44 | - type: dropdown 45 | id: LL-is-release 46 | validations: 47 | required: true 48 | attributes: 49 | label: LiteLoader 是否为发布版本(release) 50 | options: 51 | - 是 52 | - 否 53 | - type: markdown 54 | attributes: 55 | value: '## 详细信息' 56 | - type: textarea 57 | id: description 58 | attributes: 59 | label: 请描述您的需求或者改进建议 60 | validations: 61 | required: true 62 | - type: textarea 63 | id: solution 64 | attributes: 65 | label: 请描述你建议的实现方案 66 | - type: textarea 67 | id: additional-information 68 | attributes: 69 | label: 附加信息 70 | description: 如果你还有其他需要提供的信息,可以在这里填写(截图、视频等) 71 | -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | name: Build and Release 2 | 3 | on: 4 | push: 5 | tags: 6 | - "v*" 7 | workflow_dispatch: 8 | 9 | jobs: 10 | release: 11 | runs-on: ubuntu-latest 12 | permissions: 13 | actions: write 14 | contents: write 15 | steps: 16 | - name: Checkout code 17 | uses: actions/checkout@v4 18 | with: 19 | fetch-tags: true 20 | fetch-depth: 0 21 | 22 | - name: Get previous tag 23 | id: get_previous_tag 24 | run: | 25 | echo "PREV_TAG=$(git describe --abbrev=0 --tags $(git rev-list --tags --skip=1 --max-count=1))">>$GITHUB_ENV 26 | echo "CURR_TAG=$(git describe --abbrev=0 --tags)">>$GITHUB_ENV 27 | 28 | - name: Generate changelog 29 | id: generate_changelog 30 | run: | 31 | echo "Previous tag: $PREV_TAG" 32 | echo "Current tag: $CURR_TAG" 33 | FULL_CHANGELOG="**Full Changelog**: ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/compare/$PREV_TAG...$CURR_TAG" 34 | COMMITS=$(git log $PREV_TAG..HEAD --pretty=format:"%h %s (%an, %ar)") 35 | { 36 | echo 'changelog<> $GITHUB_OUTPUT 40 | 41 | - name: Set up Node.js 42 | uses: actions/setup-node@v4 43 | with: 44 | node-version: '18' # 或你项目的 Node.js 版本 45 | 46 | - name: Install dependencies 47 | run: npm install 48 | 49 | - name: Build project 50 | run: npm run build 51 | 52 | - name: publish release 53 | uses: ncipollo/release-action@v1 54 | with: 55 | artifacts: ./list-viewer.zip 56 | # bodyFile: "body.md" 57 | # generateReleaseNotes: true 58 | body: ${{ steps.generate_changelog.outputs.changelog }} 59 | makeLatest: latest 60 | token: ${{ secrets.GITHUB_TOKEN }} 61 | -------------------------------------------------------------------------------- /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | name: Test 2 | 3 | on: 4 | workflow_dispatch: 5 | 6 | jobs: 7 | test: 8 | runs-on: ubuntu-latest 9 | steps: 10 | - name: Checkout code 11 | uses: actions/checkout@v4 12 | with: 13 | fetch-tags: true 14 | fetch-depth: 0 15 | 16 | - name: Get previous tag 17 | id: get_previous_tag 18 | run: | 19 | echo "PREV_TAG=$(git describe --abbrev=0 --tags $(git rev-list --tags --skip=1 --max-count=1))">>$GITHUB_ENV 20 | echo "CURR_TAG=$(git describe --abbrev=0 --tags)">>$GITHUB_ENV 21 | 22 | - name: Generate changelog 23 | id: generate_changelog 24 | run: | 25 | echo "Previous tag: $PREV_TAG" 26 | echo "Current tag: $CURR_TAG" 27 | FULL_CHANGELOG="**Full Changelog**: ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/compare/$PREV_TAG...$CURR_TAG" 28 | COMMITS=$(git log $PREV_TAG..HEAD --pretty=format:"%h %s (%an, %ar)") 29 | { 30 | echo 'changelog<> $GITHUB_ENV 34 | 35 | - run: echo $changelog 36 | -------------------------------------------------------------------------------- /.github/workflows/update-info.yml: -------------------------------------------------------------------------------- 1 | name: Update Plugin Info 2 | 3 | on: 4 | schedule: 5 | - cron: '0 */2 * * *' 6 | workflow_dispatch: 7 | 8 | jobs: 9 | deploy: 10 | runs-on: ubuntu-latest 11 | 12 | steps: 13 | - name: Checkout repository 14 | uses: actions/checkout@v4 15 | 16 | - name: Setup Node.js 17 | uses: actions/setup-node@v4 18 | with: 19 | node-version: '20' 20 | - name: Setup pnpm 21 | run: | 22 | npm i -g pnpm 23 | - name: Get pnpm store path 24 | id: pnpm-cache-path 25 | run: echo "storePath=$(pnpm store path)" >> $GITHUB_ENV 26 | 27 | - name: Run pnpm start 28 | run: | 29 | cd .workflow-script 30 | pnpm install 31 | pnpm run start 32 | 33 | - name: Cache pnpm store 34 | uses: actions/cache@v4 35 | with: 36 | path: ${{ env.storePath }} 37 | key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} 38 | restore-keys: | 39 | ${{ runner.os }}-pnpm-store- 40 | 41 | - name: Deploy to gh-pages 42 | uses: peaceiris/actions-gh-pages@v4 43 | with: 44 | github_token: ${{ secrets.GITHUB_TOKEN }} 45 | publish_dir: .workflow-script/output # 上传的目录 46 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | dist/ 3 | *.zip 4 | data 5 | output -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | c:/Users/ltxhhz/.prettierrc -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // 使用 IntelliSense 了解相关属性。 3 | // 悬停以查看现有属性的描述。 4 | // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "type": "node", 9 | "request": "launch", 10 | "name": "启动程序", 11 | "skipFiles": [ 12 | "/**" 13 | ], 14 | "program": "${workspaceFolder}\\.workflow-script\\index.mjs", 15 | "outFiles": [ 16 | "${workspaceFolder}/.workflow-script/*.js" 17 | ], 18 | "cwd": "${workspaceFolder}/.workflow-script", 19 | "console": "integratedTerminal" 20 | } 21 | ] 22 | } -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "cSpell.words": [ 3 | "jsdelivr", 4 | "liteloader", 5 | "QQNT" 6 | ] 7 | } -------------------------------------------------------------------------------- /.workflow-script/index.d.ts: -------------------------------------------------------------------------------- 1 | 2 | type Plugin = { repo: string; branch: string } 3 | type PluginList = Plugin[] 4 | 5 | interface Manifest { 6 | manifest_version?: number 7 | /** 插件类型 */ 8 | type?: 'extension' | 'theme' | 'framework' 9 | /** 插件名字 */ 10 | name: string 11 | /** 代码内标识 */ 12 | slug: string 13 | /** 插件描述 */ 14 | description: string 15 | /** 版本号 */ 16 | version: string 17 | /** 插件的图标,写入相对路径字符串 */ 18 | icon?: string | null 19 | /** 置选项的图标,写入相对路径字符串 */ 20 | thumb?: string | null 21 | /** 作者们的信息 */ 22 | authors: Author[] 23 | /** 插件仓库信息 */ 24 | repository: Repository 25 | /** 插件支持的系统平台 */ 26 | platform: Array<'win32' | 'linux' | 'darwin'> 27 | /** 要注入的脚本 */ 28 | injects: Injects 29 | /** 插件依赖项,写入插件slug名 */ 30 | dependencies?: string[] 31 | } 32 | 33 | interface Injects { 34 | renderer: string 35 | main: string 36 | preload: string 37 | } 38 | 39 | interface Repository { 40 | repo: string 41 | branch: string 42 | release: Release 43 | } 44 | 45 | interface Release { 46 | tag: string 47 | file: string 48 | } 49 | 50 | interface Author { 51 | name: string 52 | link: string 53 | } -------------------------------------------------------------------------------- /.workflow-script/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Document 7 | 8 | 30 | 31 | 32 | 33 |
34 |
35 |
36 | List-Viewer插件数据自动更新状态 37 | Actions Status 38 |
39 |
列表来源: Plugin-List
40 |
41 | 更新时间:#更新时间 42 | 插件总数:#插件总数 43 | 获取成功:#获取成功 44 | 获取失败:#获取失败 45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 | 插件图标 54 |
55 |
56 |
#标题
57 |
#说明
58 |
59 |
60 |
61 | 版本:#版本 62 | 作者:#作者 63 | 类型:#类型 64 | 平台:#平台 65 |
66 |
67 |
68 |
69 | 144 | 145 | 146 | -------------------------------------------------------------------------------- /.workflow-script/index.mjs: -------------------------------------------------------------------------------- 1 | import { cpSync, mkdirSync, writeFileSync } from 'fs' 2 | import { join, dirname } from 'path' 3 | import { fileURLToPath } from 'url' 4 | import superagent from 'superagent' 5 | // import { HttpsProxyAgent } from 'https-proxy-agent' 6 | import pLimit from 'p-limit' 7 | 8 | // const agent = new HttpsProxyAgent('http://127.0.0.1:10809') 9 | 10 | const listUrl = { 11 | repo: 'LiteLoaderQQNT/Plugin-List', 12 | branch: 'v4', 13 | file: 'plugins.json' 14 | } 15 | 16 | const __dirname = dirname(fileURLToPath(import.meta.url)) 17 | const __filename = fileURLToPath(import.meta.url) 18 | 19 | const limit = pLimit(5) 20 | const outPath = join(__dirname, 'output') 21 | 22 | mkdirSync(outPath, { recursive: true }) 23 | 24 | async function main() { 25 | const allIconsUrls = {} 26 | const meta = { 27 | time: Date.now(), 28 | count: 0, 29 | success: 0, 30 | failed: 0 31 | } 32 | /** @type {Plugin[]} */ 33 | const list = await superagent.get(getRawUrl(listUrl, listUrl.file)).then(res => JSON.parse(res.text)) 34 | // const list = [{ repo: 'MisaLiu/LiteLoaderQQNT-QQCleaner', branch: 'master' }] 35 | meta.count = list.length 36 | const getManifestPromises = list.map((plugin, index) => 37 | limit(async () => { 38 | console.log(`获取 ${plugin.repo}`) 39 | /**@type {Manifest} */ 40 | const manifest = await superagent 41 | .get(getRawUrl(plugin, 'manifest.json')) //.agent(agent) 42 | .then(res => JSON.parse(res.text)) 43 | .catch(async e => { 44 | if (e.status == 404) { 45 | return await superagent 46 | .get(getRawUrl(plugin, 'package.json')) //.agent(agent) 47 | .then(res => { 48 | const pkg = JSON.parse(res.text) 49 | const obj = pkg.liteloader_manifest 50 | if (obj) { 51 | obj.version = pkg.version 52 | obj.description = pkg.description 53 | obj.authors = 54 | typeof pkg.author === 'string' 55 | ? [ 56 | { 57 | name: pkg.author, 58 | link: `https://github.com/${pkg.author}` 59 | } 60 | ] 61 | : [pkg.author] 62 | return obj 63 | } 64 | return null 65 | }) 66 | .catch(e => { 67 | if (e.status == 404) { 68 | return 404 69 | } 70 | console.error(e) 71 | }) 72 | } 73 | console.error(e) 74 | }) 75 | list[index].manifest = manifest || null 76 | if (manifest) { 77 | meta.success++ 78 | allIconsUrls[manifest.slug] = getIconUrls(plugin, manifest) 79 | } 80 | }) 81 | ) 82 | await Promise.all(getManifestPromises) 83 | meta.failed = meta.count - meta.success 84 | console.log('插件获取完成', meta) 85 | writeFileSync(join(outPath, 'all-manifest.json'), JSON.stringify(list)) 86 | console.log('all-manifest.json 已写入') 87 | console.log('开始获取图标', allIconsUrls) 88 | const allIcons = await getIcons(allIconsUrls) 89 | console.log( 90 | '图标获取完成', 91 | Object.keys(allIcons).filter(k => allIcons[k]) 92 | ) 93 | writeFileSync(join(outPath, 'all-icons.json'), JSON.stringify(allIcons)) 94 | console.log('all-icons.json 已写入') 95 | writeFileSync(join(outPath, 'meta.json'), JSON.stringify(meta)) 96 | console.log('meta.json 已写入') 97 | cpSync(join(__dirname, 'index.html'), join(outPath, 'index.html'), { force: true }) 98 | console.log('index.html 已写入') 99 | } 100 | 101 | /** 102 | * @typedef {{ repo: string; branch: string }} Plugin 103 | * @param {Plugin} item 104 | * @param {'package.json'|'manifest.json'} type 105 | */ 106 | function getRawUrl(item, type) { 107 | return `https://raw.githubusercontent.com/${item.repo}/${item.branch}/${type}` 108 | } 109 | 110 | /** 111 | * @param {Plugin} item 112 | * @param {Manifest} manifest 113 | */ 114 | function getIconUrls(item, manifest) { 115 | if (manifest.icon) { 116 | const iconPath = manifest.icon.replace(/^\.?\//, '') 117 | return [getRawUrl(item, iconPath), getRawUrl(item, `src/${iconPath}`)] 118 | } 119 | } 120 | 121 | /** 122 | * @param {Record>} allIcons 123 | */ 124 | async function getIcons(allIcons) { 125 | const icons = {} 126 | for (const repo in allIcons) { 127 | const urls = allIcons[repo] 128 | if (urls) { 129 | for (const url of urls) { 130 | const { body, type } = await superagent.get(url).catch(err => { 131 | if (err.status !== 404) { 132 | console.error(err) 133 | } 134 | return {} 135 | }) 136 | if (Buffer.isBuffer(body)) { 137 | icons[repo] = `data:${type};base64,${body.toString('base64')}` 138 | break 139 | } 140 | } 141 | } 142 | } 143 | return icons 144 | } 145 | 146 | main() 147 | 148 | // superagent.get('https://raw.githubusercontent.com/elegantland/qqMessageBlocker/main/icon.jpg').then(e => { 149 | // console.log(e); 150 | 151 | // }) 152 | -------------------------------------------------------------------------------- /.workflow-script/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "script", 3 | "version": "1.0.0", 4 | "main": "index.js", 5 | "scripts": { 6 | "start": "node --experimental-modules index.mjs" 7 | }, 8 | "author": "", 9 | "license": "ISC", 10 | "description": "", 11 | "devDependencies": { 12 | "@types/node": "^22.10.0", 13 | "@types/superagent": "^8.1.9" 14 | }, 15 | "dependencies": { 16 | "https-proxy-agent": "^7.0.5", 17 | "p-limit": "^6.1.0", 18 | "superagent": "^10.1.1" 19 | }, 20 | "packageManager": "pnpm@9.14.2" 21 | } 22 | -------------------------------------------------------------------------------- /.workflow-script/pnpm-lock.yaml: -------------------------------------------------------------------------------- 1 | lockfileVersion: '9.0' 2 | 3 | settings: 4 | autoInstallPeers: true 5 | excludeLinksFromLockfile: false 6 | 7 | importers: 8 | 9 | .: 10 | dependencies: 11 | https-proxy-agent: 12 | specifier: ^7.0.5 13 | version: 7.0.5 14 | p-limit: 15 | specifier: ^6.1.0 16 | version: 6.1.0 17 | superagent: 18 | specifier: ^10.1.1 19 | version: 10.1.1 20 | devDependencies: 21 | '@types/node': 22 | specifier: ^22.10.0 23 | version: 22.10.0 24 | '@types/superagent': 25 | specifier: ^8.1.9 26 | version: 8.1.9 27 | 28 | packages: 29 | 30 | '@types/cookiejar@2.1.5': 31 | resolution: {integrity: sha512-he+DHOWReW0nghN24E1WUqM0efK4kI9oTqDm6XmK8ZPe2djZ90BSNdGnIyCLzCPw7/pogPlGbzI2wHGGmi4O/Q==} 32 | 33 | '@types/methods@1.1.4': 34 | resolution: {integrity: sha512-ymXWVrDiCxTBE3+RIrrP533E70eA+9qu7zdWoHuOmGujkYtzf4HQF96b8nwHLqhuf4ykX61IGRIB38CC6/sImQ==} 35 | 36 | '@types/node@22.10.0': 37 | resolution: {integrity: sha512-XC70cRZVElFHfIUB40FgZOBbgJYFKKMa5nb9lxcwYstFG/Mi+/Y0bGS+rs6Dmhmkpq4pnNiLiuZAbc02YCOnmA==} 38 | 39 | '@types/superagent@8.1.9': 40 | resolution: {integrity: sha512-pTVjI73witn+9ILmoJdajHGW2jkSaOzhiFYF1Rd3EQ94kymLqB9PjD9ISg7WaALC7+dCHT0FGe9T2LktLq/3GQ==} 41 | 42 | agent-base@7.1.1: 43 | resolution: {integrity: sha512-H0TSyFNDMomMNJQBn8wFV5YC/2eJ+VXECwOadZJT554xP6cODZHPX3H9QMQECxvrgiSOP1pHjy1sMWQVYJOUOA==} 44 | engines: {node: '>= 14'} 45 | 46 | asap@2.0.6: 47 | resolution: {integrity: sha512-BSHWgDSAiKs50o2Re8ppvp3seVHXSRM44cdSsT9FfNEUUZLOGWVCsiWaRPWM1Znn+mqZ1OfVZ3z3DWEzSp7hRA==} 48 | 49 | asynckit@0.4.0: 50 | resolution: {integrity: sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==} 51 | 52 | call-bind@1.0.7: 53 | resolution: {integrity: sha512-GHTSNSYICQ7scH7sZ+M2rFopRoLh8t2bLSW6BbgrtLsahOIB5iyAVJf9GjWK3cYTDaMj4XdBpM1cA6pIS0Kv2w==} 54 | engines: {node: '>= 0.4'} 55 | 56 | combined-stream@1.0.8: 57 | resolution: {integrity: sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==} 58 | engines: {node: '>= 0.8'} 59 | 60 | component-emitter@1.3.1: 61 | resolution: {integrity: sha512-T0+barUSQRTUQASh8bx02dl+DhF54GtIDY13Y3m9oWTklKbb3Wv974meRpeZ3lp1JpLVECWWNHC4vaG2XHXouQ==} 62 | 63 | cookiejar@2.1.4: 64 | resolution: {integrity: sha512-LDx6oHrK+PhzLKJU9j5S7/Y3jM/mUHvD/DeI1WQmJn652iPC5Y4TBzC9l+5OMOXlyTTA+SmVUPm0HQUwpD5Jqw==} 65 | 66 | debug@4.3.7: 67 | resolution: {integrity: sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==} 68 | engines: {node: '>=6.0'} 69 | peerDependencies: 70 | supports-color: '*' 71 | peerDependenciesMeta: 72 | supports-color: 73 | optional: true 74 | 75 | define-data-property@1.1.4: 76 | resolution: {integrity: sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==} 77 | engines: {node: '>= 0.4'} 78 | 79 | delayed-stream@1.0.0: 80 | resolution: {integrity: sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==} 81 | engines: {node: '>=0.4.0'} 82 | 83 | dezalgo@1.0.4: 84 | resolution: {integrity: sha512-rXSP0bf+5n0Qonsb+SVVfNfIsimO4HEtmnIpPHY8Q1UCzKlQrDMfdobr8nJOOsRgWCyMRqeSBQzmWUMq7zvVig==} 85 | 86 | es-define-property@1.0.0: 87 | resolution: {integrity: sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ==} 88 | engines: {node: '>= 0.4'} 89 | 90 | es-errors@1.3.0: 91 | resolution: {integrity: sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==} 92 | engines: {node: '>= 0.4'} 93 | 94 | fast-safe-stringify@2.1.1: 95 | resolution: {integrity: sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA==} 96 | 97 | form-data@4.0.1: 98 | resolution: {integrity: sha512-tzN8e4TX8+kkxGPK8D5u0FNmjPUjw3lwC9lSLxxoB/+GtsJG91CO8bSWy73APlgAZzZbXEYZJuxjkHH2w+Ezhw==} 99 | engines: {node: '>= 6'} 100 | 101 | formidable@3.5.2: 102 | resolution: {integrity: sha512-Jqc1btCy3QzRbJaICGwKcBfGWuLADRerLzDqi2NwSt/UkXLsHJw2TVResiaoBufHVHy9aSgClOHCeJsSsFLTbg==} 103 | 104 | function-bind@1.1.2: 105 | resolution: {integrity: sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==} 106 | 107 | get-intrinsic@1.2.4: 108 | resolution: {integrity: sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ==} 109 | engines: {node: '>= 0.4'} 110 | 111 | gopd@1.0.1: 112 | resolution: {integrity: sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==} 113 | 114 | has-property-descriptors@1.0.2: 115 | resolution: {integrity: sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==} 116 | 117 | has-proto@1.0.3: 118 | resolution: {integrity: sha512-SJ1amZAJUiZS+PhsVLf5tGydlaVB8EdFpaSO4gmiUKUOxk8qzn5AIy4ZeJUmh22znIdk/uMAUT2pl3FxzVUH+Q==} 119 | engines: {node: '>= 0.4'} 120 | 121 | has-symbols@1.0.3: 122 | resolution: {integrity: sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==} 123 | engines: {node: '>= 0.4'} 124 | 125 | hasown@2.0.2: 126 | resolution: {integrity: sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==} 127 | engines: {node: '>= 0.4'} 128 | 129 | hexoid@2.0.0: 130 | resolution: {integrity: sha512-qlspKUK7IlSQv2o+5I7yhUd7TxlOG2Vr5LTa3ve2XSNVKAL/n/u/7KLvKmFNimomDIKvZFXWHv0T12mv7rT8Aw==} 131 | engines: {node: '>=8'} 132 | 133 | https-proxy-agent@7.0.5: 134 | resolution: {integrity: sha512-1e4Wqeblerz+tMKPIq2EMGiiWW1dIjZOksyHWSUm1rmuvw/how9hBHZ38lAGj5ID4Ik6EdkOw7NmWPy6LAwalw==} 135 | engines: {node: '>= 14'} 136 | 137 | methods@1.1.2: 138 | resolution: {integrity: sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==} 139 | engines: {node: '>= 0.6'} 140 | 141 | mime-db@1.52.0: 142 | resolution: {integrity: sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==} 143 | engines: {node: '>= 0.6'} 144 | 145 | mime-types@2.1.35: 146 | resolution: {integrity: sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==} 147 | engines: {node: '>= 0.6'} 148 | 149 | mime@2.6.0: 150 | resolution: {integrity: sha512-USPkMeET31rOMiarsBNIHZKLGgvKc/LrjofAnBlOttf5ajRvqiRA8QsenbcooctK6d6Ts6aqZXBA+XbkKthiQg==} 151 | engines: {node: '>=4.0.0'} 152 | hasBin: true 153 | 154 | ms@2.1.3: 155 | resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==} 156 | 157 | object-inspect@1.13.3: 158 | resolution: {integrity: sha512-kDCGIbxkDSXE3euJZZXzc6to7fCrKHNI/hSRQnRuQ+BWjFNzZwiFF8fj/6o2t2G9/jTj8PSIYTfCLelLZEeRpA==} 159 | engines: {node: '>= 0.4'} 160 | 161 | once@1.4.0: 162 | resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==} 163 | 164 | p-limit@6.1.0: 165 | resolution: {integrity: sha512-H0jc0q1vOzlEk0TqAKXKZxdl7kX3OFUzCnNVUnq5Pc3DGo0kpeaMuPqxQn235HibwBEb0/pm9dgKTjXy66fBkg==} 166 | engines: {node: '>=18'} 167 | 168 | qs@6.13.1: 169 | resolution: {integrity: sha512-EJPeIn0CYrGu+hli1xilKAPXODtJ12T0sP63Ijx2/khC2JtuaN3JyNIpvmnkmaEtha9ocbG4A4cMcr+TvqvwQg==} 170 | engines: {node: '>=0.6'} 171 | 172 | set-function-length@1.2.2: 173 | resolution: {integrity: sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==} 174 | engines: {node: '>= 0.4'} 175 | 176 | side-channel@1.0.6: 177 | resolution: {integrity: sha512-fDW/EZ6Q9RiO8eFG8Hj+7u/oW+XrPTIChwCOM2+th2A6OblDtYYIpve9m+KvI9Z4C9qSEXlaGR6bTEYHReuglA==} 178 | engines: {node: '>= 0.4'} 179 | 180 | superagent@10.1.1: 181 | resolution: {integrity: sha512-9pIwrHrOj3uAnqg9gDlW7EA2xv+N5au/dSM0kM22HTqmUu8jBxNT+8uA7tA3UoCnmiqzpSbu8rasIUZvbyamMQ==} 182 | engines: {node: '>=14.18.0'} 183 | 184 | undici-types@6.20.0: 185 | resolution: {integrity: sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg==} 186 | 187 | wrappy@1.0.2: 188 | resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==} 189 | 190 | yocto-queue@1.1.1: 191 | resolution: {integrity: sha512-b4JR1PFR10y1mKjhHY9LaGo6tmrgjit7hxVIeAmyMw3jegXR4dhYqLaQF5zMXZxY7tLpMyJeLjr1C4rLmkVe8g==} 192 | engines: {node: '>=12.20'} 193 | 194 | snapshots: 195 | 196 | '@types/cookiejar@2.1.5': {} 197 | 198 | '@types/methods@1.1.4': {} 199 | 200 | '@types/node@22.10.0': 201 | dependencies: 202 | undici-types: 6.20.0 203 | 204 | '@types/superagent@8.1.9': 205 | dependencies: 206 | '@types/cookiejar': 2.1.5 207 | '@types/methods': 1.1.4 208 | '@types/node': 22.10.0 209 | form-data: 4.0.1 210 | 211 | agent-base@7.1.1: 212 | dependencies: 213 | debug: 4.3.7 214 | transitivePeerDependencies: 215 | - supports-color 216 | 217 | asap@2.0.6: {} 218 | 219 | asynckit@0.4.0: {} 220 | 221 | call-bind@1.0.7: 222 | dependencies: 223 | es-define-property: 1.0.0 224 | es-errors: 1.3.0 225 | function-bind: 1.1.2 226 | get-intrinsic: 1.2.4 227 | set-function-length: 1.2.2 228 | 229 | combined-stream@1.0.8: 230 | dependencies: 231 | delayed-stream: 1.0.0 232 | 233 | component-emitter@1.3.1: {} 234 | 235 | cookiejar@2.1.4: {} 236 | 237 | debug@4.3.7: 238 | dependencies: 239 | ms: 2.1.3 240 | 241 | define-data-property@1.1.4: 242 | dependencies: 243 | es-define-property: 1.0.0 244 | es-errors: 1.3.0 245 | gopd: 1.0.1 246 | 247 | delayed-stream@1.0.0: {} 248 | 249 | dezalgo@1.0.4: 250 | dependencies: 251 | asap: 2.0.6 252 | wrappy: 1.0.2 253 | 254 | es-define-property@1.0.0: 255 | dependencies: 256 | get-intrinsic: 1.2.4 257 | 258 | es-errors@1.3.0: {} 259 | 260 | fast-safe-stringify@2.1.1: {} 261 | 262 | form-data@4.0.1: 263 | dependencies: 264 | asynckit: 0.4.0 265 | combined-stream: 1.0.8 266 | mime-types: 2.1.35 267 | 268 | formidable@3.5.2: 269 | dependencies: 270 | dezalgo: 1.0.4 271 | hexoid: 2.0.0 272 | once: 1.4.0 273 | 274 | function-bind@1.1.2: {} 275 | 276 | get-intrinsic@1.2.4: 277 | dependencies: 278 | es-errors: 1.3.0 279 | function-bind: 1.1.2 280 | has-proto: 1.0.3 281 | has-symbols: 1.0.3 282 | hasown: 2.0.2 283 | 284 | gopd@1.0.1: 285 | dependencies: 286 | get-intrinsic: 1.2.4 287 | 288 | has-property-descriptors@1.0.2: 289 | dependencies: 290 | es-define-property: 1.0.0 291 | 292 | has-proto@1.0.3: {} 293 | 294 | has-symbols@1.0.3: {} 295 | 296 | hasown@2.0.2: 297 | dependencies: 298 | function-bind: 1.1.2 299 | 300 | hexoid@2.0.0: {} 301 | 302 | https-proxy-agent@7.0.5: 303 | dependencies: 304 | agent-base: 7.1.1 305 | debug: 4.3.7 306 | transitivePeerDependencies: 307 | - supports-color 308 | 309 | methods@1.1.2: {} 310 | 311 | mime-db@1.52.0: {} 312 | 313 | mime-types@2.1.35: 314 | dependencies: 315 | mime-db: 1.52.0 316 | 317 | mime@2.6.0: {} 318 | 319 | ms@2.1.3: {} 320 | 321 | object-inspect@1.13.3: {} 322 | 323 | once@1.4.0: 324 | dependencies: 325 | wrappy: 1.0.2 326 | 327 | p-limit@6.1.0: 328 | dependencies: 329 | yocto-queue: 1.1.1 330 | 331 | qs@6.13.1: 332 | dependencies: 333 | side-channel: 1.0.6 334 | 335 | set-function-length@1.2.2: 336 | dependencies: 337 | define-data-property: 1.1.4 338 | es-errors: 1.3.0 339 | function-bind: 1.1.2 340 | get-intrinsic: 1.2.4 341 | gopd: 1.0.1 342 | has-property-descriptors: 1.0.2 343 | 344 | side-channel@1.0.6: 345 | dependencies: 346 | call-bind: 1.0.7 347 | es-errors: 1.3.0 348 | get-intrinsic: 1.2.4 349 | object-inspect: 1.13.3 350 | 351 | superagent@10.1.1: 352 | dependencies: 353 | component-emitter: 1.3.1 354 | cookiejar: 2.1.4 355 | debug: 4.3.7 356 | fast-safe-stringify: 2.1.1 357 | form-data: 4.0.1 358 | formidable: 3.5.2 359 | methods: 1.1.2 360 | mime: 2.6.0 361 | qs: 6.13.1 362 | transitivePeerDependencies: 363 | - supports-color 364 | 365 | undici-types@6.20.0: {} 366 | 367 | wrappy@1.0.2: {} 368 | 369 | yocto-queue@1.1.1: {} 370 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # LiteLoaderQQNT Plugin 插件列表查看 2 | 3 | > [!NOTE] 4 | > 该插件仅在 Windows 环境下测试开发,未对其他平台进行测试,不保证可用性 5 | > 6 | > 喜欢的话不要吝啬你 star~ 7 | 8 | > [!CAUTION] 9 | > **请不要在 QQ 官方群聊和任何影响力较大的简中互联网平台(包括但不限于: 哔哩哔哩,微博,知乎,抖音等)发布和讨论*任何*与本项目存在相关性的信息** 10 | 11 | | LiteLoader 安装脚本 | [Mzdyl/LiteLoaderQQNT_Install](https://github.com/Mzdyl/LiteLoaderQQNT_Install) | 12 | | ------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | 13 | | 自动打包状态 | [![状态:release](https://img.shields.io/github/actions/workflow/status/ltxhhz/LL-plugin-list-viewer/release.yml?logo=github)](https://github.com/ltxhhz/LL-plugin-list-viewer/actions) | 14 | | 总下载量 | ![download](https://img.shields.io/github/downloads/ltxhhz/LL-plugin-list-viewer/total?logo=github) | 15 | | 最新版本 | [![version](https://img.shields.io/github/v/release/ltxhhz/LL-plugin-list-viewer?logo=github)](https://github.com/ltxhhz/LL-plugin-list-viewer/releases) | 16 | 17 | ## 功能 18 | 19 | - 插件列表查看 20 | - 插件检查更新 21 | - 插件安装(支持镜像) 22 | - 插件卸载 23 | - 插件查找 24 | 25 | ![](./imgs/1.png) 26 | 27 | - 依赖查找 28 | 29 | ![gif](./imgs/2.gif) 30 | 31 | ## 使用方法 32 | 33 | 支持 LiteLoader 1.x 34 | 35 | **v1.5.0+** 推荐打开此开关以使用 `github.io` 域名作为数据来源,可以加快访问和列表加载速度,但数据有小于两小时的缓存时间。 36 | ![setting](./imgs/3.png) 37 | 38 | ### 下载发行版 39 | 40 | 1. 下载[发行版(release)](https://github.com/ltxhhz/LL-plugin-list-viewer/releases/latest)并解压到某个文件夹中 41 | 2. 将解压到的文件夹移动至 `LiteLoaderQQNT数据目录/plugins/` 下面 42 | 3. 重启 QQNT 43 | 44 | ### 使用 git clone 45 | 46 | 1. clone 本仓库 `git clone https://github.com/ltxhhz/LL-plugin-list-viewer.git` 47 | 2. 运行以下命令 48 | 49 | ```bash 50 | npm i 51 | npm run build 52 | ``` 53 | 54 | 3. 如果 clone 到了 `plugins` 目录下,修改 `manifest.json` 中 `inject` 为 55 | 56 | ```json 57 | "injects": { 58 | "main": "./dist/main/index.js", 59 | "preload": "./dist/preload/index.js", 60 | "renderer": "./dist/renderer/index.js" 61 | } 62 | ``` 63 | 64 | > 否则可以将 `dist` 目录移动到 `LiteLoaderQQNT数据目录/plugins/` 目录下 65 | 66 | ## 插件开发者注意 67 | 68 | `manifest.json` 文件需要严格按照 [LiteLoader 的文档要求](https://liteloaderqqnt.github.io/docs/introduction.html#manifest-json) 进行编写。 69 | 70 | > p.s.有一部分插件将字段 `authors:[{}]` 写成了 `author:{}`,这会导致插件开发者显示为空(LiteLoader 中也会),这里不会做适配。 71 | 72 | 如果插件的发行版中除了 LiteLoader 插件还有其他压缩包,如 [NapCatQQ](https://github.com/NapNeko/NapCatQQ),建议将 LiteLoader 插件压缩包以 `mainifest.json` 中 `slug` 或 `name` 命名。(v1.3.10+) 73 | 74 | ## 已知的问题 75 | 76 | > 暂时没有计划修复或无法修复 77 | 78 | - 查询慢或者不稳,因为内置的几个镜像是随机使用,可以重新刷新或安装以使用另一个接口或使用 `github.io` 作为数据来源 79 | - ~~dialog 展示一次后列表顶部多出一部分空白,并且出现折叠图标,点击无效,同样是 LiteLoader 的组件,可能是 dialog 导致样式改变~~ 80 | [已修复#266](https://github.com/LiteLoaderQQNT/LiteLoaderQQNT/issues/266) 81 | - release 更新时需要调用 `api.github.com` ,但没有镜像可用,可能需要配合代理 82 | 83 | ## 鸣谢 84 | 85 | - [ltxhhz](https://github.com/ltxhhz) 辛苦我了 86 | - [LiteLoaderQQNT](https://github.com/LiteLoaderQQNT/LiteLoaderQQNT) 87 | - [LiteLoaderQQNT-PluginTemplate-Vite](https://github.com/MisaLiu/LiteLoaderQQNT-PluginTemplate-Vite) 88 | -------------------------------------------------------------------------------- /bump.cjs: -------------------------------------------------------------------------------- 1 | // eslint-disable-next-line @typescript-eslint/no-var-requires 2 | const fs = require('fs'); 3 | 4 | function incrementVersion(version, type) { 5 | const [major, minor, patch] = version.split('.').map(Number); 6 | 7 | switch (type) { 8 | case 'major': 9 | return `${major + 1}.0.0`; 10 | case 'minor': 11 | return `${major}.${minor + 1}.0`; 12 | case 'patch': 13 | return `${major}.${minor}.${patch + 1}`; 14 | default: 15 | throw new Error('Invalid version type'); 16 | } 17 | } 18 | 19 | function updateVersionInFile(filePath, type) { 20 | fs.readFile(filePath, 'utf8', (err, data) => { 21 | if (err) { 22 | console.error(`Error reading file: ${filePath}`); 23 | return; 24 | } 25 | 26 | let json; 27 | try { 28 | json = JSON.parse(data); 29 | } catch (parseError) { 30 | console.error(`Error parsing JSON in file: ${filePath}`); 31 | return; 32 | } 33 | 34 | if (!json.version) { 35 | console.error(`No version found in ${filePath}`); 36 | return; 37 | } 38 | 39 | const incrementedVersion = incrementVersion(json.version, type); 40 | const before = json.version; 41 | json.version = incrementedVersion; 42 | 43 | fs.writeFile(filePath, JSON.stringify(json, null, 2), 'utf8', err => { 44 | if (err) { 45 | console.error(`Error writing to file: ${filePath}`); 46 | return; 47 | } 48 | console.log(`Version updated successfully in ${filePath} from ${before} to ${incrementedVersion}`); 49 | }); 50 | }); 51 | } 52 | 53 | // Parse command line arguments 54 | const args = process.argv.slice(2); 55 | const versionType = args[0]; 56 | 57 | if (!versionType || !['--major', '--minor', '--patch'].includes(versionType)) { 58 | console.error('Usage: node increment_version.js <--major|--minor|--patch>'); 59 | process.exit(1); 60 | } 61 | 62 | // Update versions in both files 63 | updateVersionInFile('manifest.json', versionType.slice(2)); 64 | updateVersionInFile('package.json', versionType.slice(2)); 65 | -------------------------------------------------------------------------------- /electron.vite.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'electron-vite' 2 | import { defineConfig as defineViteConfig } from 'vite' 3 | import { resolve } from 'path' 4 | import viteChecker from 'vite-plugin-checker' 5 | import viteCp from 'vite-plugin-cp' 6 | import viteZipPack from 'unplugin-zip-pack/vite' 7 | import PluginManifest from './manifest.json' 8 | 9 | const SRC_DIR = resolve(__dirname, './src') 10 | const OUTPUT_DIR = resolve(__dirname, './dist') 11 | 12 | const BaseConfig = defineViteConfig({ 13 | root: __dirname, 14 | resolve: { 15 | alias: { 16 | '@': SRC_DIR 17 | } 18 | } 19 | }) 20 | 21 | const ConfigBuilder = (type: 'main' | 'preload') => 22 | defineViteConfig({ 23 | ...BaseConfig, 24 | 25 | plugins: [ 26 | viteChecker({ 27 | typescript: true, 28 | eslint: { 29 | lintCommand: 'eslint --fix "src/**/*.{ts,js}"' 30 | } 31 | }) 32 | ], 33 | build: { 34 | minify: true, 35 | outDir: resolve(OUTPUT_DIR, `./${type}`), 36 | lib: { 37 | entry: resolve(SRC_DIR, `./${type}/index.ts`), 38 | formats: ['cjs'], 39 | fileName: () => 'index.js' 40 | } 41 | } 42 | }) 43 | 44 | export default defineConfig({ 45 | main: ConfigBuilder('main'), 46 | preload: ConfigBuilder('preload'), 47 | renderer: defineViteConfig({ 48 | ...BaseConfig, 49 | 50 | plugins: [ 51 | viteChecker({ 52 | typescript: true, 53 | eslint: { 54 | lintCommand: 'eslint --fix "src/**/*.{ts,js}"' 55 | } 56 | }), 57 | viteCp({ 58 | targets: [ 59 | { src: './manifest.json', dest: 'dist' }, 60 | { src: './src/assets', dest: 'dist/assets' } 61 | ] 62 | }), 63 | viteZipPack({ 64 | in: OUTPUT_DIR, 65 | out: resolve(__dirname, `./${PluginManifest.slug}.zip`) 66 | }) 67 | ], 68 | build: { 69 | minify: false, 70 | outDir: resolve(OUTPUT_DIR, './renderer'), 71 | lib: { 72 | entry: resolve(SRC_DIR, './renderer/index.ts'), 73 | formats: ['es'], 74 | fileName: () => 'index.js' 75 | }, 76 | rollupOptions: { 77 | input: resolve(SRC_DIR, './renderer/index.ts') 78 | } 79 | } 80 | }) 81 | }) 82 | -------------------------------------------------------------------------------- /imgs/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ltxhhz/LL-plugin-list-viewer/3d883063add433411b6da3d1d8644be4e8d15728/imgs/1.png -------------------------------------------------------------------------------- /imgs/2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ltxhhz/LL-plugin-list-viewer/3d883063add433411b6da3d1d8644be4e8d15728/imgs/2.gif -------------------------------------------------------------------------------- /imgs/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ltxhhz/LL-plugin-list-viewer/3d883063add433411b6da3d1d8644be4e8d15728/imgs/3.png -------------------------------------------------------------------------------- /manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "./manifest_schema.json", 3 | "manifest_version": 4, 4 | "type": "extension", 5 | "name": "插件列表查看", 6 | "slug": "list-viewer", 7 | "description": "插件列表查看·安装·更新", 8 | "icon": "assets/icon.svg", 9 | "thumb": "assets/icon.svg", 10 | "version": "1.5.0", 11 | "authors": [ 12 | { 13 | "name": "ltxhhz", 14 | "link": "https://github.com/ltxhhz" 15 | } 16 | ], 17 | "platform": [ 18 | "win32", 19 | "linux", 20 | "darwin" 21 | ], 22 | "injects": { 23 | "main": "./main/index.js", 24 | "preload": "./preload/index.js", 25 | "renderer": "./renderer/index.js" 26 | }, 27 | "repository": { 28 | "repo": "ltxhhz/LL-plugin-list-viewer", 29 | "branch": "main" 30 | } 31 | } -------------------------------------------------------------------------------- /manifest_schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-07/schema#", 3 | "title": "LiteLoaderQQNT Plugin manifest", 4 | "properties": { 5 | "manifest_version": { 6 | "type": "integer", 7 | "enum": [ 8 | 1, 9 | 2, 10 | 3, 11 | 4 12 | ], 13 | "default": 4, 14 | "title": "menifest文件版本", 15 | "description": "当前版本为 4" 16 | }, 17 | "type": { 18 | "type": "string", 19 | "enum": [ 20 | "extension", 21 | "theme", 22 | "framework" 23 | ], 24 | "title": "插件类型" 25 | }, 26 | "name": { 27 | "type": "string", 28 | "title": "插件名字" 29 | }, 30 | "slug": { 31 | "type": "string", 32 | "title": "代码内标识" 33 | }, 34 | "description": { 35 | "type": "string", 36 | "title": "插件描述" 37 | }, 38 | "icon": { 39 | "title": "插件图标", 40 | "description": "写入相对路径字符串,也可以是 null", 41 | "anyOf": [ 42 | { 43 | "type": "string" 44 | }, 45 | { 46 | "type": "null" 47 | } 48 | ] 49 | }, 50 | "thumb": { 51 | "title": "设置选项图标", 52 | "description": "写入相对路径字符串,也可以是 null", 53 | "anyOf": [ 54 | { 55 | "type": "string" 56 | }, 57 | { 58 | "type": "null" 59 | } 60 | ] 61 | }, 62 | "version": { 63 | "type": "string", 64 | "title": "版本号", 65 | "pattern": "^([0-9]+)\\.([0-9]+)\\.([0-9]+)(?:-([0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*))?(?:\\+[0-9A-Za-z-]+)?$" 66 | }, 67 | "authors": { 68 | "title": "作者们的信息", 69 | "type": "array", 70 | "items": { 71 | "type": "object", 72 | "properties": { 73 | "name": { 74 | "title": "作者名字", 75 | "type": "string" 76 | }, 77 | "link": { 78 | "title": "作者链接", 79 | "type": "string", 80 | "format": "uri" 81 | } 82 | }, 83 | "required": [ 84 | "name", 85 | "link" 86 | ] 87 | } 88 | }, 89 | "dependencies": { 90 | "title": "插件依赖项", 91 | "description": "写入插件slug名", 92 | "type": "array", 93 | "items": { 94 | "type": "string" 95 | } 96 | }, 97 | "platform": { 98 | "title": "插件支持的系统平台", 99 | "description": " - Windows: win32 \n - Linux: linux \n - MacOS: darwin", 100 | "type": "array", 101 | "items": { 102 | "type": "string", 103 | "enum": [ 104 | "win32", 105 | "linux", 106 | "darwin" 107 | ], 108 | "uniqueItems": true 109 | } 110 | }, 111 | "injects": { 112 | "title": "要注入的脚本", 113 | "type": "object", 114 | "properties": { 115 | "renderer": { 116 | "title": "渲染进程", 117 | "type": "string" 118 | }, 119 | "main": { 120 | "title": "主进程", 121 | "type": "string" 122 | }, 123 | "preload": { 124 | "title": "预加载脚本", 125 | "type": "string" 126 | } 127 | } 128 | }, 129 | "repository": { 130 | "title": "插件仓库信息", 131 | "type": "object", 132 | "properties": { 133 | "repo": { 134 | "title": "仓库短地址", 135 | "type": "string" 136 | }, 137 | "branch": { 138 | "title": "分支名称", 139 | "type": "string" 140 | }, 141 | "release": { 142 | "type": "object", 143 | "properties": { 144 | "tag": { 145 | "title": "tag 名称", 146 | "description": "不推荐写 latest", 147 | "type": "string" 148 | }, 149 | "file": { 150 | "title": "release 内的文件名", 151 | "description": "不填会直接下载 tag 的源码", 152 | "type": "string" 153 | } 154 | }, 155 | "required": [ 156 | "tag" 157 | ] 158 | } 159 | }, 160 | "required": [ 161 | "repo", 162 | "branch" 163 | ] 164 | } 165 | }, 166 | "required": [ 167 | "manifest_version", 168 | "name", 169 | "slug", 170 | "description", 171 | "version", 172 | "authors", 173 | "platform" 174 | ] 175 | } -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "list-viewer", 3 | "version": "1.5.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1", 8 | "lint": "npx eslint --fix src/**/* --ext .js,.ts", 9 | "build": "npx electron-vite build", 10 | "build-test": "npm run build && xcopy .\\dist\\* \"..\\..\\work space\\LiteLoaderQQNT\\plugins\\list-viewer\\\" /S /Y", 11 | "move-test": "xcopy .\\dist\\* \"..\\..\\work space\\LiteLoaderQQNT\\plugins\\list-viewer\\\" /S /Y", 12 | "bump-patch": "node bump.cjs --patch", 13 | "bump-minor": "node bump.cjs --minor", 14 | "bump-major": "node bump.cjs --major" 15 | }, 16 | "author": "ltxhhz", 17 | "license": "GPL-3.0-only", 18 | "devDependencies": { 19 | "@electron-toolkit/eslint-config-ts": "^1.0.1", 20 | "@electron-toolkit/tsconfig": "^1.0.1", 21 | "@typescript-eslint/eslint-plugin": "^7.2.0", 22 | "@typescript-eslint/parser": "^7.2.0", 23 | "electron": "^29.1.4", 24 | "electron-vite": "^2.1.0", 25 | "eslint": "^8.57.0", 26 | "typescript": "4.7.4 - 5.5.0", 27 | "unplugin-zip-pack": "^1.0.3-beta.0", 28 | "vite": "^5.3.1", 29 | "vite-plugin-checker": "^0.6.4", 30 | "vite-plugin-cp": "^4.0.8" 31 | }, 32 | "dependencies": { 33 | "compare-versions": "^6.1.0", 34 | "http-proxy-agent": "^7.0.2", 35 | "https-proxy-agent": "^7.0.5", 36 | "node-stream-zip": "^1.15.0", 37 | "p-limit": "^5.0.0", 38 | "proxy-agent": "^6.4.0", 39 | "socks-proxy-agent": "^8.0.4" 40 | } 41 | } -------------------------------------------------------------------------------- /src/assets/icon.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/assets/list-item.html: -------------------------------------------------------------------------------- 1 | 133 | 134 |
135 |
136 | 137 |
138 |
139 | 插件名 140 | (未激活) 141 | (<4) 142 | (疑似跑路) 143 | (需要手动更新) 144 |
145 |
146 |
插件描述
147 |
148 |
149 |
150 |
151 |
152 | 版本:版本 153 | 154 | 开发: 155 | 类型: 156 | 平台: 157 | 依赖: 158 |
159 |
160 |
161 |
162 | 更新 163 | 安装 164 | 卸载 165 | 重试 166 | 详情 167 |
168 |
-------------------------------------------------------------------------------- /src/assets/view.html: -------------------------------------------------------------------------------- 1 | 2 | 139 | 140 | 141 | 142 | 143 | 144 | 145 |
146 | 根据类型过滤 147 |
148 |
149 | 152 | 155 |
156 |
157 | 158 |
159 | 160 | 插件版本: 161 | 插件总数: 162 | 列表仓库 163 | 164 | 刷新会禁用缓存并请求,所以会比较慢,可用来检查更新,建议不要频繁刷新 165 |
166 |
167 | 刷新 168 |
169 |
170 | 171 |
172 | 列表排序 173 | 选择先后会影响排序 174 |
175 |
176 | 177 | 默认排序 178 | 已安装 179 | 需要更新 180 | 181 |
182 |
183 |
184 |
185 | 186 | 187 | 188 |
189 | 接口超时时间 190 | 控制所有请求,不包括图片,最少为3000 191 |
192 |
193 |
194 | 195 |
196 | 是否使用镜像 197 | 使用代理时建议关闭 198 |
199 |
200 | 204 | 205 | 修改镜像 206 | 211 |
212 |
213 | 214 |
215 | 是否使用github.io 216 | Github Action定时任务自动更新的列表数据源,每两小时更新一次,使用github.io域名访问,可能会加快访问速度 219 |
220 |
221 | 222 |
223 |
224 | 225 |
226 | 是否使用代理 227 | 如果启用且未设置地址会自动获取环境代理,Windows 设置系统代理无效,对页面图片无效 228 |
229 |
230 | 231 | 设置代理 232 |
233 |
234 | 235 |
236 | 设置GitHub令牌 237 | 遇到请求速率限制时可以填写令牌缓解此问题 238 |
239 |
240 | 设置 241 |
242 |
243 |
244 |
245 |
246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 |
254 | 287 | 290 |
291 | 292 | 293 |
294 | 选择包来源 295 | 296 |
297 |
298 |
299 | 注意: 安装/更新 时会删除插件原文件(不包括配置),如果有修改过的文件,请先备份或者使用 git 进行安装/更新 一般插件都会使用 300 | release 包进行更新,除非有特殊说明,如果不确定可以点击详情前往插件仓库进行查看 301 |
302 |
303 |
304 | 使用仓库代码包 305 |
306 |
307 | 使用release包 308 |
309 |
310 |
311 | 312 | 313 |
314 | 标题 315 | 316 |
317 |
318 |
319 |
content
320 |
321 |
322 |
323 | 确认 324 | 取消 325 |
326 |
327 | -------------------------------------------------------------------------------- /src/global.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | 3 | export type HandleResult = 4 | | { 5 | success: true 6 | data?: any 7 | } 8 | | { 9 | success: false 10 | message: string 11 | } 12 | 13 | export interface GlobalMethods { 14 | ListViewer: { 15 | log: (...args: any[]) => void 16 | getPkg: (slug: string, url: string) => Promise 17 | removePkg: (slug: string, removeData?: boolean) => Promise 18 | request: (url: string, option?: RequestOptions) => Promise 19 | } 20 | } 21 | 22 | export interface Config { 23 | debug: boolean 24 | inactivePlugins: string[] 25 | mirrors: { 26 | downloadUrl: string[] 27 | // rawUrl: string[] 28 | } 29 | useMirror: boolean 30 | useGithubIO: boolean 31 | listSortType: SortType 32 | githubToken: string 33 | listLastForceUpdate: number 34 | proxy: { 35 | url: string 36 | enabled: boolean 37 | } 38 | requestTimeout: number 39 | } 40 | 41 | export interface RequestOptions { 42 | method?: 'GET' | 'POST' 43 | proxy?: string 44 | body?: any 45 | headers?: Record 46 | agent?: ProxyAgent 47 | timeout?: number 48 | } 49 | 50 | export type Plugin = { repo: string; branch: string } 51 | export type PluginList = Plugin[] 52 | export type GetPkgType = 'repo' | 'release' 53 | 54 | declare global { 55 | declare namespace LiteLoader { 56 | const path: ILiteLoaderPath 57 | const versions: ILiteLoaderVersion 58 | const os: ILiteLoaderOS 59 | const package: ILiteLoaderPackage 60 | const config: { 61 | LiteLoader: { 62 | disabled_plugins: string[] 63 | } 64 | } 65 | const plugins: Record 66 | const api: ILiteLoaderAPI 67 | 68 | interface ILiteLoaderPath { 69 | root: string 70 | profile: string 71 | data: string 72 | plugins: string 73 | } 74 | 75 | interface ILiteLoaderVersion { 76 | qqnt: string 77 | liteloader: string 78 | node: string 79 | chrome: string 80 | electron: string 81 | } 82 | 83 | interface ILiteLoaderOS { 84 | platform: 'win32' | 'linux' | 'darwin' 85 | } 86 | 87 | interface ILiteLoaderPackage { 88 | liteloader: object 89 | qqnt: object 90 | } 91 | 92 | interface ILiteLoaderPlugin { 93 | manifest: Manifest 94 | incompatible: boolean 95 | disabled: boolean 96 | path: ILiteLoaderPluginPath 97 | } 98 | 99 | interface ILiteLoaderPluginPath { 100 | plugin: string 101 | data: string 102 | injects: ILiteLoaderPluginPathInject 103 | } 104 | 105 | interface ILiteLoaderPluginPathInject { 106 | main: string 107 | renderer: string 108 | preload: string 109 | } 110 | 111 | interface ILiteLoaderAPI { 112 | openPath: (path: string) => void 113 | openExternal: (url: string) => void 114 | disablePlugin: (slug: string) => void 115 | config: ILiteLoaderAPIConfig 116 | plugin?: ILiteLoaderAPIPlugin 117 | } 118 | 119 | interface ILiteLoaderAPIConfig { 120 | set: (slug: string, new_config: IConfig) => unknown 121 | get: (slug: string, default_config?: IConfig) => IConfig | PromiseLike 122 | } 123 | 124 | interface ILiteLoaderAPIPlugin { 125 | install: (file_path: string, undone = false) => void 126 | delete: (slug: string, delete_data = false, undone = false) => void 127 | disable: (slug: string, undone = false) => void 128 | } 129 | } 130 | 131 | declare const ListViewer: GlobalMethods['ListViewer'] 132 | 133 | const SettingElementStyleSheets: { 134 | styleSheets: CSSStyleSheet 135 | on: (css: CSSStyleSheet) => void 136 | } 137 | interface Manifest { 138 | manifest_version?: number 139 | /** 插件类型 */ 140 | type?: 'extension' | 'theme' | 'framework' 141 | /** 插件名字 */ 142 | name: string 143 | /** 代码内标识 */ 144 | slug: string 145 | /** 插件描述 */ 146 | description: string 147 | /** 版本号 */ 148 | version: string 149 | /** 插件的图标,写入相对路径字符串 */ 150 | icon?: string | null 151 | /** 置选项的图标,写入相对路径字符串 */ 152 | thumb?: string | null 153 | /** 作者们的信息 */ 154 | authors: Author[] 155 | /** 插件仓库信息 */ 156 | repository: Repository 157 | /** 插件支持的系统平台 */ 158 | platform: Array<'win32' | 'linux' | 'darwin'> 159 | /** 要注入的脚本 */ 160 | injects: Injects 161 | /** 插件依赖项,写入插件slug名 */ 162 | dependencies?: string[] 163 | } 164 | 165 | interface Injects { 166 | renderer: string 167 | main: string 168 | preload: string 169 | } 170 | 171 | interface Repository { 172 | repo: string 173 | branch: string 174 | release: Release 175 | } 176 | 177 | interface Release { 178 | tag: string 179 | file: string 180 | } 181 | 182 | interface Author { 183 | name: string 184 | link: string 185 | } 186 | } 187 | 188 | // export {} 189 | -------------------------------------------------------------------------------- /src/main/index.ts: -------------------------------------------------------------------------------- 1 | import { ipcMain, IpcMainEvent, dialog, IpcMainInvokeEvent } from 'electron' 2 | import type { GlobalMethods, HandleResult, Config } from '../global' 3 | import fs from 'fs' 4 | import path from 'path' 5 | import StreamZip from 'node-stream-zip' 6 | import { output, request } from './utils' 7 | import { ProxyAgent } from 'proxy-agent' 8 | 9 | const thisSlug = 'list-viewer' 10 | 11 | const listen = (channel: K, cb: (e: IpcMainEvent, ...args: Parameters) => void) => 12 | ipcMain.on('LiteLoader.ListViewer.' + channel, cb) 13 | const handle = ( 14 | channel: K, 15 | cb: (e: IpcMainInvokeEvent, ...args: Parameters) => ReturnType 16 | ) => ipcMain.handle('LiteLoader.ListViewer.' + channel, cb) 17 | 18 | // export const onBrowserWindowCreated = (window: BrowserWindow) => { 19 | // console.log('A window has just been created') 20 | // console.log(window) 21 | // } 22 | 23 | listen('log', (_, args) => { 24 | const cfg = LiteLoader.api.config.get(thisSlug) as Config 25 | cfg.debug && output(args) 26 | }) 27 | 28 | handle('getPkg', async (_, slug, url) => { 29 | output('安装', slug, url) 30 | const cfg = LiteLoader.api.config.get(thisSlug) as Config 31 | return await request(url, { 32 | proxy: cfg.proxy.enabled ? cfg.proxy.url : undefined, 33 | agent: cfg.proxy.enabled && !cfg.proxy.url ? new ProxyAgent() : undefined 34 | }) 35 | .then(res => { 36 | output('下载完成', slug) 37 | const zip = path.join(LiteLoader.plugins[thisSlug].path.data, `${slug}.zip`) 38 | fs.writeFileSync(zip, res.data) 39 | output('写入', zip) 40 | return installPlugin(zip, slug) 41 | }) 42 | .catch(err => { 43 | // throw new Error(`${err.message} \n${url}`) 44 | return { 45 | success: false, 46 | message: err.message 47 | } 48 | }) 49 | }) 50 | 51 | handle('removePkg', async (_e, slug, removeData = false): Promise => { 52 | output('卸载', slug) 53 | let plugin, data 54 | if (LiteLoader.plugins[slug]) { 55 | ;({ plugin, data } = LiteLoader.plugins[slug].path) 56 | } else { 57 | output('未激活的插件,寻找路径', slug) 58 | plugin = findPluginPath(slug) 59 | if (!plugin) { 60 | return { 61 | success: false, 62 | message: '未找到插件路径' 63 | } 64 | } 65 | output('寻找到的路径', plugin) 66 | } 67 | try { 68 | if (removeData && data) { 69 | fs.rmdirSync(data, { recursive: true }) 70 | } 71 | fs.rmdirSync(plugin, { recursive: true }) 72 | output('卸载完成', slug) 73 | return { 74 | success: true 75 | } 76 | } catch (error: any) { 77 | return { 78 | success: false, 79 | message: error.message 80 | } 81 | } 82 | }) 83 | 84 | handle('request', async (_, url, opt): Promise => { 85 | const cfg = LiteLoader.api.config.get(thisSlug) as Config 86 | output('正在请求', cfg, url, opt) 87 | try { 88 | const res = await request(url, { 89 | ...opt, 90 | proxy: cfg.proxy.enabled ? cfg.proxy.url : undefined, 91 | agent: cfg.proxy.enabled && !cfg.proxy.url ? new ProxyAgent() : undefined 92 | }) 93 | return { 94 | success: true, 95 | data: res 96 | } 97 | } catch (error: any) { 98 | return { 99 | success: false, 100 | message: error.message 101 | } 102 | } 103 | }) 104 | 105 | async function installPlugin(cache_file_path: string, slug: string): Promise { 106 | const { plugins } = LiteLoader.path 107 | let plugin_path = LiteLoader.plugins[slug]?.path?.plugin || path.join(plugins, slug) 108 | let isManual = false 109 | try { 110 | // 解压并安装插件 111 | if (fs.existsSync(plugin_path)) { 112 | try { 113 | fs.rmSync(plugin_path, { recursive: true, force: true }) 114 | } catch (error: any) { 115 | // if (error.code === 'EPERM') { 116 | output('删除旧插件失败,使用手动方式', error) 117 | isManual = true 118 | plugin_path += '[list-viewer-updated]' 119 | if (fs.existsSync(plugin_path)) { 120 | throw new Error(`你真tm 够懒的,重命名都不会吗:${plugin_path}`) 121 | } 122 | // } 123 | // throw error 124 | } 125 | } 126 | fs.mkdirSync(plugin_path, { recursive: true }) 127 | output('开始解压', cache_file_path) 128 | const zip = new StreamZip.async({ file: cache_file_path, skipEntryNameValidation: true }) 129 | const entries = await zip.entries() 130 | const isFolder = !Object.hasOwn(entries, 'manifest.json') // 判断是否需要保留一级目录 true为不保留 131 | for (const entry of Object.values(entries)) { 132 | if (isPathUnsafe(entry.name)) { 133 | return { 134 | success: false, 135 | message: '压缩包中含有不安全路径' 136 | } 137 | } 138 | if (!entry.name.includes('.github')) { 139 | const pathname = `${plugin_path}/${isFolder ? entry.name.split('/').slice(1).join('/') : entry.name}` 140 | // 创建目录 141 | if (entry.isDirectory) { 142 | fs.mkdirSync(pathname, { recursive: true }) 143 | continue 144 | } else { 145 | const pdir = path.dirname(pathname) 146 | if (!fs.existsSync(pdir)) { 147 | fs.mkdirSync(pdir, { recursive: true }) 148 | } 149 | } 150 | // 创建文件 有时不会先创建目录 151 | try { 152 | if (entry.isFile) { 153 | await zip.extract(entry.name, pathname) 154 | continue 155 | } 156 | } catch (error) { 157 | fs.mkdirSync(pathname.slice(0, pathname.lastIndexOf('/')), { recursive: true }) 158 | await zip.extract(entry.name, pathname) 159 | continue 160 | } 161 | } 162 | } 163 | await zip.close() 164 | output('解压完成', cache_file_path) 165 | fs.rmSync(cache_file_path, { force: true }) 166 | output('删除完成', cache_file_path) 167 | return { 168 | success: true, 169 | data: { 170 | isManual 171 | } 172 | } 173 | } catch (error: any) { 174 | dialog.showErrorBox('插件列表查看', error.stack || error.message) 175 | // 安装失败删除文件 176 | if (!LiteLoader.plugins[slug]) fs.rmSync(plugin_path, { recursive: true, force: true }) 177 | fs.rmSync(cache_file_path, { force: true }) 178 | if (error.message.includes('Bad archive')) { 179 | return { 180 | success: false, 181 | message: '安装包异常' 182 | } 183 | } 184 | return { 185 | success: false, 186 | message: '安装失败 ' + error.message 187 | } 188 | } 189 | } 190 | 191 | function findPluginPath(slug: string) { 192 | const dirs = fs.readdirSync(LiteLoader.path.plugins).map(e => path.join(LiteLoader.path.plugins, e)) 193 | const dirs1 = Object.values(LiteLoader.plugins).map(e => e.path.plugin) 194 | return dirs 195 | .filter(e => !dirs1.includes(e)) 196 | .find(e => { 197 | try { 198 | const manifest = JSON.parse(fs.readFileSync(path.join(e, 'manifest.json')).toString()) 199 | if (manifest.slug === slug) { 200 | return true 201 | } 202 | } catch (error) { 203 | output('findManifest', error) 204 | } 205 | return false 206 | }) 207 | } 208 | 209 | function isPathUnsafe(path) { 210 | return /^(\/|\\|[a-zA-Z]:\\|[a-zA-Z]:\/|.*\.\..*)/.test(path) 211 | } 212 | -------------------------------------------------------------------------------- /src/main/utils.ts: -------------------------------------------------------------------------------- 1 | import http from 'http' 2 | import https from 'https' 3 | import { URL } from 'url' 4 | import fs from 'fs' 5 | import path from 'path' 6 | 7 | import { HttpsProxyAgent } from 'https-proxy-agent' 8 | import { HttpProxyAgent } from 'http-proxy-agent' 9 | import { SocksProxyAgent } from 'socks-proxy-agent' 10 | import type { Config, RequestOptions } from '../global' 11 | 12 | const thisSlug = 'list-viewer' 13 | export function request( 14 | url: string, 15 | options: RequestOptions = {} 16 | ): Promise<{ 17 | data: Buffer 18 | str: string 19 | status?: number 20 | statusText?: string 21 | url?: string 22 | }> { 23 | return new Promise((resolve, reject) => { 24 | const urlObj = new URL(url) 25 | const protocol = urlObj.protocol === 'https:' ? https : http 26 | 27 | const isPost = options.method === 'POST' 28 | const headers = { 29 | ...(isPost && options.body ? { 'Content-Length': Buffer.byteLength(typeof options.body === 'object' ? JSON.stringify(options.body) : options.body), 'Content-Type': 'application/json' } : {}), 30 | ...(options.headers || {}) 31 | } 32 | if ( 33 | !Object.keys(headers) 34 | .map(e => e.toLowerCase()) 35 | .includes('user-agent') 36 | ) { 37 | headers['user-agent'] = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36 Edg/128.0.0.0' 38 | } 39 | const requestOptions: http.RequestOptions | https.RequestOptions = { 40 | host: urlObj.host, 41 | port: urlObj.port || (urlObj.protocol === 'https:' ? 443 : 80), 42 | path: urlObj.pathname + urlObj.search, 43 | protocol: urlObj.protocol, 44 | hostname: urlObj.hostname, 45 | timeout: options.timeout || 3e4, 46 | method: options.method || 'GET', 47 | headers, 48 | agent: options.proxy 49 | ? options.proxy.startsWith('socks') 50 | ? new SocksProxyAgent(options.proxy) 51 | : urlObj.protocol === 'https:' 52 | ? new HttpsProxyAgent(options.proxy, { 53 | rejectUnauthorized: false 54 | }) 55 | : new HttpProxyAgent(options.proxy, { 56 | rejectUnauthorized: false 57 | }) 58 | : options.agent, 59 | rejectUnauthorized: false 60 | } 61 | 62 | const req = protocol.request(requestOptions, res => { 63 | if (res.statusCode && res.statusCode >= 300 && res.statusCode < 400) { 64 | return resolve(request(res.headers.location!, options)) // 处理重定向 65 | } 66 | 67 | const chunks: any[] = [] 68 | res.on('error', error => reject(error)) 69 | res.on('data', chunk => chunks.push(chunk)) 70 | res.on('end', () => { 71 | const data = Buffer.concat(chunks) 72 | const obj = { 73 | data: data, 74 | str: data.toString('utf-8'), 75 | status: res.statusCode, 76 | statusText: res.statusMessage, 77 | url: res.url 78 | } 79 | output(obj) 80 | resolve(obj) 81 | }) 82 | }) 83 | 84 | req.on('error', reject) 85 | req.on('timeout', () => reject(new Error('请求超时'))) 86 | 87 | if (isPost && options.body) { 88 | req.write(typeof options.body === 'object' ? JSON.stringify(options.body) : options.body) 89 | } 90 | 91 | req.end() // 完成请求 92 | }) 93 | } 94 | 95 | export function output(...args: any[]) { 96 | try { 97 | if ((LiteLoader.api.config.get(thisSlug) as Config).debug) { 98 | fs.appendFileSync( 99 | path.join(LiteLoader.plugins[thisSlug].path.data, 'debug.log'), 100 | `[${new Date().toLocaleString()}] ${args 101 | .map(e => 102 | JSON.stringify( 103 | e, 104 | (_key, value) => { 105 | if (typeof value === 'bigint') return value.toString() 106 | else if (value?.type === 'Buffer' && Array.isArray(value.data)) return `Buffer<${value?.data?.length}>` 107 | return value 108 | }, 109 | 2 110 | ) 111 | ) 112 | .join(' ')}\n` 113 | ) 114 | } 115 | } catch (error) { 116 | console.warn('\x1b[32m[ListViewer]\x1b[0m', '输出到日志文件失败', error) 117 | } 118 | 119 | console.log('\x1b[32m[ListViewer]\x1b[0m', ...args) 120 | } 121 | -------------------------------------------------------------------------------- /src/preload/index.ts: -------------------------------------------------------------------------------- 1 | import { contextBridge, ipcRenderer } from 'electron' 2 | import { GlobalMethods } from '../global' 3 | 4 | const aa: (apiKey: K, api: GlobalMethods[K]) => void = contextBridge.exposeInMainWorld as any 5 | 6 | aa('ListViewer', { 7 | getPkg: (slug, url) => ipcRenderer.invoke('LiteLoader.ListViewer.getPkg', slug, url), 8 | removePkg: slug => ipcRenderer.invoke('LiteLoader.ListViewer.removePkg', slug), 9 | log: (...args) => ipcRenderer.send('LiteLoader.ListViewer.removePkg', ...args), 10 | request: (url, option) => ipcRenderer.invoke('LiteLoader.ListViewer.request', url, option) 11 | }) 12 | -------------------------------------------------------------------------------- /src/renderer/components.ts: -------------------------------------------------------------------------------- 1 | /* 2 | export class QRadio extends HTMLElement { 3 | labelEl!: HTMLLabelElement 4 | inputEl!: HTMLInputElement 5 | spanEl!: HTMLSpanElement 6 | textNodeEl!: HTMLSpanElement 7 | constructor() { 8 | super() 9 | const shadow = this.attachShadow({ mode: 'open' }) 10 | 11 | // 创建HTML元素 12 | const label = document.createElement('label') 13 | this.labelEl = label 14 | label.classList.add('q-radio') 15 | 16 | const input = document.createElement('input') 17 | this.inputEl = input 18 | input.setAttribute('type', 'radio') 19 | 20 | const span = document.createElement('span') 21 | this.spanEl = span 22 | span.classList.add('q-radio__input') 23 | span.setAttribute('data-number', '') 24 | 25 | const textNode = document.createElement('span') 26 | this.textNodeEl = textNode 27 | textNode.classList.add('q-radio__label') 28 | 29 | label.appendChild(input) 30 | label.appendChild(span) 31 | label.appendChild(textNode) 32 | shadow.appendChild(label) 33 | 34 | // 创建样式元素 35 | const style = document.createElement('style') 36 | style.textContent = ` 37 | .q-radio { 38 | display: inline-flex; 39 | } 40 | 41 | .q-radio, 42 | .q-radio__input { 43 | align-items: center; 44 | position: relative; 45 | } 46 | 47 | .q-radio__input { 48 | background-color: transparent; 49 | border: 1px solid var(--fill_standard_primary); 50 | border-radius: 50%; 51 | box-sizing: border-box; 52 | display: inline-block; 53 | display: flex; 54 | height: 18px; 55 | justify-content: center; 56 | vertical-align: middle; 57 | width: 18px; 58 | } 59 | 60 | .q-radio__input:after { 61 | background-color: var(--brand_standard); 62 | border-radius: 10px; 63 | content: ""; 64 | height: 10px; 65 | position: absolute; 66 | visibility: hidden; 67 | width: 10px; 68 | } 69 | 70 | .q-radio__label { 71 | margin-left: 5px; 72 | margin-right: 10px; 73 | } 74 | 75 | .q-radio:not(.is-disabled):hover .q-radio__input { 76 | background-color: var(--overlay_hover); 77 | } 78 | 79 | .q-radio:not(.is-disabled):hover .q-radio__input:after { 80 | background-color: var(--nt_brand_standard_2_overlay_hover_brand_2_mix); 81 | } 82 | 83 | .q-radio:not(.is-disabled):active .q-radio__input { 84 | background-color: var(--overlay_pressed); 85 | } 86 | 87 | .q-radio:not(.is-disabled):active .q-radio__input:after { 88 | background-color: var(--nt_brand_standard_2_overlay_pressed_brand_2_mix); 89 | } 90 | 91 | .q-radio.is-disabled { 92 | cursor: not-allowed; 93 | opacity: .3; 94 | } 95 | 96 | .q-radio.is-checked .q-radio__input:after { 97 | visibility: visible; 98 | } 99 | input, textarea { 100 | appearance: none; 101 | background-repeat: initial; 102 | border-top-left-radius: 0px; 103 | border-top-right-radius: 0px; 104 | border-bottom-right-radius: 0px; 105 | border-bottom-left-radius: 0px; 106 | box-sizing: border-box; 107 | background: none; 108 | border: none; 109 | padding: 0px; 110 | } 111 | ` 112 | shadow.appendChild(style) 113 | 114 | // 监听input的变化 115 | input.addEventListener('change', () => { 116 | if (input.checked) { 117 | label.classList.add('is-checked') 118 | } else { 119 | label.classList.remove('is-checked') 120 | } 121 | }) 122 | } 123 | 124 | static get observedAttributes() { 125 | return ['label', 'name', 'value'] 126 | } 127 | 128 | attributeChangedCallback(name: string, _oldValue: string | null, newValue: string | null) { 129 | switch (name) { 130 | case 'label': 131 | this.textNodeEl.textContent = newValue 132 | break 133 | case 'name': 134 | this.inputEl.setAttribute('name', newValue || '') 135 | break 136 | case 'value': 137 | this.inputEl.setAttribute('value', newValue || '') 138 | break 139 | default: 140 | break 141 | } 142 | } 143 | 144 | connectedCallback() { 145 | if (this.hasAttribute('label')) { 146 | this.textNodeEl.textContent = this.getAttribute('label') 147 | } 148 | if (this.hasAttribute('name')) { 149 | this.inputEl.setAttribute('name', this.getAttribute('name') || '') 150 | } 151 | if (this.hasAttribute('value')) { 152 | this.inputEl.setAttribute('value', this.getAttribute('value') || '') 153 | } 154 | } 155 | } 156 | 157 | customElements.define('q-radio', QRadio) */ 158 | 159 | export class QCheck { 160 | labelEl!: HTMLLabelElement 161 | inputEl!: HTMLInputElement 162 | spanEl!: HTMLSpanElement 163 | textNodeEl!: HTMLSpanElement 164 | constructor(options: { label: string; name?: string; value?: string; checked: boolean; type: 'radio' | 'checkbox' }) { 165 | // 创建HTML元素 166 | const label = document.createElement('label') 167 | this.labelEl = label 168 | label.classList.add(`q-${options.type}`) 169 | 170 | const input = document.createElement('input') 171 | this.inputEl = input 172 | options.name && input.setAttribute('name', options.name) 173 | options.value && input.setAttribute('value', options.value) 174 | input.setAttribute('type', options.type) 175 | input.checked = options.checked 176 | 177 | const span = document.createElement('span') 178 | this.spanEl = span 179 | span.classList.add(`q-${options.type}__input`) 180 | 181 | const textNode = document.createElement('span') 182 | this.textNodeEl = textNode 183 | textNode.style.marginLeft = '5px' 184 | textNode.textContent = options.label 185 | // textNode.classList.add('q-radio__label') 186 | 187 | label.appendChild(input) 188 | label.appendChild(span) 189 | label.appendChild(textNode) 190 | input.addEventListener('change', () => { 191 | if (input.checked) { 192 | label.classList.add('is-checked') 193 | } else { 194 | label.classList.remove('is-checked') 195 | } 196 | }) 197 | if (input.checked) { 198 | label.classList.add('is-checked') 199 | } else { 200 | label.classList.remove('is-checked') 201 | } 202 | } 203 | } 204 | 205 | export class QInput { 206 | prefixEL!: HTMLDivElement 207 | inputEl!: HTMLInputElement 208 | clearEl!: HTMLDivElement 209 | 210 | element!: HTMLDivElement 211 | 212 | constructor(options: { 213 | name?: string 214 | value?: string 215 | type: 'text' | 'password' | 'number' | 'email' | 'tel' | 'url' | 'search' | 'date' | 'time' | 'datetime-local' | 'month' | 'week' | 'color' | 'file' | 'hidden' | 'reset' | 'submit' | 'button' 216 | clearable?: boolean 217 | placeholder?: string 218 | }) { 219 | this.element = document.createElement('div') 220 | this.element.classList.add('q-input') 221 | // this.prefixEL = document.createElement('div') 222 | // this.prefixEL.classList.add('q-input__prefix') 223 | this.clearEl = document.createElement('div') 224 | this.clearEl.classList.add('q-input__clear') 225 | this.clearEl.innerHTML = `` 226 | this.clearEl.style.display = 'none' 227 | 228 | this.inputEl = document.createElement('input') 229 | this.inputEl.spellcheck = false 230 | this.inputEl.type = options.type 231 | this.inputEl.name = options.name || '' 232 | this.inputEl.value = options.value || '' 233 | this.inputEl.placeholder = options.placeholder || '' 234 | this.inputEl.classList.add('q-input__inner') 235 | 236 | this.element.appendChild(this.inputEl) 237 | if (options.clearable) { 238 | this.inputEl.classList.add('q-input__clearable') 239 | this.inputEl.addEventListener('input', () => { 240 | if (this.inputEl.value) { 241 | this.clearEl.style.display = 'flex' 242 | } else { 243 | this.clearEl.style.display = 'none' 244 | } 245 | }) 246 | this.clearEl.addEventListener('click', () => { 247 | this.inputEl.value = '' 248 | }) 249 | this.element.appendChild(this.clearEl) 250 | } 251 | } 252 | } 253 | -------------------------------------------------------------------------------- /src/renderer/index.ts: -------------------------------------------------------------------------------- 1 | import { compare } from 'compare-versions' 2 | import pLimit from 'p-limit' 3 | import { HandleResult, Plugin, PluginList } from '../global' 4 | import { QCheck, QInput } from './components' 5 | import { config, fetchWithTimeout, getRandomItem, localFetch, originMirrors, initConfig, useMirror, SortType, thisSlug, isSameDay } from './utils' 6 | 7 | const listUrl = { 8 | repo: 'LiteLoaderQQNT/Plugin-List', 9 | branch: 'v4', 10 | file: 'plugins.json' 11 | } 12 | 13 | const defaultIcon = 'local://root/src/settings/static/default.png' 14 | 15 | const domParser = new DOMParser() 16 | type DialogOptions = { 17 | title: string 18 | confirm?: string 19 | cancel?: string 20 | message?: string 21 | } & ( 22 | | { 23 | content?: string | HTMLElement 24 | type: 'message' | 'confirm' 25 | } 26 | | { 27 | type: 'prompt' 28 | textarea?: boolean 29 | default?: string 30 | placeholder?: string 31 | } 32 | ) 33 | let listLoadingPromise: Promise 34 | let listIconsPromise: Promise 35 | let listIcons: Record 36 | 37 | type PluginItemElement = ReturnType 38 | 39 | const typeMap = { 40 | extension: '扩展', 41 | theme: '主题', 42 | framework: '框架' 43 | } 44 | 45 | let pluginList: PluginList 46 | let currentItem: Plugin 47 | let currentManifest: Manifest 48 | let showDialog: (option: DialogOptions) => Promise 49 | let filterInput: HTMLInputElement 50 | const filterTypes = { 51 | extension: { 52 | label: '扩展', 53 | checked: true, 54 | qc: {} as QCheck 55 | }, 56 | theme: { 57 | label: '主题', 58 | checked: true, 59 | qc: {} as QCheck 60 | }, 61 | framework: { 62 | label: '框架', 63 | checked: true, 64 | qc: {} as QCheck 65 | } 66 | } 67 | 68 | export function onSettingWindowCreated(view: HTMLElement) { 69 | initConfig() 70 | localFetch('/assets/view.html') 71 | .then(e => e.text()) 72 | .then(async res => { 73 | const doms = domParser.parseFromString(res, 'text/html') 74 | filterInput = doms.querySelector('#list-search')! 75 | const typeFilterEl = doms.querySelector('.list-filter-type-checkbox')! 76 | typeFilterEl.replaceChildren( 77 | ...Object.keys(filterTypes).map(e1 => { 78 | const e = filterTypes[e1] 79 | const qc = new QCheck({ 80 | label: e.label, 81 | checked: e.checked, 82 | type: 'checkbox' 83 | }) 84 | qc.inputEl.addEventListener('change', () => { 85 | e.checked = qc.inputEl.checked 86 | }) 87 | e.qc = qc 88 | return qc.labelEl 89 | }) 90 | ) 91 | const refreshBtn = doms.querySelector('.refresh-btn')! 92 | const totalEl = doms.querySelector('.total-text')! 93 | const dialogInstall = doms.querySelector('.list-dialog-install')! 94 | const dialogInstallClose = doms.querySelector('.list-dialog-install-btn-close')! 95 | const scrollToTopBtn = doms.querySelector('.scroll-to-top-btn')! 96 | scrollToTopBtn.addEventListener('click', () => { 97 | view.parentElement!.scrollTo({ 98 | top: 0, 99 | behavior: 'smooth' 100 | }) 101 | }) 102 | const versionEl = doms.querySelector('.version-text')! 103 | const versionA = doms.createElement('a') 104 | versionA.onclick = () => { 105 | LiteLoader.api.openExternal('https://github.com/' + LiteLoader.plugins[thisSlug].manifest.repository.repo) 106 | } 107 | versionA.innerText = LiteLoader.plugins[thisSlug].manifest.version 108 | versionEl.append(versionA) 109 | const listRepoA = doms.querySelector('a.list-repo') 110 | listRepoA!.onclick = () => { 111 | LiteLoader.api.openExternal(`https://github.com/${listUrl.repo}/tree/${listUrl.branch}`) 112 | } 113 | // const mirrorSelect = doms.querySelector('.select-mirror')! 114 | let resFunc: (value?: boolean | PromiseLike) => void 115 | dialogInstallClose.addEventListener('click', () => { 116 | dialogInstall.close() 117 | resFunc() 118 | }) 119 | const useRepo = doms.querySelector('.list-dialog-btn-repo')! 120 | useRepo.addEventListener('click', () => { 121 | // install() 122 | dialogInstall.close() 123 | resFunc(false) 124 | }) 125 | const useRelease = doms.querySelector('.list-dialog-btn-release')! 126 | useRelease.addEventListener('click', () => { 127 | // install(true) 128 | dialogInstall.close() 129 | resFunc(true) 130 | }) 131 | let dialogResolve: (value?: boolean) => void 132 | const dialog = doms.querySelector('.list-dialog')! 133 | const dialogClose = doms.querySelector('.list-dialog-btn-close')! 134 | dialogClose.addEventListener('click', () => { 135 | dialog.close() 136 | dialogResolve() 137 | }) 138 | const dialogTitle = doms.querySelector('.list-dialog-title')! 139 | const dialogContent = doms.querySelector('.list-dialog-content')! 140 | const dialogConfirm = doms.querySelector('.list-dialog-btn-confirm')! 141 | dialogConfirm.addEventListener('click', () => { 142 | dialog.close() 143 | dialogResolve(true) 144 | }) 145 | const dialogCancel = doms.querySelector('.list-dialog-btn-cancel')! 146 | dialogCancel.addEventListener('click', () => { 147 | dialog.close() 148 | dialogResolve(false) 149 | }) 150 | showDialog = (option: DialogOptions) => { 151 | let dialogInput: HTMLInputElement | HTMLTextAreaElement 152 | dialogTitle.innerText = option.title 153 | config.debug && console.log('showDialog', JSON.parse(JSON.stringify(option))) 154 | dialogCancel.style.removeProperty('display') 155 | if (option.type === 'confirm' || option.type === 'message') { 156 | dialogContent.innerText = option.message || '' 157 | if (option.content) { 158 | if (typeof option.content === 'string') { 159 | dialogContent.innerHTML = option.content 160 | } else { 161 | dialogContent.replaceChildren(option.content) 162 | } 163 | } 164 | if (option.type === 'message') { 165 | dialogCancel.style.display = 'none' 166 | } 167 | } else if (option.type === 'prompt') { 168 | dialogInput = option.textarea ? document.createElement('textarea') : document.createElement('input') 169 | dialogInput.placeholder = option.placeholder ?? '请输入内容' 170 | dialogInput.value = option.default ?? '' 171 | dialogInput.style.width = '100%' 172 | dialogInput.style.background = 'var(--background_02)' 173 | dialogInput.style.color = 'var(--bg_white_light)' 174 | dialogInput.style.marginTop = '10px' 175 | 176 | dialogContent.replaceChildren(option.message || '', dialogInput) 177 | } 178 | dialogConfirm.innerText = option.confirm || '确定' 179 | dialogCancel.innerText = option.cancel || '取消' 180 | return new Promise(resolve => { 181 | dialog.showModal() 182 | dialogResolve = (bool?: boolean) => { 183 | if (option.type === 'prompt') { 184 | config.debug && console.log('prompt result:', bool ? dialogInput.value : undefined) 185 | resolve((bool ? dialogInput.value : undefined) as T) 186 | } else { 187 | config.debug && console.log('dialog result:', bool) 188 | resolve(bool as T) 189 | } 190 | } 191 | }) 192 | } 193 | //#region 194 | const timeoutInput = doms.querySelector('.timeout-input')! 195 | const timeoutInput1 = new QInput({ 196 | type: 'number', 197 | placeholder: '超时时间(ms)', 198 | value: config.requestTimeout + '' 199 | }) 200 | timeoutInput.appendChild(timeoutInput1.element) 201 | timeoutInput1.inputEl.addEventListener('change', () => { 202 | config.requestTimeout = Math.max(3e3, parseInt(timeoutInput1.inputEl.value)) 203 | }) 204 | //#endregion 205 | const mirrorSwitch = doms.querySelector('.mirror-switch')! 206 | mirrorSwitch.toggleAttribute('is-active', config.useMirror) 207 | mirrorSwitch.onclick = () => { 208 | const isActive = mirrorSwitch.hasAttribute('is-active') 209 | mirrorSwitch.toggleAttribute('is-active', !isActive) 210 | config.useMirror = !isActive 211 | if (!isActive && githubIOBtn.hasAttribute('is-active')) { 212 | githubIOBtn.click() 213 | // githubIOBtn.toggleAttribute('is-active', isActive) 214 | // config.useGithubIO = isActive 215 | } 216 | } 217 | const mirrorAddBtn = doms.querySelector('.mirror-add-btn')! 218 | mirrorAddBtn.onclick = () => { 219 | showDialog({ 220 | title: '添加镜像', 221 | type: 'prompt', 222 | placeholder: '请输入镜像地址,每行一个', 223 | message: `请输入镜像地址,每行一个,如果代理方式是完整url在地址后面,比如 224 | https://mirror/https://github.com/xx/xx,则需要写 225 | https://mirror/https://github.com/ 226 | 如果代理方式是 path在地址后面,比如 227 | https://mirror/xx/xx,则需要写https://mirror 228 | jsdelivr镜像直接按默认那个写就行 229 | 内置三个镜像'https://mirror.ghproxy.com', 'https://ghproxy.net', 'https://github.moeyy.xyz' 230 | 使用时默认优先使用第一个,如果没有响应才会使用其他镜像`, 231 | textarea: true, 232 | default: config.mirrors.downloadUrl.join('\n') 233 | }).then(res => { 234 | if (typeof res === 'string') { 235 | config.mirrors.downloadUrl = res.split('\n') 236 | } 237 | }) 238 | } 239 | const githubIOBtn = doms.querySelector('.github-io-switch')! 240 | githubIOBtn.toggleAttribute('is-active', config.useGithubIO) 241 | githubIOBtn.onclick = () => { 242 | const isActive = githubIOBtn.hasAttribute('is-active') 243 | githubIOBtn.toggleAttribute('is-active', !isActive) 244 | config.useGithubIO = !isActive 245 | console.log(!isActive, mirrorSwitch.hasAttribute('is-active')) 246 | if (!isActive && mirrorSwitch.hasAttribute('is-active')) { 247 | mirrorSwitch.click() 248 | // mirrorSwitch.toggleAttribute('is-active', isActive) 249 | // config.proxy.enabled = isActive 250 | } 251 | } 252 | const proxySwitch = doms.querySelector('.proxy-switch')! 253 | proxySwitch.toggleAttribute('is-active', config.proxy.enabled) 254 | proxySwitch.onclick = () => { 255 | const isActive = proxySwitch.hasAttribute('is-active') 256 | proxySwitch.toggleAttribute('is-active', !isActive) 257 | config.proxy.enabled = !isActive 258 | } 259 | const proxySetBtn = doms.querySelector('.proxy-set-btn')! 260 | proxySetBtn.onclick = () => { 261 | showDialog({ 262 | title: '设置代理', 263 | type: 'prompt', 264 | placeholder: '请输入代理地址', 265 | message: `请输入代理地址,支持 http、socks,比如 socks://127.0.0.1:10808`, 266 | default: config.proxy.url 267 | }).then(res => { 268 | if (typeof res === 'string') { 269 | config.proxy.url = res 270 | } 271 | }) 272 | } 273 | const githubtokenSetBtn = doms.querySelector('.githubtoken-set-btn')! 274 | githubtokenSetBtn.onclick = () => { 275 | showDialog({ 276 | title: '设置GithubToken', 277 | type: 'prompt', 278 | placeholder: '请输入GithubToken', 279 | message: `请输入GithubToken,如果没有请留空,设置了GithubToken可以减少出现请求速领限制的问题 280 | 前往 https://github.com/settings/tokens 获取,scope 选择 repo > public_repo`, 281 | default: config.githubToken 282 | }).then(res => { 283 | if (typeof res === 'string') { 284 | config.githubToken = res 285 | } 286 | }) 287 | } 288 | 289 | const sortListFunc = (type: SortType) => { 290 | listLoadingPromise.then(() => { 291 | config.debug && console.log('开始排序', type) 292 | switch (type) { 293 | case 'default': 294 | pluginListDom.replaceChildren(...Array.from(pluginListDom.children as any).sort((a, b) => (Number(a.dataset.index) || 0) - (Number(b.dataset.index) || 0))) 295 | break 296 | case 'installed': 297 | pluginListDom.replaceChildren(...Array.from(pluginListDom.children as any).sort((a, b) => (Number(b.dataset.installed) || 0) - (Number(a.dataset.installed) || 0))) 298 | break 299 | case 'outdated': 300 | pluginListDom.replaceChildren(...Array.from(pluginListDom.children as any).sort((a, b) => (Number(b.dataset.update) || 0) - (Number(a.dataset.update) || 0))) 301 | break 302 | default: 303 | break 304 | } 305 | }) 306 | } 307 | 308 | const sortSelect = doms.querySelector('.sort-select')! 309 | doms.querySelector(`[data-value="${config.listSortType}"]`)?.setAttribute('is-selected', '') 310 | sortSelect.addEventListener('selected', (e: any) => { 311 | config.debug && console.log('列表排序方式改变', e.detail) 312 | if (config.listSortType !== e.detail.value) { 313 | sortListFunc(e.detail.value) 314 | } 315 | config.listSortType = e.detail.value 316 | }) 317 | 318 | doms.body.childNodes.forEach(dom => { 319 | view.appendChild(dom) 320 | }) 321 | const showInstallDialog = () => 322 | new Promise(resolve => { 323 | dialogInstall.showModal() 324 | resFunc = resolve 325 | }) 326 | 327 | createItemComponent(await localFetch('/assets/list-item.html').then(e => e.text()), showInstallDialog) 328 | 329 | const pluginListDom = view.querySelector('#plugin-list')! 330 | 331 | const getList1 = (noCache = false) => { 332 | refreshBtn.setAttribute('is-disabled', '') 333 | sortSelect.setAttribute('is-disabled', '') 334 | if (!noCache && !isSameDay(config.listLastForceUpdate)) { 335 | noCache = true 336 | } 337 | if (config.useGithubIO) { 338 | listLoadingPromise = getListGithubIO(noCache).then(async records => { 339 | if (noCache) { 340 | config.listLastForceUpdate = +new Date() 341 | } 342 | if (typeof records === 'string') { 343 | showDialog({ 344 | title: '获取列表失败', 345 | type: 'message', 346 | message: records 347 | }) 348 | return 349 | } 350 | listIconsPromise = getIconsGithubIO(noCache).then(icons => { 351 | if (typeof icons === 'string') { 352 | showDialog({ 353 | title: '获取图标失败', 354 | type: 'message', 355 | message: icons 356 | }) 357 | return 358 | } 359 | listIcons = icons 360 | }) 361 | pluginList = records 362 | totalEl.innerText = records.length.toString() 363 | records.forEach((plugin, i) => { 364 | const dom = document.createElement('plugin-item') as PluginItemElement 365 | dom.dataset.name = plugin.repo 366 | dom.dataset.description = plugin.branch 367 | pluginListDom.appendChild(dom) 368 | const manifest = plugin.manifest 369 | dom.dataset.index = i + '' 370 | config.debug && console.log(plugin, manifest) 371 | updateElProp(dom, manifest, plugin.repo) 372 | }) 373 | }) 374 | } else { 375 | listLoadingPromise = getList(noCache).then(async list => { 376 | if (noCache) { 377 | config.listLastForceUpdate = +new Date() 378 | } 379 | if (typeof list === 'string') { 380 | showDialog({ 381 | title: '获取列表失败', 382 | type: 'message', 383 | message: list 384 | }) 385 | return 386 | } 387 | pluginList = list 388 | totalEl.innerText = list.length.toString() 389 | const promArr: Promise[] = [] 390 | const limit = pLimit(3) 391 | list.forEach((plugin, i) => { 392 | const dom = document.createElement('plugin-item') as PluginItemElement 393 | dom.dataset.name = plugin.repo 394 | dom.dataset.description = plugin.branch 395 | pluginListDom.appendChild(dom) 396 | promArr.push( 397 | limit(async () => { 398 | const manifest = await getManifest(plugin, noCache) 399 | dom.dataset.index = i + '' 400 | config.debug && console.log(plugin, manifest) 401 | updateElProp(dom, manifest, plugin.repo) 402 | }) 403 | ) 404 | }) 405 | return Promise.all(promArr) 406 | }) 407 | } 408 | listLoadingPromise.finally(() => { 409 | refreshBtn.removeAttribute('is-disabled') 410 | sortSelect.removeAttribute('is-disabled') 411 | }) 412 | } 413 | 414 | refreshBtn.addEventListener('click', () => { 415 | pluginListDom.replaceChildren() 416 | getList1(true) 417 | sortListFunc(config.listSortType) 418 | }) 419 | getList1() 420 | sortListFunc(config.listSortType) 421 | }) 422 | .catch(console.error) 423 | } 424 | 425 | function createItemComponent(innerHtml: string, showInstallDialog: () => PromiseLike) { 426 | class PluginListClass extends HTMLElement { 427 | titleEl?: HTMLSpanElement 428 | descriptionEl?: HTMLSpanElement 429 | versionEl?: HTMLSpanElement 430 | authorsEl?: HTMLDivElement 431 | manipulateEl?: HTMLDivElement 432 | iconEl?: HTMLImageElement 433 | updateBtnEl?: HTMLButtonElement 434 | installBtnEl?: HTMLButtonElement 435 | uninstallBtnEl?: HTMLButtonElement 436 | detailBtnEl?: HTMLButtonElement 437 | retryBtnEl?: HTMLButtonElement 438 | typeEl?: HTMLSpanElement 439 | dependenciesItemsEl?: HTMLSpanElement 440 | platformsEl?: HTMLSpanElement 441 | manifest: Manifest | null = null 442 | 443 | #initPromise: Promise 444 | #initPromiseResolve: ((e: void | PromiseLike) => void) | undefined 445 | #initialized = false 446 | 447 | constructor() { 448 | super() 449 | const shadow = this.attachShadow({ mode: 'open' }) 450 | shadow.innerHTML = innerHtml 451 | this.#initPromise = new Promise(resolve => { 452 | this.#initPromiseResolve = resolve 453 | if (this.#initialized) resolve() 454 | }) 455 | } 456 | 457 | connectedCallback() { 458 | config.debug && console.log('组件创建', this) 459 | if (this.#initialized) return 460 | this.titleEl = this.shadowRoot!.querySelector('.title')! 461 | this.descriptionEl = this.shadowRoot!.querySelector('.description')! 462 | this.versionEl = this.shadowRoot!.querySelector('.version')! 463 | this.authorsEl = this.shadowRoot!.querySelector('.authors')! 464 | this.manipulateEl = this.shadowRoot!.querySelector('.manipulate')! 465 | this.iconEl = this.shadowRoot!.querySelector('.icon')! 466 | this.typeEl = this.shadowRoot!.querySelector('.type')! 467 | this.dependenciesItemsEl = this.shadowRoot!.querySelector('.dependencies>.items')! 468 | this.platformsEl = this.shadowRoot!.querySelector('.platforms')! 469 | 470 | this.updateBtnEl = this.shadowRoot!.querySelector('.update')! 471 | const installEvent = async (update = false) => { 472 | currentItem = pluginList[Number(this.dataset.index)] 473 | currentManifest = this.manifest! 474 | showInstallDialog().then(res => { 475 | if (res !== undefined) { 476 | if (update) { 477 | this.updateBtnEl!.setAttribute('is-disabled', '') 478 | this.updateBtnEl!.innerText = '安装中...' 479 | } else { 480 | this.installBtnEl!.setAttribute('is-disabled', '') 481 | this.installBtnEl!.innerText = '安装中...' 482 | } 483 | install(res) 484 | .then(res => { 485 | console.log('安装成功', res) 486 | if (res.success) { 487 | this.dataset.installed = '1' 488 | this.dataset.inactive = '1' 489 | if (update) { 490 | delete this.dataset.update 491 | if (res.data?.isManual) { 492 | this.dataset.manualUpdate = '1' 493 | showDialog({ 494 | title: '手动更新', 495 | message: '请手动更新插件,在退出 qq 后,删除原文件夹,重命名带"[list-viewer-updated]"的新文件夹,', 496 | type: 'confirm', 497 | confirm: '打开插件文件夹', 498 | cancel: '稍后再去' 499 | }).then(e => { 500 | if (e) { 501 | LiteLoader.api.openPath(LiteLoader.path.plugins) 502 | } 503 | }) 504 | } 505 | } 506 | config.inactivePlugins.push(this.manifest!.slug) 507 | this.updateOpenDirEvent() 508 | } else if (res.message) { 509 | showDialog({ title: '安装失败', message: res.message, type: 'message' }) 510 | } 511 | }) 512 | .catch(e => { 513 | console.log('安装失败', e) 514 | showDialog({ title: '安装失败', message: e.message, type: 'message' }) 515 | }) 516 | .finally(() => { 517 | console.log('安装结束') 518 | if (update) { 519 | this.updateBtnEl!.removeAttribute('is-disabled') 520 | this.updateBtnEl!.innerText = '更新' 521 | } else { 522 | this.installBtnEl!.removeAttribute('is-disabled') 523 | this.installBtnEl!.innerText = '安装' 524 | } 525 | }) 526 | } 527 | }) 528 | } 529 | this.updateBtnEl.addEventListener('click', () => installEvent(true)) 530 | this.installBtnEl = this.shadowRoot!.querySelector('.install')! 531 | this.installBtnEl.addEventListener('click', () => installEvent()) 532 | this.uninstallBtnEl = this.shadowRoot!.querySelector('.uninstall')! 533 | this.uninstallBtnEl.addEventListener('click', async () => { 534 | config.debug && console.log('uninstall', this.manifest!.name) 535 | currentItem = pluginList[Number(this.dataset.index)] 536 | currentManifest = this.manifest! 537 | showDialog({ title: '卸载', message: `确定要卸载插件 ${this.manifest!.name} 吗?`, type: 'confirm' }).then(e => { 538 | if (e) { 539 | this.uninstallBtnEl!.innerText = '卸载中...' 540 | this.uninstallBtnEl!.setAttribute('is-disabled', '') 541 | uninstall().then(res => { 542 | if (res.success) { 543 | this.uninstallBtnEl!.innerText = '卸载' 544 | this.uninstallBtnEl!.removeAttribute('is-disabled') 545 | delete this.dataset.installed 546 | if (config.inactivePlugins.includes(this.manifest!.slug)) { 547 | this.dataset.inactive = '0' 548 | config.inactivePlugins = config.inactivePlugins.filter(e => e !== this.manifest!.slug) 549 | } 550 | this.updateOpenDirEvent() 551 | } else { 552 | showDialog({ title: '卸载失败', message: res.message, type: 'message' }) 553 | } 554 | }) 555 | } 556 | }) 557 | }) 558 | this.retryBtnEl = this.shadowRoot!.querySelector('.retry')! 559 | this.retryBtnEl.addEventListener('click', async () => { 560 | this.retryBtnEl!.innerText = '重试中...' 561 | this.retryBtnEl!.setAttribute('is-disabled', '') 562 | const manifest = await getManifest(pluginList[Number(this.dataset.index)]) 563 | if (manifest !== 404) { 564 | this.manifest = manifest 565 | } 566 | updateElProp(this, manifest, this.dataset.failed!) 567 | this.retryBtnEl!.innerText = '重试' 568 | this.retryBtnEl!.removeAttribute('is-disabled') 569 | }) 570 | this.detailBtnEl = this.shadowRoot!.querySelector('.detail')! 571 | this.detailBtnEl.addEventListener('click', async () => { 572 | LiteLoader.api.openExternal(`https://github.com/${pluginList[Number(this.dataset.index)].repo}/tree/${pluginList[Number(this.dataset.index)].branch}`) 573 | }) 574 | filterInput.addEventListener('input', () => this.updateHidden()) 575 | for (const key in filterTypes) { 576 | const item = filterTypes[key as keyof typeof filterTypes] 577 | item.qc.inputEl.addEventListener('change', () => this.updateHidden()) 578 | } 579 | this.updateHidden() 580 | this.updateOpenDirEvent() 581 | this.#initialized = true 582 | this.#initPromiseResolve?.() 583 | } 584 | 585 | static get observedAttributes() { 586 | return ['data-name', 'data-version', 'data-description', 'data-authors', 'data-icon', 'data-failed', 'data-type', 'data-dependencies', 'data-platforms'] 587 | } 588 | 589 | attributeChangedCallback(name: string, _oldValue: string | null, newValue: string | null) { 590 | config.debug && console.log('attributeChangedCallback', name, newValue ? newValue.slice(0, 100) : null) 591 | this.#initPromise.then(() => { 592 | try { 593 | switch (name) { 594 | case 'data-failed': 595 | if (newValue) { 596 | this.titleEl!.innerText = newValue 597 | this.titleEl!.style.color = 'red' 598 | this.descriptionEl!.innerText = '获取失败' 599 | } else { 600 | this.titleEl!.style.removeProperty('color') 601 | } 602 | break 603 | case 'data-name': 604 | this.titleEl!.innerText = newValue || '插件名' 605 | this.titleEl!.title = newValue || '' 606 | break 607 | case 'data-version': 608 | this.versionEl!.innerText = newValue || '版本' 609 | this.versionEl!.title = newValue || '' 610 | break 611 | case 'data-description': 612 | this.descriptionEl!.innerText = newValue || '插件描述' 613 | this.descriptionEl!.title = newValue || '' 614 | break 615 | case 'data-authors': { 616 | const arr: Array<{ name: string; link: string }> = newValue === '1' ? this.manifest!.authors! : [] 617 | 618 | this.authorsEl!.append( 619 | ...arr 620 | .map(author => { 621 | const a = document.createElement('a') 622 | a.title = author.link 623 | a.innerText = author.name 624 | a.onclick = () => LiteLoader.api.openExternal(author.link) 625 | return a 626 | }) 627 | .reduce((p, v, i) => { 628 | p[i * 2] = v 629 | if (i) p[i * 2 - 1] = ' | ' 630 | return p 631 | }, [] as Array) 632 | ) 633 | break 634 | } 635 | case 'data-type': 636 | this.typeEl!.innerText = typeMap[newValue + ''] || 'unknown' 637 | break 638 | case 'data-platforms': 639 | this.platformsEl!.title = this.platformsEl!.innerText = newValue || '' 640 | break 641 | case 'data-dependencies': { 642 | const arr: string[] = newValue === '1' ? this.manifest!.dependencies! : [] 643 | 644 | this.dependenciesItemsEl!.append( 645 | ...arr 646 | .map(e => { 647 | const a = document.createElement('a') 648 | a.title = e 649 | a.innerText = e 650 | a.onclick = () => { 651 | const item = document.getElementById(`item-${e}`) 652 | if (item) { 653 | item.scrollIntoView?.() 654 | item.classList.add('highlight-item') 655 | 656 | setTimeout(() => { 657 | item.classList.remove('highlight-item') 658 | }, 2e3) 659 | } 660 | } 661 | return a 662 | }) 663 | .reduce((p, v, i) => { 664 | p[i * 2] = v 665 | if (i) p[i * 2 - 1] = ' | ' 666 | return p 667 | }, [] as Array) 668 | ) 669 | break 670 | } 671 | case 'data-icon': { 672 | let src: string, src1: string 673 | if (newValue?.startsWith?.('data:image')) { 674 | src = newValue 675 | } else { 676 | ;[src, src1] = (newValue || '').split(',') 677 | } 678 | this.iconEl!.src = src || defaultIcon 679 | let num = 0 680 | this.iconEl!.addEventListener('error', () => { 681 | if (this.iconEl!.src === defaultIcon) { 682 | // 防止下次出现 https://github.com/ltxhhz/LL-plugin-list-viewer/issues/30 683 | return 684 | } 685 | if (src1 && num < 3) { 686 | //兼容打包方式(路径相对src,打包后才正常) 687 | const iconPath = this.manifest!.icon!.replace(/^\.?\//, '') 688 | switch (num) { 689 | case 0: 690 | this.iconEl!.src = src.replace(iconPath, `src/${iconPath}`) 691 | break 692 | case 1: 693 | this.iconEl!.src = src1 694 | break 695 | case 2: 696 | this.iconEl!.src = src1.replace(iconPath, `src/${iconPath}`) 697 | break 698 | } 699 | } else { 700 | this.iconEl!.src = defaultIcon 701 | } 702 | num++ 703 | }) 704 | break 705 | } 706 | default: 707 | break 708 | } 709 | } catch (error) { 710 | console.error(this.dataset.name || this.dataset.failed, error) 711 | } 712 | }) 713 | } 714 | 715 | updateOpenDirEvent() { 716 | if (this.manifest && LiteLoader.plugins[this.manifest.slug] && this.dataset.installed === '1') { 717 | this.titleEl!.title = '点击打开插件所在目录' 718 | this.titleEl!.addEventListener('click', () => { 719 | LiteLoader.api.openPath(LiteLoader.plugins[this.manifest!.slug].path.plugin) 720 | }) 721 | this.titleEl!.style.cursor = 'pointer' 722 | } 723 | } 724 | 725 | /** 726 | * 过滤用,判断是否应该隐藏 727 | */ 728 | updateHidden() { 729 | try { 730 | const authors: Array<{ name: string; link: string }> = this.dataset.authors === '1' ? this.manifest!.authors : [] 731 | const str = (this.dataset.name || '') + (this.dataset.version || '') + (this.dataset.description || '') + (this.dataset.version || '') + authors.map(e => e.name).join('') 732 | if ((!filterInput.value || str.toLowerCase().includes(filterInput.value.toLowerCase())) && (filterTypes[this.dataset.type!]?.checked ?? true)) { 733 | this.hidden = false 734 | } else { 735 | this.hidden = true 736 | } 737 | } catch (error) { 738 | console.error(this.manifest?.slug || this.dataset.name, error) 739 | } 740 | } 741 | } 742 | customElements.define('plugin-item', PluginListClass) 743 | return {} as InstanceType 744 | } 745 | 746 | function updateElProp(el: PluginItemElement, manifest: Manifest | null | 404, repo: string) { 747 | if (manifest !== 404 && manifest !== null) { 748 | el.id = `item-${manifest.slug}` 749 | el.dataset.name = manifest.name 750 | el.manifest = manifest 751 | el.updateOpenDirEvent() 752 | el.dataset.description = manifest.description 753 | el.dataset.lower4 = Number(manifest.manifest_version) >= 4 ? '' : '1' 754 | el.dataset.authors = manifest.authors ? '1' : '' 755 | el.dataset.platforms = manifest.platform.join(' | ') 756 | el.dataset.installed = LiteLoader.plugins[manifest.slug] ? '1' : '' 757 | el.dataset.slug = manifest.slug 758 | const icon = getIconUrls(pluginList[Number(el.dataset.index)], manifest) 759 | if (Array.isArray(icon)) { 760 | el.dataset.icon = icon.toString() 761 | } else { 762 | icon.then(icon => { 763 | el.dataset.icon = icon.toString() 764 | }) 765 | } 766 | el.dataset.defaultIcon = defaultIcon 767 | el.dataset.type = manifest.type 768 | el.dataset.dependencies = manifest.dependencies?.length ? '1' : '' 769 | delete el.dataset.failed 770 | if (LiteLoader.plugins[manifest.slug]) { 771 | el.dataset.version = LiteLoader.plugins[manifest.slug].manifest.version 772 | config.debug && console.log(manifest.slug, LiteLoader.plugins[manifest.slug], manifest) 773 | el.dataset.update = compare(manifest.version, LiteLoader.plugins[manifest.slug]?.manifest?.version ?? manifest.version, '>') ? '1' : '' 774 | el.shadowRoot!.querySelector('.newer-version')!.innerText = `-> ${manifest.version}` 775 | } else { 776 | el.dataset.version = manifest.version 777 | } 778 | if (config.inactivePlugins.includes(manifest.slug)) { 779 | if (!LiteLoader.plugins[manifest.slug]) { 780 | el.dataset.inactive = '1' 781 | } else { 782 | config.inactivePlugins = config.inactivePlugins.filter(v => v !== manifest.slug) 783 | } 784 | } 785 | } else { 786 | el.dataset.failed = repo 787 | if (manifest === 404) { 788 | el.dataset.run = '1' 789 | } 790 | } 791 | } 792 | 793 | async function getList(noCache = false, again = false): Promise { 794 | let url = '' 795 | if (config.useMirror) { 796 | const m = getGithubMirror(!again) 797 | url = useMirror(getRawUrl(listUrl, listUrl.file), m || getRandomItem(originMirrors), !!m) 798 | } else { 799 | url = getRawUrl(listUrl, listUrl.file) 800 | } 801 | return await fetchWithTimeout(url, { 802 | cache: noCache ? 'no-cache' : 'default' 803 | }) 804 | .then(res => { 805 | if (res.status === 200) { 806 | return JSON.parse(res.str) 807 | } else { 808 | throw new Error(JSON.stringify(res)) 809 | } 810 | }) 811 | .catch(err => { 812 | if (again) { 813 | console.error(`getList ${url}`, err) 814 | return String(err) 815 | } else { 816 | console.warn(`getList ${url}`, err) 817 | return getList(noCache, true) 818 | } 819 | }) 820 | } 821 | 822 | async function getListGithubIO(noCache = false): Promise | string> { 823 | const url = 'https://ltxhhz.github.io/LL-plugin-list-viewer/all-manifest.json' 824 | return await fetchWithTimeout(url, { 825 | cache: noCache ? 'no-cache' : 'default' 826 | }) 827 | .then(res => { 828 | if (res.status === 200) { 829 | return JSON.parse(res.str) 830 | } else { 831 | throw new Error(JSON.stringify(res)) 832 | } 833 | }) 834 | .catch(err => { 835 | console.error(`getListGithubIO ${url}`, err) 836 | return String(err) 837 | }) 838 | } 839 | 840 | async function getManifest(item: Plugin, noCache = false, again = false): Promise { 841 | // if (item.repo === 'ltxhhz/LL-plugin-list-viewer') { 842 | // return Promise.resolve({ 843 | // $schema: './manifest_schema.json', 844 | // manifest_version: 4, 845 | // type: 'extension', 846 | // name: '插件列表查看', 847 | // slug: 'list-viewer', 848 | // description: '插件列表查看·安装·更新', 849 | // version: '9.9.9', 850 | // authors: [ 851 | // { 852 | // name: 'ltxhhz', 853 | // link: 'https://github.com/ltxhhz' 854 | // } 855 | // ], 856 | // platform: ['win32', 'linux', 'darwin'], 857 | // injects: { 858 | // main: './main/index.js', 859 | // preload: './preload/index.js', 860 | // renderer: './renderer/index.js' 861 | // }, 862 | // repository: { 863 | // repo: 'ltxhhz/LL-plugin-list-viewer', 864 | // branch: 'master' 865 | // } 866 | // } as any) 867 | // } 868 | let url: string 869 | 870 | let m = getGithubMirror(!again) 871 | if (config.useMirror) { 872 | url = useMirror(getRawUrl(item, 'manifest.json'), m || getRandomItem(originMirrors), !!m) 873 | } else { 874 | url = getRawUrl(item, 'manifest.json') 875 | } 876 | return await fetchWithTimeout(url, { 877 | cache: noCache ? 'no-cache' : 'default' 878 | }) 879 | .then(res => { 880 | if (res.status === 200) { 881 | return JSON.parse(res.str) 882 | } else { 883 | m = getGithubMirror(!again) 884 | if (config.useMirror) { 885 | url = useMirror(getRawUrl(item, 'package.json'), m || getRandomItem(originMirrors), !!m) 886 | } else { 887 | url = getRawUrl(item, 'package.json') 888 | } 889 | return fetchWithTimeout(url, { 890 | cache: noCache ? 'no-cache' : 'default' 891 | }).then(async res1 => { 892 | if (res1.status === 200) { 893 | const pkg = JSON.parse(res1.str) 894 | const obj = pkg.liteloader_manifest 895 | if (obj) { 896 | obj.version = pkg.version 897 | obj.description = pkg.description 898 | obj.authors = typeof pkg.author === 'string' ? [{ name: pkg.author, link: `https://github.com/${pkg.author}` }] : [pkg.author] 899 | return obj 900 | } 901 | } else { 902 | if (res.status === 404 || res1.status === 404) { 903 | return 404 904 | } 905 | } 906 | return null 907 | }) 908 | } 909 | }) 910 | .catch(err => { 911 | if (again) { 912 | console.error(`getManifest ${url}`, err) 913 | return null 914 | } else { 915 | console.warn(`getManifest ${url}`, err) 916 | return getManifest(item, noCache, true) 917 | } 918 | }) 919 | } 920 | 921 | async function install(release = false): Promise { 922 | let url: string 923 | config.debug && console.log('install', currentItem) 924 | 925 | if (release) { 926 | const urlObj = await getLatestReleaseUrl(currentItem, currentManifest) 927 | if (urlObj.zip) { 928 | url = urlObj.zip 929 | } else if (urlObj.message) { 930 | return { 931 | success: false, 932 | message: `github api 获取资产包失败\n\n${urlObj.message}` 933 | } 934 | } else { 935 | const res = await showDialog({ 936 | title: '未发现zip资产包', 937 | message: '是否使用源代码包安装?', 938 | type: 'confirm' 939 | }) 940 | if (res) { 941 | url = urlObj.ball 942 | } else { 943 | url = '' 944 | } 945 | } 946 | if (url === '') { 947 | return { 948 | success: false, 949 | message: '' 950 | } 951 | } 952 | if (!url) { 953 | return { 954 | success: false, 955 | message: '获取release包失败' 956 | } 957 | } 958 | } else { 959 | url = getArchiveUrl(currentItem) 960 | } 961 | // throw new Error('not implemented') 962 | if (config.useMirror) { 963 | const m = getGithubMirror() 964 | return ListViewer.getPkg(currentManifest.slug, useMirror(url, m || getRandomItem(originMirrors), !!m)) 965 | } else { 966 | return ListViewer.getPkg(currentManifest.slug, url) 967 | } 968 | } 969 | 970 | function getIconUrls(item: Plugin, manifest: Manifest): [string?, string?] | Promise<[string?]> { 971 | if (config.useGithubIO && listIconsPromise) { 972 | return listIconsPromise.then(() => [listIcons[manifest.slug]]) 973 | } else if (manifest.icon) { 974 | const iconPath = manifest.icon.replace(/^\.?\//, '') 975 | const m = getGithubMirror(true) 976 | const m1 = getGithubMirror() 977 | if (config.useMirror) { 978 | return [useMirror(getRawUrl(item, iconPath), m || getRandomItem(originMirrors), !!m), useMirror(getRawUrl(item, iconPath), m1 || getRandomItem(originMirrors), !!m1)] 979 | } else { 980 | return [getRawUrl(item, iconPath)] 981 | } 982 | } 983 | return [] 984 | } 985 | 986 | async function getIconsGithubIO(noCache = false): Promise | string> { 987 | return fetchWithTimeout('https://ltxhhz.github.io/LL-plugin-list-viewer/all-icons.json', { 988 | cache: noCache ? 'no-cache' : 'default' 989 | }) 990 | .then(res => { 991 | if (res.status === 200) { 992 | return JSON.parse(res.str) 993 | } else { 994 | throw new Error(JSON.stringify(res)) 995 | } 996 | }) 997 | .catch(err => { 998 | console.error(`getIconsGithubIO`, err) 999 | return String(err) 1000 | }) 1001 | } 1002 | 1003 | function uninstall() { 1004 | return ListViewer.removePkg(currentManifest.slug) 1005 | } 1006 | 1007 | function getGithubMirror(first = false): string | undefined { 1008 | //https://cdn.jsdelivr.net/gh/[user/repo]@[branch]/[file] 1009 | if (first) { 1010 | return config.mirrors.downloadUrl[0] 1011 | } 1012 | return getRandomItem(config.mirrors.downloadUrl.splice(1)) 1013 | } 1014 | 1015 | function getRawUrl(item: Plugin, file: string) { 1016 | return `https://github.com/${item.repo}/raw/refs/heads/${item.branch}/${file}` 1017 | } 1018 | 1019 | function getArchiveUrl(item: Plugin) { 1020 | return `https://github.com/${item.repo}/archive/refs/heads/${item.branch}.zip` 1021 | } 1022 | 1023 | async function getLatestReleaseUrl(item: Plugin, manifest: Manifest): Promise<{ zip: string | undefined; ball: string; message: string | undefined }> { 1024 | const url = `https://api.github.com/repos/${item.repo}/releases/latest` 1025 | const headers: Record = {} 1026 | if (config.githubToken) { 1027 | headers.Authorization = `Bearer ${config.githubToken}` 1028 | } 1029 | const body = await fetchWithTimeout(url, { 1030 | headers 1031 | }) 1032 | .then(e => JSON.parse(e.str)) 1033 | .catch(err => { 1034 | throw new Error(`${err.message} \n${url}`) 1035 | }) 1036 | const zipFile = 1037 | body.assets?.find?.(asset => asset.name === `${manifest.slug}.zip`) ?? 1038 | body.assets?.find?.(asset => asset.name === `${manifest.name}.zip`) ?? 1039 | body.assets?.find?.(asset => asset.name.endsWith('.zip')) 1040 | return { 1041 | zip: zipFile?.browser_download_url, 1042 | ball: `https://github.com/${item.repo}/archive/refs/tags/${body.tag_name}.zip`, //body.zipball_url 1043 | message: body.message 1044 | } 1045 | } 1046 | -------------------------------------------------------------------------------- /src/renderer/utils.ts: -------------------------------------------------------------------------------- 1 | // 接口来自 https://github.com/XIU2/UserScript/blob/master/GithubEnhanced-High-Speed-Download.user.js 2 | 3 | import type { Config } from '../global' 4 | 5 | const mirrorRepo = 'https://github.com/XIU2/UserScript/blob/master/GithubEnhanced-High-Speed-Download.user.js' 6 | const hostReg = /^https?:\/\/[^/]+/ 7 | 8 | export const originMirrors = ['https://mirror.ghproxy.com/', 'https://ghproxy.net/', 'https://github.moeyy.xyz/'] 9 | export const thisSlug = 'list-viewer' 10 | 11 | export type SortType = 'default' | 'installed' | 'outdated' 12 | 13 | export let config: Config 14 | 15 | export async function initConfig() { 16 | const defaultConfig:Config = { 17 | inactivePlugins: [], 18 | debug: false, 19 | useMirror: true, 20 | useGithubIO: false, 21 | mirrors: { 22 | downloadUrl: ['https://cdn.jsdelivr.net/gh'] 23 | // rawUrl: [] 24 | }, 25 | listSortType: 'default', 26 | githubToken: '', 27 | listLastForceUpdate: 0, 28 | proxy: { 29 | url: '', 30 | enabled: false 31 | }, 32 | requestTimeout: 3e3 33 | } 34 | config = await (LiteLoader.api.config.get(thisSlug, defaultConfig) as PromiseLike) 35 | const save = debounce((obj: Config) => { 36 | const objCloned = JSON.parse(JSON.stringify(obj)) 37 | config.debug && console.log('save obj', objCloned) 38 | LiteLoader.api.config.set(thisSlug, objCloned) 39 | }, 1e3) 40 | config = deepWatch(config, () => { 41 | save(config) 42 | }) 43 | } 44 | export function getDynamicMirror() { 45 | const m = getRandomItem(originMirrors) 46 | const url = useMirror(mirrorRepo, m, false) 47 | return fetchWithTimeout(url) 48 | .then(e => { 49 | if (e.status === 200) { 50 | const reg = /(\w+)\s?=\s?(\[[\s\S]+?\n\s+\]),/g 51 | let res = reg.exec(e.str) 52 | let download_url_us: string[][] = [], 53 | download_url: string[][] = [], 54 | raw_url: string[][] = [] 55 | while (res) { 56 | // console.log(res) 57 | switch (res[1]) { 58 | case 'download_url_us': 59 | download_url_us = eval(res[2].replaceAll(' ', '\n')) 60 | break 61 | case 'download_url': 62 | download_url = eval(res[2].replaceAll(' ', '\\n')) 63 | break 64 | case 'raw_url': 65 | raw_url = eval(res[2].replaceAll(' ', '\\n')) 66 | raw_url.shift() 67 | break 68 | default: 69 | break 70 | } 71 | res = reg.exec(e.str) 72 | } 73 | return { 74 | download_url_us, 75 | download_url, 76 | raw_url 77 | } 78 | } else { 79 | throw new Error(`Fetch mirror failed: ${e.statusText}`) 80 | } 81 | }) 82 | .catch(err => { 83 | throw new Error(`error message: ${err.message}\nurl: ${url}`) 84 | }) 85 | } 86 | 87 | export function getRandomItem(arr?: undefined): undefined 88 | export function getRandomItem(arr: Array): T 89 | export function getRandomItem(arr: Array | undefined): T | undefined 90 | export function getRandomItem(arr: Array | undefined): T | undefined { 91 | return arr ? arr[Math.floor(Math.random() * arr.length)] : undefined 92 | } 93 | 94 | export function useMirror(url: string, mirror: string, removeHost = true) { 95 | if (/\/gh$/.test(mirror) && mirror.includes('jsdelivr')) { 96 | return ( 97 | mirror + 98 | url 99 | .replace(hostReg, '') 100 | .replace('/raw/', '@') 101 | .replace(/@v(?!v)/, '@vv') 102 | ) 103 | } else { 104 | return mirror + (removeHost ? url.replace(hostReg, '') : url) 105 | } 106 | } 107 | 108 | export function useGeneralMirror(url: string, mirror: string) { 109 | return mirror + url 110 | } 111 | 112 | export function localFetch(path: string, plugin = 'list-viewer') { 113 | return fetch(`local:///${LiteLoader.plugins[plugin].path.plugin.replace(':\\', '://').replaceAll('\\', '/')}/${path.startsWith('/') ? path.slice(1) : path}`) 114 | } 115 | 116 | export function fetchWithTimeout( 117 | url: string, 118 | options?: RequestInit, 119 | timeout = config.requestTimeout 120 | ): Promise<{ 121 | data: ArrayBuffer 122 | str: string 123 | status?: number 124 | statusText?: string 125 | url?: string 126 | }> { 127 | url = getRedirectedGitHubUrl(url) || url 128 | config.debug && console.log('fetchWithTimeout', url) 129 | if (config.proxy.enabled) { 130 | return ListViewer.request(url, { 131 | timeout, 132 | headers: options?.headers as Record | undefined, 133 | body: options?.body, 134 | method: options?.method as 'GET' | 'POST' | undefined 135 | }).then(res => { 136 | if (res.success) { 137 | return res.data 138 | } else { 139 | throw new Error(res.message) 140 | } 141 | }) 142 | } 143 | return new Promise((resolve, reject) => { 144 | const controller = new AbortController() 145 | const timeoutId = setTimeout(() => { 146 | controller.abort() 147 | reject(new Error('请求超时')) 148 | }, timeout) 149 | 150 | fetch(url, { ...options, signal: controller.signal }) 151 | .then(async response => { 152 | clearTimeout(timeoutId) 153 | const ab = await response.arrayBuffer() 154 | resolve({ 155 | data: ab, 156 | str: new TextDecoder().decode(ab), 157 | status: response.status, 158 | statusText: response.statusText, 159 | url: response.url 160 | }) 161 | }) 162 | .catch(error => { 163 | clearTimeout(timeoutId) 164 | reject(error) 165 | }) 166 | }) 167 | } 168 | 169 | export function debounce(func: (...args: any[]) => any, delay: number) { 170 | let timeoutId: any 171 | return function (...args: any[]) { 172 | if (timeoutId) { 173 | clearTimeout(timeoutId) 174 | } 175 | timeoutId = setTimeout(() => { 176 | func(...args) 177 | }, delay) 178 | } 179 | } 180 | 181 | export function deepWatch(obj: T, callback: () => void): T { 182 | const observer = new Proxy(obj, { 183 | set(target, key, value, receiver) { 184 | const oldValue = target[key] 185 | if (oldValue !== value) { 186 | // 如果值发生变化,调用回调函数 187 | callback() 188 | // 对象属性也是对象时,进行深度监听 189 | if (typeof value === 'object' && value !== null && !Array.isArray(value)) { 190 | deepWatch(value, callback) 191 | } 192 | } 193 | // 设置新的值 194 | return Reflect.set(target, key, value, receiver) 195 | } 196 | }) 197 | 198 | if (Array.isArray(obj)) { 199 | for (let i = 0; i < obj.length; i++) { 200 | if (typeof obj[i] === 'object' && obj[i] !== null) { 201 | obj[i] = deepWatch(obj[i], callback) 202 | } 203 | } 204 | } else { 205 | for (const key in obj) { 206 | if (typeof obj[key] === 'object' && obj[key] !== null) { 207 | obj[key] = deepWatch(obj[key], callback) 208 | } 209 | } 210 | } 211 | 212 | return observer 213 | } 214 | 215 | export function getRedirectedGitHubUrl(url: string) { 216 | const regex = /^https:\/\/github\.com\/([^/]+)\/([^/]+)\/raw\/refs\/heads\/([^/]+)\/(.+)/ 217 | const match = url.match(regex) 218 | 219 | if (match) { 220 | const user = match[1] 221 | const repo = match[2] 222 | const branch = match[3] 223 | const filePath = match[4] 224 | return `https://raw.githubusercontent.com/${user}/${repo}/${branch}/${filePath}` 225 | } 226 | // throw new Error('Invalid GitHub URL') 227 | return 228 | } 229 | 230 | /** 231 | * 判断时间戳是否和今天是同一天 232 | */ 233 | export function isSameDay(timestamp: number) { 234 | const inputDate = new Date(timestamp) 235 | const currentDate = new Date() 236 | 237 | return inputDate.getFullYear() === currentDate.getFullYear() && inputDate.getMonth() === currentDate.getMonth() && inputDate.getDate() === currentDate.getDate() 238 | } 239 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "files": [], 3 | "references": [ 4 | { "path": "./tsconfig.node.json" }, 5 | { "path": "./tsconfig.web.json" } 6 | ] 7 | } 8 | -------------------------------------------------------------------------------- /tsconfig.node.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@electron-toolkit/tsconfig/tsconfig.node.json", 3 | "include": ["electron.vite.config.*", "src/main/**/*", "src/preload/**/*"], 4 | "compilerOptions": { 5 | "composite": true, 6 | "types": ["electron-vite/node"] 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /tsconfig.web.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@electron-toolkit/tsconfig/tsconfig.web.json", 3 | "include": ["src/renderer/**/*.ts", "src/preload/*.d.ts", "src/global.d.ts"], 4 | "compilerOptions": { 5 | "composite": true 6 | } 7 | } 8 | --------------------------------------------------------------------------------