Skip to content

Commit d2964d7

Browse files
authored
Merge pull request #251 from hjdhnx/main
干掉检测,避免一些人总是揪着这个问题不放
2 parents 128c54c + 0af12a7 commit d2964d7

File tree

10 files changed

+315
-171
lines changed

10 files changed

+315
-171
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181
"dayjs": "^1.11.11",
8282
"dplayer": "^1.27.1",
8383
"electron": "~22.3.27",
84-
"electron-builder": "^25.0.0-alpha.9",
84+
"electron-builder": "^24.13.3",
8585
"electron-vite": "^2.2.0",
8686
"eslint": "^9.4.0",
8787
"eslint-plugin-vue": "^9.26.0",

src/main/core/server/routes/proxy.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,26 @@ const api: FastifyPluginAsync = async (fastify): Promise<void> => {
1111
await req.server.db.delete('/t3-proxy');
1212

1313
const [status, contentType, message] = dbData;
14+
const headers = dbData.length > 3 ? dbData[3] : null;
15+
const to_bytes = dbData.length > 4 ? dbData[4] : null;
1416
reply.header('Content-Type', contentType);
17+
if (headers) {
18+
Object.keys(headers).forEach((key) => {
19+
reply.header(key, headers[key]);
20+
});
21+
}
22+
let content = message;
23+
if (to_bytes) {
24+
try {
25+
if (content.includes('base64,')) {
26+
content = decodeURIComponent(content.split('base64,')[1]);
27+
}
28+
content = Buffer.from(content, 'base64');
29+
} catch (e) {
1530

16-
reply.code(Number.isInteger(status) ? status : parseInt(status)).send(message);
31+
}
32+
}
33+
reply.code(Number.isInteger(status) ? status : parseInt(status)).send(content);
1734
} catch (err) {
1835
reply.code(500).send(err);
1936
}

src/renderer/src/pages/Film.vue

Lines changed: 96 additions & 75 deletions
Large diffs are not rendered by default.

src/renderer/src/pages/setting/base/components/DialogData.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ import joinUrl from 'url';
164164
import { t } from '@/locales';
165165
import { initializeWebdavClient, rsyncLocal, rsyncRemote } from '@/utils/webdev';
166166
import { updateSetting, clearDb, exportDb, setDefault, initDb } from '@/api/setting';
167-
import { getConfig } from '@/utils/tool';
167+
import { getConfig,encodeMd5 } from '@/utils/tool';
168168
169169
import pkg from '../../../../../../../package.json'
170170
@@ -343,7 +343,8 @@ const easyConfig = async () => {
343343
data["tbl_site"] = config.sites
344344
.filter((item) => [0, 1, 4].includes(item.type) || (item.type === 3 && item.api.includes('.js') && item.ext && typeof item.ext === 'string' && item.ext.includes('.js')))
345345
.map((item) => ({
346-
id: nanoid(),
346+
// id: nanoid(),
347+
id: [0, 1].includes(item.type) ? nanoid() : encodeMd5(item.api.split('/').slice(-1)[0]+'|'+(item.ext && typeof item.ext === 'string'?item.ext.split('/').slice(-1)[0]:'')),
347348
name: item.name,
348349
type: formatType(type, item.type),
349350
api: formatUrl(item.api, url),

src/renderer/src/pages/setting/site/SiteSetting.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<remove-icon />
2121
<span>{{ $t('pages.setting.header.delete') }}</span>
2222
</div>
23-
<div class="item" @click="handleAllDataEvent('check')">
23+
<div class="item" @click="handleAllDataEvent('check')" v-show="false">
2424
<refresh-icon />
2525
<span>{{ $t('pages.setting.header.check') }}</span>
2626
</div>

src/renderer/src/utils/cms.ts

Lines changed: 47 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import { XMLParser } from 'fast-xml-parser';
1+
import {XMLParser} from 'fast-xml-parser';
22
import _ from 'lodash';
33
import Base64 from 'crypto-js/enc-base64';
44
import Utf8 from 'crypto-js/enc-utf8';
55
import xpath from 'xpath';
6-
import { DOMParser } from '@xmldom/xmldom';
6+
import {DOMParser} from '@xmldom/xmldom';
77

8-
import { doWork as t3Work, terminateWork as t3WorkTerminate } from './drpy';
8+
import {doWork as t3Work, terminateWork as t3WorkTerminate} from './drpy';
99
import CLASS_FILTER_CONFIG from '@/config/appFilter';
1010
import request from '@/utils/request';
1111

@@ -95,7 +95,7 @@ const t3RuleInit = async (site) => {
9595

9696
if (_.has(site, 'ext')) {
9797
try {
98-
await t3Work({ type: 'init', data: site.ext });
98+
await t3Work({type: 'init', data: site.ext});
9999
data = {
100100
code: 200,
101101
msg: 'success',
@@ -116,7 +116,7 @@ const t3RuleProxy = async (url: string): Promise<any[]> => {
116116
const formatUrl = new URL(url);
117117
const params = Object.fromEntries(formatUrl.searchParams.entries());
118118

119-
const result: any = await t3Work({ type: 'proxy', data: params });
119+
const result: any = await t3Work({type: 'proxy', data: params});
120120
return (result?.data ?? []) as any[];
121121
};
122122

@@ -158,7 +158,7 @@ const fetchClassify = async (site) => {
158158
} else if (site.type === 6) {
159159
url = buildUrl(site.api, `&extend=${site.ext}&filter=true`);
160160
} else if (site.type === 7) {
161-
const content: any = await t3Work({ type: 'home' });
161+
const content: any = await t3Work({type: 'home'});
162162
const res = {
163163
page: 1,
164164
pagecount: 9999,
@@ -304,9 +304,9 @@ const fetchClassify = async (site) => {
304304
const value = classItem.type_extend[key];
305305
if (!_.isEmpty(value) && !['star', 'state', 'version', 'director'].includes(key)) {
306306
const valueList = value.split(',').map((item) => item.trim());
307-
const options = valueList.map((value) => ({ n: value === '全部' ? '全部' : value, v: value }));
308-
const name = (_.find(CLASS_FILTER_CONFIG, { key }) || {}).desc;
309-
result.push({ key, name, value: [{ n: '全部', v: '' }, ...options] });
307+
const options = valueList.map((value) => ({n: value === '全部' ? '全部' : value, v: value}));
308+
const name = (_.find(CLASS_FILTER_CONFIG, {key}) || {}).desc;
309+
result.push({key, name, value: [{n: '全部', v: ''}, ...options]});
310310
}
311311
}
312312
filters[classItem.type_id] = result;
@@ -403,18 +403,18 @@ const checkValid = async (site) => {
403403
const convertVideoList = (videoItems) => {
404404
return videoItems.map(
405405
({
406-
id: vod_id,
407-
tid: type_id,
408-
type: type_name,
409-
pic: vod_pic,
410-
note: vod_remark,
411-
name: vod_name,
412-
des: vod_content,
413-
year: vod_year,
414-
area: vod_area,
415-
director: vod_director,
416-
actor: vod_actor,
417-
}) => ({
406+
id: vod_id,
407+
tid: type_id,
408+
type: type_name,
409+
pic: vod_pic,
410+
note: vod_remark,
411+
name: vod_name,
412+
des: vod_content,
413+
year: vod_year,
414+
area: vod_area,
415+
director: vod_director,
416+
actor: vod_actor,
417+
}) => ({
418418
vod_id,
419419
type_id,
420420
type_name,
@@ -452,7 +452,7 @@ const fetchList = async (site, pg = 1, t, f = {}) => {
452452
} else if (site.type === 7) {
453453
const res: any = await t3Work({
454454
type: 'category',
455-
data: { tid: t, pg, filter: _.size(f) ? true : false, extend: _.size(f) ? f : {} },
455+
data: {tid: t, pg, filter: _.size(f) ? true : false, extend: _.size(f) ? f : {}},
456456
});
457457
return res.data.list;
458458
} else if (site.type === 8) {
@@ -510,7 +510,7 @@ const fetchList = async (site, pg = 1, t, f = {}) => {
510510
* @returns
511511
*/
512512
const convertHotList = (hotItems) => {
513-
return hotItems.map(({ id: vod_id, tid: type_id, type: type_name, note: vod_remark, name: vod_name }) => ({
513+
return hotItems.map(({id: vod_id, tid: type_id, type: type_name, note: vod_remark, name: vod_name}) => ({
514514
vod_id,
515515
type_id,
516516
type_name,
@@ -592,11 +592,11 @@ const convertSearchList = (searchItem) => {
592592

593593
return result;
594594
};
595-
const fetchSearch = async (site, wd) => {
595+
const fetchSearch = async (site, wd, pg: number = 1) => {
596596
// xml坑: 单条结果是dict 多条结果list
597597
try {
598598
if (site.type === 7) {
599-
const res: any = await t3Work({ type: 'search', data: { wd, quick: false, pg: 1 } });
599+
const res: any = await t3Work({type: 'search', data: {wd, quick: false, pg: pg}});
600600
return res.data?.list;
601601
}
602602
let url, postData;
@@ -607,7 +607,7 @@ const fetchSearch = async (site, wd) => {
607607
url = buildUrl(site.api, `/search`);
608608
postData = {
609609
wd,
610-
pg: 1,
610+
pg: pg,
611611
};
612612
} else url = buildUrl(site.api, `?wd=${encodeURIComponent(wd)}`);
613613

@@ -732,19 +732,19 @@ const convertDetailList = (detailItems) => {
732732

733733
return detailItems.map(
734734
({
735-
id: vod_id,
736-
tid: type_id,
737-
type: type_name,
738-
pic: vod_pic,
739-
note: vod_remark,
740-
name: vod_name,
741-
des: vod_content,
742-
year: vod_year,
743-
area: vod_area,
744-
director: vod_director,
745-
actor: vod_actor,
746-
dl: { dd: dldd },
747-
}) => ({
735+
id: vod_id,
736+
tid: type_id,
737+
type: type_name,
738+
pic: vod_pic,
739+
note: vod_remark,
740+
name: vod_name,
741+
des: vod_content,
742+
year: vod_year,
743+
area: vod_area,
744+
director: vod_director,
745+
actor: vod_actor,
746+
dl: {dd: dldd},
747+
}) => ({
748748
vod_id,
749749
type_id,
750750
type_name,
@@ -774,7 +774,7 @@ const fetchDetail = async (site, id) => {
774774
} else if (site.type === 6) {
775775
url = buildUrl(site.api, `?ac=detail&ids=${id}&extend=${site.ext}`);
776776
} else if (site.type === 7) {
777-
const res: any = await t3Work({ type: 'detail', data: `${id}` });
777+
const res: any = await t3Work({type: 'detail', data: `${id}`});
778778
return res.data.list;
779779
} else if (site.type === 8) {
780780
url = buildUrl(site.api, `/detail`);
@@ -807,11 +807,13 @@ const fetchDetail = async (site, id) => {
807807
const detailxlPat = reptileApiFormat(site.api, 'detailxl');
808808
const detailxlRes = reptileXpathFormat(json, detailxlPat);
809809
const detailjsPat = reptileApiFormat(site.api, 'detailjs');
810+
// @ts-ignore
810811
const detailjsRes = reptileXpathFormat(json, detailjsPat);
811812
const detailjsurlPat = reptileApiFormat(site.api, 'detailjsurl');
812813
const detailjsurlRes = reptileXpathFormat(json, detailjsurlPat);
813814

814815
const vod_from = detailxlRes.join('$$$');
816+
// @ts-ignore
815817
let zippedData = _.zip(detaillistRes, detailjsurlRes);
816818
console.log(detaillistRes, detailjsurlRes);
817819
console.log(vod_from);
@@ -871,7 +873,7 @@ const fetchHipyPlayUrl = async (site, flag, play) => {
871873
*/
872874
const fetchT3PlayUrl = async (flag: string, id: string, flags: string[] = []) => {
873875
try {
874-
const res: any = await t3Work({ type: 'play', data: { flag, id, flags } });
876+
const res: any = await t3Work({type: 'play', data: {flag, id, flags}});
875877
return res.data;
876878
} catch (err) {
877879
throw err;
@@ -891,7 +893,7 @@ const fetchCatvodPlayUrl = async (site, flag: string, id: string) => {
891893
const response = await request({
892894
url,
893895
method: 'POST',
894-
data: { flag, id },
896+
data: {flag, id},
895897
});
896898
return response;
897899
} catch (err) {
@@ -1053,10 +1055,10 @@ const fetchDoubanRate = async (id, type, name, year) => {
10531055
try {
10541056
let rate = 0.0;
10551057
if (!id || !type) {
1056-
const { vod_score: foundRate } = (await fetchDoubanSearch(name, year)) as any;
1058+
const {vod_score: foundRate} = (await fetchDoubanSearch(name, year)) as any;
10571059
rate = foundRate;
10581060
} else {
1059-
const { vod_score: foundRate } = (await fetchDoubanDetail(id, type)) as any;
1061+
const {vod_score: foundRate} = (await fetchDoubanDetail(id, type)) as any;
10601062
rate = foundRate;
10611063
}
10621064

@@ -1077,7 +1079,7 @@ const fetchDoubanRate = async (id, type, name, year) => {
10771079
const fetchDoubanRecommend = async (id, type, name, year) => {
10781080
try {
10791081
if (!id || !type) {
1080-
const { vod_douban_id: foundId, vod_douban_type: foundType } = (await fetchDoubanSearch(name, year)) as any;
1082+
const {vod_douban_id: foundId, vod_douban_type: foundType} = (await fetchDoubanSearch(name, year)) as any;
10811083
id = foundId;
10821084
type = foundType;
10831085
}

0 commit comments

Comments
 (0)