Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: 适配 x·ite #1814

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion resource/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -760,7 +760,8 @@
"urlTip": "The full address of the website, such as: https:\/\/www.github.com\/",
"passkey": "Passkey",
"passkeyTip": "The key is only used to copy the download address operation. If you do not need this function, please leave it blank.",
"allowSearch": "Allow Search",
"allowSearch": "Allow search",
"disableSearchTransform": "Disable search transform",
"allowGetUserInfo": "Allow access to user information (Beta)",
"cdn": "Site CDN list",
"cdnTip": "If you use a different URL than the system definition, you can fill in the currently used website address, fill in one address per line, the first one will be used as the address used for the search.",
Expand Down
1 change: 1 addition & 0 deletions resource/i18n/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -756,6 +756,7 @@
"passkey": "密钥",
"passkeyTip": "密钥仅用于复制下载地址操作,如果不需要用到此功能,请留空",
"allowSearch": "允许搜索",
"disableSearchTransform": "禁用搜索替换",
"allowGetUserInfo": "允许获取用户信息(Beta)",
"cdn": "站点CDN列表",
"cdnTip": "如您使用的网址和系统定义的不同,可在此填写当前使用的网站地址,每行填写一个地址,第一个将做为搜索时使用的地址",
Expand Down
257 changes: 257 additions & 0 deletions resource/sites/x-ite.me/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,257 @@
{
"name": "x·ite.me",
"timezoneOffset": "+0000",
"url": "https://x-ite.me/",
"icon": "https://x-ite.me/themes/xiteme/images/favicon.ico",
"tags": ["影视", "综合"],
"schema": "Common",
"host": "x-ite.me",
"collaborator": "davidxuang",
"searchEntryConfig": {
"page": "/torrents-search.php",
"queryString": "search=$key$&incldead=1&freeleech=0&lang=",
"resultType": "html",
"loggedRegex": "account-logout",
"area": [
{
"name": "Fix multi-word search",
"keyAutoMatch": "^\\s*(?:[\\p{L}\\p{N}][\\p{L}\\p{N}\\p{P}]*)(?:\\s+[\\p{L}\\p{N}][\\p{L}\\p{N}\\p{P}]*)+\\s*$",
"replaceKey": ["(?<!^)\\s+(?!$)", " +"]
}
],
"resultSelector": ".ttable_headinner",
"fieldIndex": {
"title": 1,
"link": 1,
"url": 3,
"time": 2,
"size": 6,
"seeders": 7,
"leechers": 8,
"comments": 4,
"category": 0
},
"fieldSelector": {
"title": {
"selector": ["a > b"],
"filters": ["query.text()"]
},
"link": {
"selector": ["a"],
"attribute": "href"
},
"url": {
"selector": ["a"],
"attribute": "href"
},
"time": {
"selector": [""],
"filters": ["query.text().replace(/(\\d{2})-(\\d{2})-(\\d{4})/g, '$3-$2-$1')"]
}
}
},
"searchEntry": [
{
"name": "all",
"enabled": true
},
{
"name": "Animations",
"appendQueryString": "&c6700=1&c6100=1&c6340=1&c6110=1&c6350=1&c6330=1&c6300=1&c6900=1&c6120=1&c6130=1&c6320=1&c6310=1",
"enabled": false
},
{
"name": "Applications",
"appendQueryString": "&c14000=1",
"enabled": false
},
{
"name": "Audio Books",
"appendQueryString": "&c11000=1",
"enabled": false
},
{
"name": "Books",
"appendQueryString": "&c10000=1",
"enabled": false
},
{
"name": "Comics & Manga",
"appendQueryString": "&c9700=1&c9600=1&c9200=1&c9100=1&c9900=1",
"enabled": false
},
{
"name": "Games",
"appendQueryString": "&c13000=1",
"enabled": false
},
{
"name": "Images",
"appendQueryString": "&c7500=1&c7300=1&c7700=1&c7900=1",
"enabled": false
},
{
"name": "Magazines",
"appendQueryString": "&c8000=1",
"enabled": false
},
{
"name": "Movies",
"appendQueryString": "&c1010=1&c1030=1&c1050=1&c1070=1&c1090=1&c1110=1&c1130=1&c1150=1&c1170=1&c1190=1&c1210=1&c1230=1&c1250=1&c1270=1&c1290=1&c1310=1&c1330=1&c1350=1&c1370=1&c1390=1&c1410=1&c1430=1&c1450=1&c1470=1&c1900=1&c1490=1&c1510=1&c1530=1&c1550=1&c1570=1&c1590=1&c1610=1&c1630=1",
"enabled": false
},
{
"name": "Porn",
"appendQueryString": "&c5000=1&c4000=1&c3000=1",
"enabled": false
},
{
"name": "Subtitles",
"appendQueryString": "&c12000=1",
"enabled": false
}
],
"torrentTagSelectors": [
{
"name": "Free",
"selector": ".badge.free",
"color": "blue"
}
],
"selectors": {
"userBaseInfo": {
"page": "/",
"fields": {
"id": {
"selector": "#infobar .account",
"attribute": "href",
"filters": ["query ? query.getQueryString('id') : ''"]
},
"name": {
"selector": "#infobar",
"filters": ["query.text().match(/as:\\s*(.+?),/)[1]"]
},
"uploaded": {
"selector": "#infobar img[src*='uploaded'] + font",
"filters": ["query.text().trim().sizeToNumber()"]
},
"downloaded": {
"selector": "#infobar img[src*='downloaded'] + font",
"filters": ["query.text().trim().sizeToNumber()"]
},
"bonus": {
"selector": "#infobar .seedbonus"
},
"messageCount": {
"selector": "#infobar .mail"
}
}
},
"userExtendInfo": {
"page": "/account-details.php?id=$user.id$",
"fields": {
"levelName": {
"selector": ".myFrame:first-child table > tbody > tr:nth-child(2) > td:first-child",
"filters": [
"query.text().split('\\n').map(l => l.split(': ')).filter(p => p[0] && p[0].trim() == 'User Class')[0][1]"
]
},
"joinTime": {
"selector": ".myFrame:first-child table > tbody > tr:nth-child(2) > td:first-child",
"filters": [
"query.text().split('\\n').map(l => l.split(': ')).filter(p => p[0] && p[0].trim() == 'Joined')[0][1]"
]
},
"uploads": {
"selector": ".myFrame:first-child table > tbody > tr:nth-child(4) > td:last-child",
"filters": [
"query.text().split('\\n').map(l => l.split(': ')).filter(p => p[0] && p[0].trim() == 'Torrents Posted')[0][1]"
]
},
"seedingSize": {
"selector": ".myFrame:nth-child(2) table.table_table > tbody > tr:not(:first-of-type) > td:nth-child(2)",
"filters": ["jQuery.map(query, (item) => {return $(item).text()})", "_self.getTotalSize(query)"]
},
"seeding": {
"selector": ".myFrame:nth-child(2) table.table_table > tbody > tr:not(:first-of-type)",
"filters": ["query.length"]
},
"bonusPerHour": {
"selector": ".myFrame:nth-child(2) table.table_table > tbody > tr:not(:first-of-type)",
"filters": ["0.5 * Math.min(5, Math.sqrt(query.length)) "]
}
}
}
},
"categories": [
{
"entry": "*",
"result": "&c$id$=1",
"category": [
{ "id": 6700, "name": "Animations - Adult" },
{ "id": 6100, "name": "Animations - Anime" },
{ "id": 6340, "name": "Animations - Bara" },
{ "id": 6110, "name": "Animations - Ecchi" },
{ "id": 6350, "name": "Animations - Furry" },
{ "id": 6330, "name": "Animations - Futanari" },
{ "id": 6300, "name": "Animations - Hentai" },
{ "id": 6900, "name": "Animations - Other" },
{ "id": 6120, "name": "Animations - Shoujo Ai" },
{ "id": 6130, "name": "Animations - Shounen Ai" },
{ "id": 6320, "name": "Animations - Yaoi" },
{ "id": 6310, "name": "Animations - Yuri" },
{ "id": 14000, "name": "Applications - All" },
{ "id": 11000, "name": "Audio Books - All" },
{ "id": 10000, "name": "Books - All" },
{ "id": 9700, "name": "Comics & Manga - Adult" },
{ "id": 9600, "name": "Comics & Manga - Cartoon" },
{ "id": 9200, "name": "Comics & Manga - Hentai" },
{ "id": 9100, "name": "Comics & Manga - Manga" },
{ "id": 9900, "name": "Comics & Manga - Other" },
{ "id": 5000, "name": "Fetish - All" },
{ "id": 13000, "name": "Games - All" },
{ "id": 4000, "name": "Hardcore - All" },
{ "id": 7500, "name": "Images - Adult" },
{ "id": 7300, "name": "Images - Erotic" },
{ "id": 7700, "name": "Images - Fetish" },
{ "id": 7900, "name": "Images - Other" },
{ "id": 8000, "name": "Magazines - All" },
{ "id": 1010, "name": "Movies - Action" },
{ "id": 1030, "name": "Movies - Adventure" },
{ "id": 1050, "name": "Movies - Biography" },
{ "id": 1070, "name": "Movies - Bollywood" },
{ "id": 1090, "name": "Movies - Comedy" },
{ "id": 1110, "name": "Movies - Coming of Age" },
{ "id": 1130, "name": "Movies - Coming Out" },
{ "id": 1150, "name": "Movies - Crime" },
{ "id": 1170, "name": "Movies - Documentary" },
{ "id": 1190, "name": "Movies - Drama" },
{ "id": 1210, "name": "Movies - Eastern" },
{ "id": 1230, "name": "Movies - Entertainment" },
{ "id": 1250, "name": "Movies - Experimental" },
{ "id": 1270, "name": "Movies - Family" },
{ "id": 1290, "name": "Movies - Fantasy" },
{ "id": 1310, "name": "Movies - Film Noir" },
{ "id": 1330, "name": "Movies - Historical" },
{ "id": 1350, "name": "Movies - History" },
{ "id": 1370, "name": "Movies - Horror" },
{ "id": 1390, "name": "Movies - Indie" },
{ "id": 1410, "name": "Movies - Music" },
{ "id": 1430, "name": "Movies - Musical" },
{ "id": 1450, "name": "Movies - Mystery" },
{ "id": 1470, "name": "Movies - News" },
{ "id": 1900, "name": "Movies - Other" },
{ "id": 1490, "name": "Movies - Romance" },
{ "id": 1510, "name": "Movies - Sci-Fi" },
{ "id": 1530, "name": "Movies - Sport" },
{ "id": 1550, "name": "Movies - Suspense" },
{ "id": 1570, "name": "Movies - Theater" },
{ "id": 1590, "name": "Movies - Thriller" },
{ "id": 1610, "name": "Movies - War" },
{ "id": 1630, "name": "Movies - Western" },
{ "id": 3000, "name": "Softcore - All" },
{ "id": 12000, "name": "Subtitles - All" }
]
}
]
}
6 changes: 4 additions & 2 deletions src/background/searcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,12 +156,12 @@ export class Searcher {
searchEntryConfigQueryString = searchEntryConfig.queryString + "";

// 搜索区域
if (searchEntryConfig.area) {
if (searchEntryConfig.area && !site.disableSearchTransform) {
searchEntryConfig.area.some((area: SearchEntryConfigArea) => {
// 是否有自动匹配关键字的正则
if (
area.keyAutoMatch &&
new RegExp(area.keyAutoMatch, "").test(key)
new RegExp(area.keyAutoMatch, "u").test(key)
) {
// 是否替换默认页面
if (area.page) {
Expand Down Expand Up @@ -277,10 +277,12 @@ export class Searcher {

// 替换关键字
if (area.replaceKey) {
const old = key;
key = key.replace(
new RegExp(area.replaceKey[0], "g"),
area.replaceKey[1]
);
console.log(`[${site.name}] "${old}" => "${key}"`);
}

// 解析脚本,最终返回搜索关键字,可调用 payload 里的数据进行关键字替换
Expand Down
1 change: 1 addition & 0 deletions src/interface/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ export interface Site {
defaultClientId?: string;
plugins?: any[];
allowSearch?: boolean;
disableSearchTransform?: boolean;
securityKeys?: object;
searchEntryConfig?: SearchEntryConfig;
searchEntry?: SearchEntry[];
Expand Down
14 changes: 11 additions & 3 deletions src/options/views/settings/Sites/Editor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,11 @@
:disabled="!site.tokenRequired" :rules="site.tokenRequired ? rules.require : []"
:label="$t('settings.sites.editor.authToken')"
:placeholder="$t('settings.sites.editor.authTokenTip')"
></v-text-field>
></v-text-field>

<!-- 站点已离线(停机/关闭) -->
<v-switch :label="$t('settings.sites.editor.offline')" v-model="site.offline" />

<!-- 允许获取用户信息 -->
<v-switch
:label="$t('settings.sites.editor.allowGetUserInfo')"
Expand Down Expand Up @@ -192,8 +196,12 @@
</v-container>
</template>

<!-- 站点已离线(停机/关闭) -->
<v-switch :label="$t('settings.sites.editor.offline')" v-model="site.offline"></v-switch>
<!-- 禁用搜索替换 -->
<v-switch
v-model="site.disableSearchTransform"
:disabled="!site.allowSearch || site.offline"
:label="$t('settings.sites.editor.disableSearchTransform')"
/>

<!-- 消息提醒开关 -->
<v-switch :label="$t('settings.sites.editor.disableMessageCount')" v-model="site.disableMessageCount"></v-switch>
Expand Down