🌟feat: 新增 EMBY 解锁脚本

This commit is contained in:
sve1r 2022-12-04 23:04:58 +08:00
parent 3375c8c56c
commit 046c4ee83f
2 changed files with 135 additions and 0 deletions

4
Rewrite/Unlock/Emby.conf Normal file
View File

@ -0,0 +1,4 @@
hostname = mb3admin.com
# Emby解锁播放权限
^https:\/\/mb3admin\.com\/admin\/service(\/registration\/validateDevice|\/appstore\/register|\/registration\/validate|\/registration\/getStatus|\/supporter\/retrievekey) url script-echo-response https://cdn.jsdelivr.net/gh/sve1r/Rules-For-Quantumult-X@develop/Scripts/Unlock/Emby.js

131
Scripts/Unlock/Emby.js Normal file
View File

@ -0,0 +1,131 @@
/*
* EMBY 解锁
*/
var url = $request.url;
const myStatus = "HTTP/1.1 200 OK";
const myHeaders = {
"Crack": "KS",
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Headers": "*",
"Access-Control-Allow-Method": "*",
"Access-Control-Allow-Credentials": "true"
};
if (url.indexOf('/admin/service/registration/validateDevice') != -1) {
obj = {
"cacheExpirationDays": 365,
"message": "Device Valid",
"resultCode": "GOOD"
};
} else if (url.indexOf('/admin/service/appstore/register') != -1) {
obj = {
"featId": "",
"registered": true,
"expDate": "2099-01-01",
"key": ""
};
} else if (url.indexOf('/admin/service/registration/validate') != -1) {
obj = {
"featId": "",
"registered": true,
"expDate": "2099-01-01",
"key": ""
};
} else if (url.indexOf('/admin/service/registration/getStatus') != -1) {
obj = {
"planType": "Cracked",
"deviceStatus": "",
"subscriptions": []
};
} else if (url.indexOf('/admin/service/supporter/retrievekey') != -1) {
obj = {
"Success": false,
"ErrorMessage": "Supporter not found"
};
}
myData = JSON.stringify(obj);
const myResponse = {
status: myStatus,
headers: myHeaders, // Optional.
body: myData // Optional.
};
var $util = util();
//$util.notify('Emby Premiere 已激活');
$util.done(myResponse);
function util() {
const isRequest = typeof $request != "undefined"
const isSurge = typeof $httpClient != "undefined"
const isQuanX = typeof $task != "undefined"
const notify = (title, subtitle = '', message = '') => {
if (isQuanX) $notify(title, subtitle, message)
if (isSurge) $notification.post(title, subtitle, message)
}
const write = (value, key) => {
if (isQuanX) return $prefs.setValueForKey(value, key)
if (isSurge) return $persistentStore.write(value, key)
}
const read = (key) => {
if (isQuanX) return $prefs.valueForKey(key)
if (isSurge) return $persistentStore.read(key)
}
const adapterStatus = (response) => {
if (response) {
if (response.status) {
response["statusCode"] = response.status
} else if (response.statusCode) {
response["status"] = response.statusCode
}
}
return response
}
const get = (options, callback) => {
if (isQuanX) {
if (typeof options == "string") options = {
url: options,
method: "GET"
}
$task.fetch(options).then(response => {
callback(null, adapterStatus(response), response.body)
}, reason => callback(reason.error, null, null))
}
if (isSurge) $httpClient.get(options, (error, response, body) => {
callback(error, adapterStatus(response), body)
})
}
const post = (options, callback) => {
if (isQuanX) {
if (typeof options == "string") options = {
url: options,
method: "POST"
}
$task.fetch(options).then(response => {
callback(null, adapterStatus(response), response.body)
}, reason => callback(reason.error, null, null))
}
if (isSurge) {
$httpClient.post(options, (error, response, body) => {
callback(error, adapterStatus(response), body)
})
}
}
const done = (value = {}) => {
if (isQuanX) return $done(value)
if (isSurge) isRequest ? $done(value) : $done()
}
return {
isRequest,
notify,
write,
read,
get,
post,
done
}
};