diff --git a/model/base.js b/model/base.js
index 6f55ee3..8eae49e 100644
--- a/model/base.js
+++ b/model/base.js
@@ -21,9 +21,6 @@ export default class Base {
/**
* 截图默认数据
- * @param saveId html保存id
- * @param tplFile 模板html路径
- * @param pluResPath 插件资源路径
*/
get screenData() {
return {
diff --git a/model/bili-info.js b/model/bili-info.js
deleted file mode 100644
index b7a6c29..0000000
--- a/model/bili-info.js
+++ /dev/null
@@ -1,17 +0,0 @@
-import Base from './base.js'
-
-export default class BiliInfoModel extends Base {
- constructor (e) {
- super(e)
- this.model = 'bili-info'
- }
-
- /** 生成版本信息图片 */
- async getData (biliInfoData) {
- return {
- ...this.screenData,
- saveId: 'bili-info',
- biliInfoData: biliInfoData,
- }
- }
-}
diff --git a/model/config.js b/model/config.js
index a2a8703..9e36032 100644
--- a/model/config.js
+++ b/model/config.js
@@ -2,76 +2,58 @@ import fs from 'node:fs';
import _ from 'lodash';
import YAML from 'yaml';
import chokidar from 'chokidar';
-import Base from "./base.js";
+import Base from './base.js';
-class RConfig extends Base{
- constructor(e) {
- super(e);
- this.configPath = `./plugins/${RConfig.pluginName}/config/`;
- this.previousContent = new Map(); // 存储每个文件之前的内容
+class RConfig extends Base {
+ constructor(e) {
+ super(e);
+ this.configPath = `./plugins/${RConfig.pluginName}/config/`;
+ this.previousContent = new Map(); // 存储每个文件之前的内容
+ }
+
+ getConfig(name) {
+ return this.getYaml(name);
+ }
+
+ getYaml(name, isWatch = true) {
+ let file = this.getFilePath(name);
+ const yaml = YAML.parse(fs.readFileSync(file, 'utf8'));
+
+ if (isWatch) {
+ this.previousContent.set(name, yaml); // 保存初始内容
+ this.watch(file, name);
}
+ return yaml;
+ }
- getConfig(name) {
- return this.getYaml(name);
- }
-
- getField(name, field) {
- const config = this.getConfig(name);
- return config[field];
- }
-
- updateField(name, field, value) {
- let config = this.getConfig(name);
- config[field] = value;
- logger.mark(`[R插件][修改配置项][${name}][${field}]修改为:${value}`);
- this.saveAllConfig(name, config);
- }
-
- deleteField(name, field) {
- let config = this.getConfig(name);
- delete config[field];
- this.saveAllConfig(name, config);
- }
-
- getYaml(name, isWatch = true) {
- let file = this.getFilePath(name);
- const yaml = YAML.parse(fs.readFileSync(file, 'utf8'));
-
- if (isWatch) {
- this.previousContent.set(name, yaml); // 保存初始内容
- this.watch(file, name);
- }
- return yaml;
- }
-
- getFilePath(name) {
- return `${this.configPath}${name}.yaml`;
- }
-
- watch(file, name) {
- const watcher = chokidar.watch(file);
-
- watcher.on('change', path => {
- const currentContent = YAML.parse(fs.readFileSync(path, 'utf8'));
- const previousContent = this.previousContent.get(name);
-
- if (!_.isEqual(previousContent, currentContent)) {
- logger.mark(`[R插件][配置文件]:${name}已经被重置`);
- this.previousContent.set(name, currentContent); // 更新之前的内容
- }
- });
- }
-
- saveAllConfig(name, data) {
- let file = this.getFilePath(name);
- if (_.isEmpty(data)) {
- fs.existsSync(file) && fs.unlinkSync(file);
- } else {
- let yaml = YAML.stringify(data);
- fs.writeFileSync(file, yaml, 'utf8');
- }
- this.watch(file, name);
+ getFilePath(name) {
+ return `${this.configPath}${name}.yaml`;
+ }
+
+ watch(file, name) {
+ const watcher = chokidar.watch(file);
+
+ watcher.on('change', (path) => {
+ const currentContent = YAML.parse(fs.readFileSync(path, 'utf8'));
+ const previousContent = this.previousContent.get(name);
+
+ if (!_.isEqual(previousContent, currentContent)) {
+ logger.mark(`[R插件][配置文件]:${name}已经被重置`);
+ this.previousContent.set(name, currentContent); // 更新之前的内容
+ }
+ });
+ }
+
+ saveAllConfig(name, data) {
+ let file = this.getFilePath(name);
+ if (_.isEmpty(data)) {
+ fs.existsSync(file) && fs.unlinkSync(file);
+ } else {
+ let yaml = YAML.stringify(data);
+ fs.writeFileSync(file, yaml, 'utf8');
}
+ this.watch(file, name);
+ }
}
export default new RConfig();
diff --git a/model/netease.js b/model/netease.js
deleted file mode 100644
index fbfe8f5..0000000
--- a/model/netease.js
+++ /dev/null
@@ -1,17 +0,0 @@
-import Base from './base.js'
-
-export default class NeteaseModel extends Base {
- constructor (e) {
- super(e)
- this.model = 'netease'
- }
-
- /** 生成版本信息图片 */
- async getData (neteaseData) {
- return {
- ...this.screenData,
- saveId: 'netease',
- neteaseData: neteaseData,
- }
- }
-}
diff --git a/model/neteaseMusicInfo.js b/model/neteaseMusicInfo.js
deleted file mode 100644
index b62914e..0000000
--- a/model/neteaseMusicInfo.js
+++ /dev/null
@@ -1,17 +0,0 @@
-import Base from './base.js'
-
-export default class NeteaseMusicInfo extends Base {
- constructor (e) {
- super(e)
- this.model = 'neteaseMusicInfo'
- }
-
- /** 生成版本信息图片 */
- async getData (songInfo) {
- return {
- ...this.screenData,
- saveId: 'neteaseMusicInfo',
- songInfo: songInfo,
- }
- }
-}
diff --git a/model/pick-song.js b/model/pick-song.js
deleted file mode 100644
index af5be42..0000000
--- a/model/pick-song.js
+++ /dev/null
@@ -1,17 +0,0 @@
-import Base from './base.js'
-
-export default class PickSongList extends Base {
- constructor (e) {
- super(e)
- this.model = 'pick-song'
- }
-
- /** 生成版本信息图片 */
- async getData (songData) {
- return {
- ...this.screenData,
- saveId: 'pick-song',
- songData: songData,
- }
- }
-}
diff --git a/model/version.js b/model/version.js
deleted file mode 100644
index 952edf4..0000000
--- a/model/version.js
+++ /dev/null
@@ -1,21 +0,0 @@
-import Base from './base.js'
-
-export default class Version extends Base {
- constructor (e) {
- super(e)
- this.model = 'version'
- }
-
- /** 生成版本信息图片 */
- async getData (versionData) {
- const version =
- (versionData && versionData.length && versionData[0].version) || '1.0.0'
- return {
- ...this.screenData,
- userId: version,
- quality: 100,
- saveId: version,
- versionData
- }
- }
-}
diff --git a/resources/html/netease/netease.css b/resources/html/netease/netease.css
deleted file mode 100644
index e69de29..0000000
diff --git a/resources/html/netease/netease.html b/resources/html/netease/netease.html
deleted file mode 100644
index 412817f..0000000
--- a/resources/html/netease/netease.html
+++ /dev/null
@@ -1,196 +0,0 @@
-
-
-
-
-
- 网易云音乐用户信息
-
-
-
-
-
♩
-
♪
-
♫
-
♬
-
-
-
-
-
会员等级:
-
{{ neteaseData.vipLevel }}
-
-
-
最高解析音质:
-
{{ neteaseData.musicQuality }}
-
-
-
会员到期时间:
-
{{ neteaseData.expireDate }}
-
-
-
-
-
-
diff --git a/resources/html/neteaseMusicInfo/neteaseMusicInfo.css b/resources/html/neteaseMusicInfo/neteaseMusicInfo.css
deleted file mode 100644
index 00c9129..0000000
--- a/resources/html/neteaseMusicInfo/neteaseMusicInfo.css
+++ /dev/null
@@ -1,143 +0,0 @@
-@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@400;700&display=swap');
-
-@font-face {
- font-family: 'singerName';
- src: url("../../font/江城月湖体\ 400W.ttf");
-}
-
-body,
-html {
- margin: 0;
- padding: 0;
- width: 100%;
- font-family: 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', sans-serif;
-}
-
-.bg-image,
-.img {
- position: absolute;
- top: 0;
- left: 0;
- width: 100%;
- height: 450px;
- z-index: -1;
- object-fit: cover;
-}
-
-.inner {
- background: rgba(0, 0, 0, 0.6);
- backdrop-filter: blur(5px);
- position: absolute;
- top: 0;
- left: 0;
- width: 100%;
- height: 100%;
-}
-
-.infoBox {
- width: 100%;
- height: 100%;
- display: flex;
- justify-content: center;
- align-items: center;
- box-sizing: border-box;
-}
-
-.songinfobox {
- width: 100%;
- height: 100%;
- padding: 25px 0px 17px 0px;
-}
-
-.info {
- width: 100%;
- height: 100%;
- border: 0px solid #ffffff2e;
- backdrop-filter: blur(10px);
- background: hsla(0, 0%, 100%, 0.281);
- box-shadow: 0 6px 15px 0 #8e8e8e30;
-}
-
-.cover {
- width: 100%;
- height: 135px;
- display: flex;
- justify-content: center;
-}
-
-.cover img {
- width: 135px;
- height: 135px;
- border-radius: 10px;
- object-fit: cover;
- box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.3);
-}
-
-.songSize {
- width: 100%;
- text-align: center;
- margin-top: 20px;
- font-size: 18px;
- font-family: 'singerName';
- color: #fff;
- text-shadow: 2px 2px 5px rgba(255, 255, 255, 0.4);
-}
-
-.songName {
- width: 100%;
- text-align: center;
- margin-top: 10px;
- font-size: 20px;
- color: #fff;
- text-shadow: 2px 2px 5px rgba(255, 255, 255, 0.4);
-}
-
-.singerName {
- width: 100%;
- text-align: center;
- font-family: 'singerName';
- margin-top: 17px;
- font-size: 17px;
- color: #fff;
- text-shadow: 2px 2px 5px rgba(255, 255, 255, 0.4);
-}
-
-.typeBox {
- width: 100%;
- margin-top: 22px;
- display: flex;
- justify-content: center;
-}
-
-.typeList {
- display: flex;
-}
-
-.typeNav {
- font-size: 15px;
- height: 25px;
- padding: 0px 10px;
- box-sizing: border-box;
- background-color: rgba(255, 255, 255, 0.2);
- line-height: 0px;
- display: flex;
- justify-content: center;
- align-items: center;
- border-radius: 12.5px;
- margin-left: 10px;
- color: #fff;
- box-shadow: 0px 0px 3px rgba(255, 255, 255, 0.4);
-}
-
-.typeNav:first-child {
- margin-left: 0px;
-}
-
-.logo{
- width: 100%;
- text-align: center;
- font-size: 15px;
- margin-top: 20px;
- color: rgba(255, 255, 255, 0.7);
- font-family: 'singerName';
-}
\ No newline at end of file
diff --git a/resources/html/neteaseMusicInfo/neteaseMusicInfo.html b/resources/html/neteaseMusicInfo/neteaseMusicInfo.html
deleted file mode 100644
index e3490bb..0000000
--- a/resources/html/neteaseMusicInfo/neteaseMusicInfo.html
+++ /dev/null
@@ -1,58 +0,0 @@
-
-
-
-
-
-
- 歌曲信息
-
-
-
-
-
- {{ if songInfo.cover != 'def' }}
-

- {{ else }}
-

- {{ /if }}
-
-
-
-
-
-
- {{ if songInfo.cover != 'def' }}
-

- {{ else }}
-

- {{ /if }}
-
-
- {{ songInfo.size }}
-
-
- {{ songInfo.songName }}
-
-
- {{ songInfo.singerName }}
-
- {{if songInfo.musicType}}
-
-
- {{each songInfo.musicType typeName}}
-
- {{ typeName || '喵喵~'}}
-
- {{ /each }}
-
-
- {{/if}}
-
Created By Yunzai-Bot & R-Plugin
-
-
-
-
-
-
\ No newline at end of file
diff --git a/resources/html/pick-song/pick-song.css b/resources/html/pick-song/pick-song.css
deleted file mode 100644
index 6d16016..0000000
--- a/resources/html/pick-song/pick-song.css
+++ /dev/null
@@ -1,137 +0,0 @@
-@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@400;700&display=swap');
-
-@font-face {
- font-family: 'number';
- src: url("../../font/江城月湖体\ 400W.ttf");
-}
-
-body,
-html {
- margin: 0;
- padding: 0;
- font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
-}
-
-.songList {
- min-height: 50vh;
- display: flex;
- justify-content: center;
- flex-direction: column;
- align-items: center;
- background: #121212ef;
- position: relative;
- padding: 0px 40px 20px 40px;
- box-sizing: border-box;
-}
-
-.songListNav {
- box-sizing: border-box;
- width: 100%;
- height: 100px;
- margin-top: 30px;
- display: flex;
- justify-content: space-between;
- position: relative;
- z-index: 2;
-}
-
-.navText {
- font-size: 30px;
- color: #fff;
- margin-left: 20px;
- width: 85%;
-}
-
-.songName{
- overflow: hidden;
- white-space: nowrap;
- text-overflow: ellipsis;
-}
-
-.singerText{
- font-size: 25px;
- color: #aaa;
- margin-top: 5px;
-}
-
-
-.navInfo {
- display: flex;
- width: 80%;
-}
-
-.navDuration {
- color: #aaa;
- width: 70px;
- font-size: 25px;
- height: 100%;
- align-content: center;
- text-align: center;
-}
-.cloudBox{
- height: 100%;
- width: 70px;
- justify-content: center;
- display: flex;
- align-items: center;
-}
-
-.cloud{
- color: #dd001b;
- box-sizing: border-box;
- padding: 0px 8px;
- font-size: 22px;
- height: 40px;
- width: 70px;
- border-radius: 10px;
- display: flex;
- justify-content: center;
- border: 1px solid;
- align-items: center;
-}
-
-.navInfo img {
- width: 90px;
- height: 90px;
- border-radius: 8px;
- flex-shrink: 0;
- object-fit: cover;
-}
-
-.bgicon {
- position: absolute;
- top: calc(50% - 100px);
- left: calc(50% - 85px);
- width: 200px;
- height: 200px;
- z-index: 1;
-}
-
-.bgicon img {
- width: 100%;
- height: 100%;
- opacity: 0.4
-}
-
-.number {
- width: 40px;
- height: 100%;
- display: flex;
- flex-shrink: 0;
- justify-content: center;
- align-items: center;
- font-size: 40px;
- color: #fff;
- margin-right: 25px;
- margin-left: -20px;
- font-family: 'number'
-}
-
-.footer{
- width: 100%;
- text-align: center;
- font-size: 20px;
- margin-top: 20px;
- color: rgba(255, 255, 255, 0.7);
- font-family: 'number';
-}
\ No newline at end of file
diff --git a/resources/html/pick-song/pick-song.html b/resources/html/pick-song/pick-song.html
deleted file mode 100644
index 0856a86..0000000
--- a/resources/html/pick-song/pick-song.html
+++ /dev/null
@@ -1,45 +0,0 @@
-
-
-
-
-
-
- 搜索歌单
-
-
-
-
-
- {{each songData info key}}
-
-
-
{{ key+1 }}
- {{ if info.cover != 'def' }}
-

- {{ else }}
-

- {{ /if }}
-
-
{{ info.songName }}
-
{{ info.singerName }}
-
-
- {{ if info.duration == '云盘' }}
-
- {{ else }}
-
{{ info.duration }}
- {{ /if }}
-
- {{ /each }}
-
-

-
-
-
-
-
-
\ No newline at end of file