Skip to content

Commit ba0c458

Browse files
committed
update:cat
1 parent 1a72b6a commit ba0c458

File tree

5 files changed

+827
-1
lines changed

5 files changed

+827
-1
lines changed

Diff for: controllers/config.js

+29-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import {readdirSync, readFileSync, writeFileSync, existsSync} from 'fs';
22
import path from 'path';
33
import * as drpy from '../libs/drpyS.js';
4+
import '../libs_drpy/jinja.js'
45
import {naturalSort, urljoin, updateQueryString} from '../utils/utils.js'
6+
import {md5} from "../libs_drpy/crypto-util.js";
57
import {ENV} from "../utils/env.js";
68
import {validatePwd} from "../utils/api_validate.js";
79
import {getSitesMap} from "../utils/sites-map.js";
@@ -358,7 +360,33 @@ export default (fastify, options, done) => {
358360
const hostname = request.hostname; // 主机名,不包含端口
359361
const port = request.socket.localPort; // 获取当前服务的端口
360362
console.log(`cfg_path:${cfg_path},port:${port}`);
361-
let requestHost = cfg_path === '/1' ? `${protocol}://${hostname}` : `http://127.0.0.1:${options.PORT}`; // 动态生成根地址
363+
let requestHost = (cfg_path.startsWith('/1') || cfg_path.startsWith('/index')) ? `${protocol}://${hostname}` : `http://127.0.0.1:${options.PORT}`; // 动态生成根地址
364+
let requestUrl = (cfg_path.startsWith('/1') || cfg_path.startsWith('/index')) ? `${protocol}://${hostname}${request.url}` : `http://127.0.0.1:${options.PORT}${request.url}`; // 动态生成请求链接
365+
// console.log('requestUrl:', requestUrl);
366+
if (cfg_path.endsWith('.js')) {
367+
if (cfg_path.includes('index.js')) {
368+
return reply.sendFile('index.js', path.join(options.rootDir, 'data/cat'));
369+
} else if (cfg_path.includes('index.config.js')) {
370+
let content = readFileSync(path.join(options.rootDir, 'data/cat/index.config.js'), 'utf-8');
371+
// console.log(content);
372+
content = jinja.render(content, {config_url: requestUrl.replace(cfg_path, '/1')});
373+
return reply.type('application/javascript;charset=utf-8').send(content);
374+
}
375+
}
376+
if (cfg_path.endsWith('.js.md5')) {
377+
if (cfg_path.includes('index.js')) {
378+
let content = readFileSync(path.join(options.rootDir, 'data/cat/index.js.md5'), 'utf-8');
379+
return reply.type('text/plain;charset=utf-8').send(content);
380+
// return reply.sendFile('index.js.md5', path.join(options.rootDir, 'data/cat'));
381+
} else if (cfg_path.includes('index.config.js')) {
382+
let content = readFileSync(path.join(options.rootDir, 'data/cat/index.config.js'), 'utf-8');
383+
// console.log(content);
384+
content = jinja.render(content, {config_url: requestUrl.replace(cfg_path, '/1')});
385+
let contentHash = md5(content);
386+
console.log('contentHash:', contentHash);
387+
return reply.type('text/plain;charset=utf-8').send(contentHash);
388+
}
389+
}
362390
let sub = null;
363391
if (sub_code) {
364392
let subs = getSubs(options.subFilePath);

Diff for: data/cat/index.config.js

+268
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,268 @@
1+
var __defProp = Object.defineProperty;
2+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3+
var __getOwnPropNames = Object.getOwnPropertyNames;
4+
var __hasOwnProp = Object.prototype.hasOwnProperty;
5+
var __export = (target, all) => {
6+
for (var name in all)
7+
__defProp(target, name, { get: all[name], enumerable: true });
8+
};
9+
var __copyProps = (to, from, except, desc) => {
10+
if (from && typeof from === "object" || typeof from === "function") {
11+
for (let key of __getOwnPropNames(from))
12+
if (!__hasOwnProp.call(to, key) && key !== except)
13+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14+
}
15+
return to;
16+
};
17+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18+
19+
// src/index.config.js
20+
var index_config_exports = {};
21+
__export(index_config_exports, {
22+
default: () => index_config_default
23+
});
24+
module.exports = __toCommonJS(index_config_exports);
25+
var index_config_default = {
26+
drpyS: {
27+
// config_url: "http://localhost:5757/config/1?sub=all&pwd=",
28+
config_url: "{{config_url}}",
29+
// 本地ds 支持
30+
// config_url: 'http://localhost:5707/config/0?sub=dzyyds', // 本地hipy-t4 支持
31+
home_site: "http://localhost:5757/api/设置中心",
32+
enable_dspush: 1,
33+
enable_home_site: 0,
34+
sniffer_rule: "http((?!http).){12,}?\\.(m3u8|mp4|flv|avi|mkv|rm|wmv|mpg|m4a|mp3)\\?.*|http((?!http).){12,}\\.(m3u8|mp4|flv|avi|mkv|rm|wmv|mpg|m4a|mp3)|http((?!http).)*?video/tos*|http((?!http).)*?obj/tos*",
35+
enable_hipy_sniffer: 0,
36+
hipy_sniffer_url: "http://127.0.0.1:5708/sniffer?url=",
37+
parse_count: 6,
38+
// 最多显示多少条解析
39+
parse_timeout: 5e3
40+
// 解析超时毫秒数
41+
},
42+
ffm3u8: {
43+
url: "https://cj.ffzyapi.com/api.php/provide/vod/from/ffm3u8",
44+
categories: ["国产剧", "香港剧", "韩国剧", "欧美剧", "台湾剧", "日本剧", "海外剧", "泰国剧", "短剧", "动作片", "喜剧片", "爱情片", "科幻片", "恐怖片", "剧情片", "战争片", "动漫片", "大陆综艺", "港台综艺", "日韩综艺", "欧美综艺", "国产动漫", "日韩动漫", "欧美动漫", "港台动漫", "海外动漫", "记录片"]
45+
},
46+
alist: [
47+
{
48+
name: "🐉神族九帝",
49+
server: "https://alist.shenzjd.com"
50+
},
51+
{
52+
name: "💢repl",
53+
server: "https://ali.liucn.repl.co"
54+
}
55+
],
56+
color: [
57+
{
58+
light: {
59+
bg: "https://i2.100024.xyz/2024/01/13/pptcej.webp",
60+
bgMask: "0x50ffffff",
61+
primary: "0xff446732",
62+
onPrimary: "0xffffffff",
63+
primaryContainer: "0xffc5efab",
64+
onPrimaryContainer: "0xff072100",
65+
secondary: "0xff55624c",
66+
onSecondary: "0xffffffff",
67+
secondaryContainer: "0xffd9e7cb",
68+
onSecondaryContainer: "0xff131f0d",
69+
tertiary: "0xff386666",
70+
onTertiary: "0xffffffff",
71+
tertiaryContainer: "0xffbbebec",
72+
onTertiaryContainer: "0xff002020",
73+
error: "0xffba1a1a",
74+
onError: "0xffffffff",
75+
errorContainer: "0xffffdad6",
76+
onErrorContainer: "0xff410002",
77+
background: "0xfff8faf0",
78+
onBackground: "0xff191d16",
79+
surface: "0xfff8faf0",
80+
onSurface: "0xff191d16",
81+
surfaceVariant: "0xffe0e4d6",
82+
onSurfaceVariant: "0xff191d16",
83+
inverseSurface: "0xff2e312b",
84+
inverseOnSurface: "0xfff0f2e7",
85+
outline: "0xff74796d",
86+
outlineVariant: "0xffc3c8bb",
87+
shadow: "0xff000000",
88+
scrim: "0xff000000",
89+
inversePrimary: "0xffaad291",
90+
surfaceTint: "0xff446732"
91+
},
92+
dark: {
93+
bg: "https://i2.100024.xyz/2024/01/13/pptg3z.webp",
94+
bgMask: "0x50000000",
95+
primary: "0xffaad291",
96+
onPrimary: "0xff173807",
97+
primaryContainer: "0xff2d4f1c",
98+
onPrimaryContainer: "0xffc5efab",
99+
secondary: "0xffbdcbb0",
100+
onSecondary: "0xff283420",
101+
secondaryContainer: "0xff3e4a35",
102+
onSecondaryContainer: "0xffd9e7cb",
103+
tertiary: "0xffa0cfcf",
104+
onTertiary: "0xff003738",
105+
tertiaryContainer: "0xff1e4e4e",
106+
onTertiaryContainer: "0xffbbebec",
107+
error: "0xffffb4ab",
108+
onError: "0xff690005",
109+
errorContainer: "0xff93000a",
110+
onErrorContainer: "0xffffdad6",
111+
background: "0xff11140e",
112+
onBackground: "0xffe1e4d9",
113+
surface: "0xff11140e",
114+
onSurface: "0xffe1e4d9",
115+
surfaceVariant: "0xff43483e",
116+
onSurfaceVariant: "0xffe1e4d9",
117+
inverseSurface: "0xffe1e4d9",
118+
inverseOnSurface: "0xff2e312b",
119+
outline: "0xff8d9286",
120+
outlineVariant: "0xff43483e",
121+
shadow: "0xff000000",
122+
scrim: "0xff000000",
123+
inversePrimary: "0xff446732",
124+
surfaceTint: "0xffaad291"
125+
}
126+
},
127+
{
128+
light: {
129+
bg: "https://i2.100024.xyz/2024/01/13/pi2rpw.webp",
130+
bgMask: "0x50ffffff",
131+
primary: "0xff666014",
132+
onPrimary: "0xffffffff",
133+
primaryContainer: "0xffeee58c",
134+
onPrimaryContainer: "0xff1f1c00",
135+
secondary: "0xff625f42",
136+
onSecondary: "0xffffffff",
137+
secondaryContainer: "0xffe9e4be",
138+
onSecondaryContainer: "0xff1e1c05",
139+
tertiary: "0xff3f6654",
140+
onTertiary: "0xffffffff",
141+
tertiaryContainer: "0xffc1ecd5",
142+
onTertiaryContainer: "0xff002114",
143+
error: "0xffba1a1a",
144+
onError: "0xffffffff",
145+
errorContainer: "0xffffdad6",
146+
onErrorContainer: "0xff410002",
147+
background: "0xfffef9eb",
148+
onBackground: "0xff1d1c14",
149+
surface: "0xfffef9eb",
150+
onSurface: "0xff1d1c14",
151+
surfaceVariant: "0xffe7e3d0",
152+
onSurfaceVariant: "0xff1d1c14",
153+
inverseSurface: "0xff323128",
154+
inverseOnSurface: "0xfff5f1e3",
155+
outline: "0xff7a7768",
156+
outlineVariant: "0xffcbc7b5",
157+
shadow: "0xff000000",
158+
scrim: "0xff000000",
159+
inversePrimary: "0xffd1c973",
160+
surfaceTint: "0xff666014"
161+
},
162+
dark: {
163+
bg: "https://i2.100024.xyz/2024/01/13/pi2reo.webp",
164+
bgMask: "0x50000000",
165+
primary: "0xffd1c973",
166+
onPrimary: "0xff353100",
167+
primaryContainer: "0xff4d4800",
168+
onPrimaryContainer: "0xffeee58c",
169+
secondary: "0xffcdc8a3",
170+
onSecondary: "0xff333117",
171+
secondaryContainer: "0xff4a482c",
172+
onSecondaryContainer: "0xffe9e4be",
173+
tertiary: "0xffa6d0b9",
174+
onTertiary: "0xff0e3727",
175+
tertiaryContainer: "0xff274e3d",
176+
onTertiaryContainer: "0xffc1ecd5",
177+
error: "0xffffb4ab",
178+
onError: "0xff690005",
179+
errorContainer: "0xff93000a",
180+
onErrorContainer: "0xffffdad6",
181+
background: "0xff14140c",
182+
onBackground: "0xffe7e2d5",
183+
surface: "0xff14140c",
184+
onSurface: "0xffe7e2d5",
185+
surfaceVariant: "0xff49473a",
186+
onSurfaceVariant: "0xffe7e2d5",
187+
inverseSurface: "0xffe7e2d5",
188+
inverseOnSurface: "0xff323128",
189+
outline: "0xff949181",
190+
outlineVariant: "0xff49473a",
191+
shadow: "0xff000000",
192+
scrim: "0xff000000",
193+
inversePrimary: "0xff666014",
194+
surfaceTint: "0xffd1c973"
195+
}
196+
},
197+
{
198+
light: {
199+
bg: "https://i2.100024.xyz/2024/01/13/qrnuwt.webp",
200+
bgMask: "0x50ffffff",
201+
primary: "0xFF2B6C00",
202+
onPrimary: "0xFFFFFFFF",
203+
primaryContainer: "0xFFA6F779",
204+
onPrimaryContainer: "0xFF082100",
205+
secondary: "0xFF55624C",
206+
onSecondary: "0xFFFFFFFF",
207+
secondaryContainer: "0xFFD9E7CA",
208+
onSecondaryContainer: "0xFF131F0D",
209+
tertiary: "0xFF386666",
210+
onTertiary: "0xFFFFFFFF",
211+
tertiaryContainer: "0xFFBBEBEB",
212+
onTertiaryContainer: "0xFF002020",
213+
error: "0xFFBA1A1A",
214+
onError: "0xFFFFFFFF",
215+
errorContainer: "0xFFFFDAD6",
216+
onErrorContainer: "0xFF410002",
217+
background: "0xFFFDFDF5",
218+
onBackground: "0xFF1A1C18",
219+
surface: "0xFFFDFDF5",
220+
onSurface: "0xFF1A1C18",
221+
surfaceVariant: "0xFFE0E4D6",
222+
onSurfaceVariant: "0xFF1A1C18",
223+
inverseSurface: "0xFF2F312C",
224+
onInverseSurface: "0xFFF1F1EA",
225+
outline: "0xFF74796D",
226+
outlineVariant: "0xFFC3C8BB",
227+
shadow: "0xFF000000",
228+
scrim: "0xFF000000",
229+
inversePrimary: "0xFF8CDA60",
230+
surfaceTint: "0xFF2B6C00"
231+
},
232+
dark: {
233+
bg: "https://i2.100024.xyz/2024/01/13/qrc37o.webp",
234+
bgMask: "0x50000000",
235+
primary: "0xFF8CDA60",
236+
onPrimary: "0xFF133800",
237+
primaryContainer: "0xFF1F5100",
238+
onPrimaryContainer: "0xFFA6F779",
239+
secondary: "0xFFBDCBAF",
240+
onSecondary: "0xFF283420",
241+
secondaryContainer: "0xFF3E4A35",
242+
onSecondaryContainer: "0xFFD9E7CA",
243+
tertiary: "0xFFA0CFCF",
244+
onTertiary: "0xFF003737",
245+
tertiaryContainer: "0xFF1E4E4E",
246+
onTertiaryContainer: "0xFFBBEBEB",
247+
error: "0xFFFFB4AB",
248+
errorContainer: "0xFF93000A",
249+
onError: "0xFF690005",
250+
onErrorContainer: "0xFFFFDAD6",
251+
background: "0xFF1A1C18",
252+
onBackground: "0xFFE3E3DC",
253+
outline: "0xFF8D9286",
254+
onInverseSurface: "0xFF1A1C18",
255+
inverseSurface: "0xFFE3E3DC",
256+
inversePrimary: "0xFF2B6C00",
257+
shadow: "0xFF000000",
258+
surfaceTint: "0xFF8CDA60",
259+
outlineVariant: "0xFF43483E",
260+
scrim: "0xFF000000",
261+
surface: "0xFF1A1C18",
262+
onSurface: "0xFFC7C7C0",
263+
surfaceVariant: "0xFF43483E",
264+
onSurfaceVariant: "0xFFC7C7C0"
265+
}
266+
}
267+
]
268+
};

Diff for: data/cat/index.config.js.md5

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
18ea2ac4e503561d38cac4112f5f5e5d

0 commit comments

Comments
 (0)