Skip to content
This repository has been archived by the owner on Jun 16, 2024. It is now read-only.

Commit

Permalink
chore: 1.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
adproqwq committed Jun 2, 2024
1 parent 7f0c653 commit 60ffdc1
Show file tree
Hide file tree
Showing 13 changed files with 93 additions and 76 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@

支持收集QQ聊天中的快照链接,可以在插件设置页查看。

## 说明
本插件依赖于

1. [插件检测更新API](https://github.com/adproqwq/LiteLoaderQQNT-CheckUpdateModule) - 用于插件自更新

## 安装方法
1. 下载最新 [发行版](https://github.com/adproqwq/LiteLoaderQQNT-GKDInspectForQQNT/releases) 并解压
2. 将文件夹移动至 `LiteLoaderQQNT数据目录/plugins/` 下面
Expand Down
5 changes: 3 additions & 2 deletions changeLog.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# 新增
1. 清除所有收集到的快照链接功能
1. 使用`插件检测更新API`插件为本插件提供自更新功能,请安装此插件以正常使用本插件
2. 升级内置的`GKD网络审查工具复制增强`脚本
3. 修改了文件的写出方式
7 changes: 6 additions & 1 deletion electron.vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,12 @@ export default defineConfig({
},
}),
viteCp({
targets: [{ src: './manifest.json', dest: 'dist' }],
targets: [
{ src: './manifest.json', dest: 'dist' },
{ src: './changeLog.md', dest: 'dist' },
{ src: './src/pages', dest: 'dist/pages' },
{ src: './src/scripts', dest: 'dist/scripts' },
],
}),
viteZipPack({
in: OUTPUT_DIR,
Expand Down
7 changes: 4 additions & 3 deletions manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"name": "GKD网页审查工具 for QQNT",
"slug": "LiteLoaderQQNT_GKDInspectForQQNT",
"description": "用于在QQNT中快捷开始审查快照",
"version": "1.2.1",
"version": "1.3.0",
"authors": [
{
"name": "Adpro",
Expand All @@ -17,6 +17,7 @@
"linux",
"darwin"
],
"dependencies": ["LiteLoaderQQNT_CheckUpdateModule"],
"injects": {
"main": "./main/index.js",
"preload": "./preload/index.js",
Expand All @@ -26,8 +27,8 @@
"repo": "adproqwq/LiteLoaderQQNT-GKDInspectForQQNT",
"branch": "main",
"release": {
"tag": "v1.2.1",
"file": "LiteLoaderQQNT-GKDInspectForQQNT"
"tag": "v1.3.0",
"file": "LiteLoaderQQNT-GKDInspectForQQNT.zip"
}
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "liteloaderqqnt-gkd-inspect-for-qqnt",
"version": "1.2.1",
"version": "1.3.0",
"description": "用于在QQNT中快捷开始审查快照",
"main": "index.js",
"scripts": {
Expand Down
3 changes: 3 additions & 0 deletions src/global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,9 @@ declare namespace LiteLoader {
openPath: (path: string) => void,
openExternal: (url: string) => void,
disablePlugin: (slug: string) => void,
checkUpdate: (slug: string, type?: string) => Promise<boolean | null>,
downloadUpdate: (slug: string, url?: string) => Promise<boolean | null>,
showRelaunchDialog: (slug: string, showChangeLog?: boolean, changeLogFile?: string) => void,
config: ILiteLoaderAPIConfig,
}

Expand Down
28 changes: 16 additions & 12 deletions src/main/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import { BrowserWindow, ipcMain } from 'electron';
import { BrowserWindow, ipcMain, app } from 'electron';
import betterCopy from '../scripts/betterCopy';
import { ISnapshotCollection } from '../config/snapshotCollection';
import fs from 'node:fs';
import detail from '../pages/detail';
import detailScript from '../scripts/detailScript';

// 判断是否存在数据文件夹
if(!fs.existsSync(LiteLoader.plugins.LiteLoaderQQNT_GKDInspectForQQNT.path.data)){
Expand All @@ -12,16 +10,12 @@ if(!fs.existsSync(LiteLoader.plugins.LiteLoaderQQNT_GKDInspectForQQNT.path.data)
if(err) throw err;
});
}
// 写出网页文件
fs.writeFile(`${LiteLoader.plugins.LiteLoaderQQNT_GKDInspectForQQNT.path.data}/index.html`, detail, (err) => {
if(err) throw err;
});
fs.writeFile(`${LiteLoader.plugins.LiteLoaderQQNT_GKDInspectForQQNT.path.data}/index.js`, detailScript, (err) => {
if(err) throw err;
});
// 复制网页文件到data
fs.copyFileSync(`${LiteLoader.plugins.LiteLoaderQQNT_GKDInspectForQQNT.path.plugin}/pages/detail.html`, `${LiteLoader.plugins.LiteLoaderQQNT_GKDInspectForQQNT.path.data}/index.html`);
fs.copyFileSync(`${LiteLoader.plugins.LiteLoaderQQNT_GKDInspectForQQNT.path.plugin}/scripts/detailScript.js`, `${LiteLoader.plugins.LiteLoaderQQNT_GKDInspectForQQNT.path.data}/index.js`);

// 监听 LL_GKDInspectForQQNT.openInspectWindow 频道,获取携带的快照链接
ipcMain.on('LL_GKDInspectForQQNT.openInspectWindow', (e, url: string) => {
ipcMain.on('LL_GKDInspectForQQNT.openInspectWindow', (_, url: string) => {
// 创建一个新窗口
const inspectWindow = new BrowserWindow({
height: 1080, // 窗口高度
Expand Down Expand Up @@ -51,7 +45,7 @@ ipcMain.on('LL_GKDInspectForQQNT.openInspectWindow', (e, url: string) => {
});
});

ipcMain.on('LL_GKDInspectForQQNT.openDetailWindow', (e) => {
ipcMain.on('LL_GKDInspectForQQNT.openDetailWindow', () => {
// 创建一个新窗口
const detailWindow = new BrowserWindow({
height: 1080, // 窗口高度
Expand Down Expand Up @@ -115,6 +109,16 @@ ipcMain.on('LL_GKDInspectForQQNT.openDetailWindow', (e) => {
});
});

app.whenReady().then(async () => {
const isHaveUpdate = await LiteLoader.api.checkUpdate('LiteLoaderQQNT_GKDInspectForQQNT');
if(isHaveUpdate){
const updateResult = await LiteLoader.api.downloadUpdate('LiteLoaderQQNT_GKDInspectForQQNT');
if(updateResult){
LiteLoader.api.showRelaunchDialog('LiteLoaderQQNT_GKDInspectForQQNT', true);
}
}
});

export const onBrowserWindowCreated = (window: BrowserWindow) => {
console.log('[GKD网页审查工具 for QQNT] 窗口已创建');
console.log(window);
Expand Down
4 changes: 1 addition & 3 deletions src/pages/detail.ts → src/pages/detail.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
export default `
<html>
<head>
<title>快照收集详情</title>
Expand Down Expand Up @@ -32,5 +31,4 @@
<script src="https://cdn.bootcdn.net/ajax/libs/axios/1.6.8/axios.min.js"></script>
<script src="./index.js"></script>
</body>
</html>
`;
</html>
3 changes: 1 addition & 2 deletions src/pages/settings.ts → src/pages/settings.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
export default `
<setting-section data-title="详情">
<setting-panel>
<setting-list data-direction="column">
Expand Down Expand Up @@ -51,4 +50,4 @@
</setting-item>
</setting-list>
</setting-panel>
</setting-section>`
</setting-section>
1 change: 1 addition & 0 deletions src/preload/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ contextBridge.exposeInMainWorld('LL_GKDInspectForQQNT', {
ipcRenderer.send('LL_GKDInspectForQQNT.openInspectWindow', url);
},
openDetailWindow: () => {
// 同上
ipcRenderer.send('LL_GKDInspectForQQNT.openDetailWindow');
},
});
6 changes: 4 additions & 2 deletions src/renderer/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import addInspectEntry from '../utils/addInspectEntry';
import settingsPage from '../pages/settings';
import { slug } from '../config/commonInfo';
import { snapshotCollections } from '../config/snapshotCollection';

Expand All @@ -10,10 +9,13 @@ const onload = () => {
onload();

export const onSettingWindowCreated = async (view: HTMLElement) => {
const pluginPath = LiteLoader.plugins.LiteLoaderQQNT_GKDInspectForQQNT.path.plugin;
const settingsPage = await (await fetch(`local:///${pluginPath}/pages/settings.html`)).text();

// 设置页的事件监听
view.innerHTML = settingsPage;

(view.querySelector('#pluginVersion') as HTMLParagraphElement).innerHTML = globalThis.LiteLoader.plugins.LiteLoaderQQNT_GKDInspectForQQNT.manifest.version;
(view.querySelector('#pluginVersion') as HTMLParagraphElement).innerHTML = LiteLoader.plugins.LiteLoaderQQNT_GKDInspectForQQNT.manifest.version;

(view.querySelector('#github') as HTMLButtonElement).addEventListener('click', () => {
globalThis.LiteLoader.api.openExternal('https://github.com/adproqwq/LiteLoaderQQNT-GKDInspectForQQNT');
Expand Down
48 changes: 48 additions & 0 deletions src/scripts/detailScript.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
const detailTable = `
<table id="detailTable" class="list">
<thead>
<tr>
<th>快照链接</th>
<th>适配情况</th>
<th>操作</th>
</tr>
</thead>
<tbody id="detailBody"></tbody>
</table>`;
document.getElementById('listDiv').innerHTML = detailTable;

Check failure on line 12 in src/scripts/detailScript.js

View workflow job for this annotation

GitHub Actions / build

'document' is not defined

Check failure on line 12 in src/scripts/detailScript.js

View workflow job for this annotation

GitHub Actions / build

'document' is not defined

axios.get('./config.json').then((data) => {

Check failure on line 14 in src/scripts/detailScript.js

View workflow job for this annotation

GitHub Actions / build

'axios' is not defined

Check failure on line 14 in src/scripts/detailScript.js

View workflow job for this annotation

GitHub Actions / build

'axios' is not defined
data = data.data;
let index = 0;
let tbody = '';
data.data.forEach((d) => {
const eachSnapshot = `
<tr>
<td>${d.snapshotUrl}</td>
<td>
<div>${d.status}</div>
<button onclick="status(${index}, 0);">未适配</button>
<button onclick="status(${index}, 1);">已适配</button>
<button onclick="status(${index}, 2);">无activityId</button>
<button onclick="status(${index}, 3);">现有规则有效</button>
<button onclick="status(${index}, 4);">无法适配</button>
<button onclick="status(${index}, 5);">不予适配</button>
</td>
<td>
<button onclick='review("${d.snapshotUrl}");'>审查</button>
</td>
</tr>
`;
index++;
tbody += eachSnapshot;
});
document.getElementById('detailBody').innerHTML = tbody;

Check failure on line 39 in src/scripts/detailScript.js

View workflow job for this annotation

GitHub Actions / build

'document' is not defined

Check failure on line 39 in src/scripts/detailScript.js

View workflow job for this annotation

GitHub Actions / build

'document' is not defined
});

function review(snapshot){
window.open(snapshot);

Check failure on line 43 in src/scripts/detailScript.js

View workflow job for this annotation

GitHub Actions / build

'window' is not defined

Check failure on line 43 in src/scripts/detailScript.js

View workflow job for this annotation

GitHub Actions / build

'window' is not defined
}

function status(index, statusNumber){
window.open(`${String(index)}/${String(statusNumber)}/status`);

Check failure on line 47 in src/scripts/detailScript.js

View workflow job for this annotation

GitHub Actions / build

'window' is not defined

Check failure on line 47 in src/scripts/detailScript.js

View workflow job for this annotation

GitHub Actions / build

'window' is not defined
}
50 changes: 0 additions & 50 deletions src/scripts/detailScript.ts

This file was deleted.

0 comments on commit 60ffdc1

Please sign in to comment.