mirror of
https://github.com/the1812/Bilibili-Evolved.git
synced 2025-11-04 21:22:45 +08:00
Change error message
This commit is contained in:
parent
c5f84409c7
commit
9e0d21fb9f
2
@types/global/index.d.ts
vendored
2
@types/global/index.d.ts
vendored
@ -304,8 +304,6 @@ declare global {
|
|||||||
function addSettingsListener(key: keyof BilibiliEvolvedSettings, handler: (newValue: any, oldValue: any) => void, initCall?: boolean): void;
|
function addSettingsListener(key: keyof BilibiliEvolvedSettings, handler: (newValue: any, oldValue: any) => void, initCall?: boolean): void;
|
||||||
function removeSettingsListener(key: keyof BilibiliEvolvedSettings, handler: (newValue: any, oldValue: any) => void): void;
|
function removeSettingsListener(key: keyof BilibiliEvolvedSettings, handler: (newValue: any, oldValue: any) => void): void;
|
||||||
function onSettingsChange(change: (key: string, oldValue: any, newValue: any) => void): void;
|
function onSettingsChange(change: (key: string, oldValue: any, newValue: any) => void): void;
|
||||||
function downloadText(url: string, load: (text: string) => void, error: (text: string) => void): void;
|
|
||||||
function downloadText(url: string): Promise<string>;
|
|
||||||
function raiseEvent(element: Element, eventName: string): void;
|
function raiseEvent(element: Element, eventName: string): void;
|
||||||
function loadLazyPanel(selector: string): Promise<void>;
|
function loadLazyPanel(selector: string): Promise<void>;
|
||||||
function loadDanmakuSettingsPanel(): Promise<void>;
|
function loadDanmakuSettingsPanel(): Promise<void>;
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -345,7 +345,13 @@ function onSettingsChange () {
|
|||||||
class Ajax {
|
class Ajax {
|
||||||
static send (xhr, body, text = true) {
|
static send (xhr, body, text = true) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
xhr.addEventListener('load', () => resolve(text ? xhr.responseText : xhr.response))
|
xhr.addEventListener('load', () => {
|
||||||
|
// if (xhr.status.toString().match(/^[45]/)) {
|
||||||
|
// reject(xhr.status)
|
||||||
|
// } else {
|
||||||
|
resolve(text ? xhr.responseText : xhr.response)
|
||||||
|
// }
|
||||||
|
})
|
||||||
xhr.addEventListener('error', () => reject(xhr.status))
|
xhr.addEventListener('error', () => reject(xhr.status))
|
||||||
xhr.send(body)
|
xhr.send(body)
|
||||||
})
|
})
|
||||||
@ -458,24 +464,6 @@ function setupAjaxHook () {
|
|||||||
return hook('send', this, ...args)
|
return hook('send', this, ...args)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function downloadText (url, load, error) // The old method for compatibility
|
|
||||||
{
|
|
||||||
const xhr = new XMLHttpRequest()
|
|
||||||
xhr.open('GET', url)
|
|
||||||
|
|
||||||
if (load !== undefined) // callback
|
|
||||||
{
|
|
||||||
xhr.addEventListener('load', () => load && load(xhr.responseText))
|
|
||||||
xhr.addEventListener('error', () => error && error(xhr.status))
|
|
||||||
xhr.send()
|
|
||||||
} else {
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
xhr.addEventListener('load', () => resolve(xhr.responseText))
|
|
||||||
xhr.addEventListener('error', () => reject(xhr.status))
|
|
||||||
xhr.send()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function loadResources () {
|
function loadResources () {
|
||||||
Resource.root = 'https://raw.githubusercontent.com/the1812/Bilibili-Evolved/preview/'
|
Resource.root = 'https://raw.githubusercontent.com/the1812/Bilibili-Evolved/preview/'
|
||||||
|
|||||||
@ -345,7 +345,13 @@ function onSettingsChange () {
|
|||||||
class Ajax {
|
class Ajax {
|
||||||
static send (xhr, body, text = true) {
|
static send (xhr, body, text = true) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
xhr.addEventListener('load', () => resolve(text ? xhr.responseText : xhr.response))
|
xhr.addEventListener('load', () => {
|
||||||
|
// if (xhr.status.toString().match(/^[45]/)) {
|
||||||
|
// reject(xhr.status)
|
||||||
|
// } else {
|
||||||
|
resolve(text ? xhr.responseText : xhr.response)
|
||||||
|
// }
|
||||||
|
})
|
||||||
xhr.addEventListener('error', () => reject(xhr.status))
|
xhr.addEventListener('error', () => reject(xhr.status))
|
||||||
xhr.send(body)
|
xhr.send(body)
|
||||||
})
|
})
|
||||||
@ -458,24 +464,6 @@ function setupAjaxHook () {
|
|||||||
return hook('send', this, ...args)
|
return hook('send', this, ...args)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function downloadText (url, load, error) // The old method for compatibility
|
|
||||||
{
|
|
||||||
const xhr = new XMLHttpRequest()
|
|
||||||
xhr.open('GET', url)
|
|
||||||
|
|
||||||
if (load !== undefined) // callback
|
|
||||||
{
|
|
||||||
xhr.addEventListener('load', () => load && load(xhr.responseText))
|
|
||||||
xhr.addEventListener('error', () => error && error(xhr.status))
|
|
||||||
xhr.send()
|
|
||||||
} else {
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
xhr.addEventListener('load', () => resolve(xhr.responseText))
|
|
||||||
xhr.addEventListener('error', () => reject(xhr.status))
|
|
||||||
xhr.send()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function loadResources () {
|
function loadResources () {
|
||||||
Resource.root = 'https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/'
|
Resource.root = 'https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/'
|
||||||
|
|||||||
@ -1,7 +1,13 @@
|
|||||||
export class Ajax {
|
export class Ajax {
|
||||||
static send (xhr, body, text = true) {
|
static send (xhr, body, text = true) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
xhr.addEventListener('load', () => resolve(text ? xhr.responseText : xhr.response))
|
xhr.addEventListener('load', () => {
|
||||||
|
// if (xhr.status.toString().match(/^[45]/)) {
|
||||||
|
// reject(xhr.status)
|
||||||
|
// } else {
|
||||||
|
resolve(text ? xhr.responseText : xhr.response)
|
||||||
|
// }
|
||||||
|
})
|
||||||
xhr.addEventListener('error', () => reject(xhr.status))
|
xhr.addEventListener('error', () => reject(xhr.status))
|
||||||
xhr.send(body)
|
xhr.send(body)
|
||||||
})
|
})
|
||||||
@ -114,21 +120,3 @@ export function setupAjaxHook () {
|
|||||||
return hook('send', this, ...args)
|
return hook('send', this, ...args)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export function downloadText (url, load, error) // The old method for compatibility
|
|
||||||
{
|
|
||||||
const xhr = new XMLHttpRequest()
|
|
||||||
xhr.open('GET', url)
|
|
||||||
|
|
||||||
if (load !== undefined) // callback
|
|
||||||
{
|
|
||||||
xhr.addEventListener('load', () => load && load(xhr.responseText))
|
|
||||||
xhr.addEventListener('error', () => error && error(xhr.status))
|
|
||||||
xhr.send()
|
|
||||||
} else {
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
xhr.addEventListener('load', () => resolve(xhr.responseText))
|
|
||||||
xhr.addEventListener('error', () => reject(xhr.status))
|
|
||||||
xhr.send()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
2
min/aria2-rpc.min.js
vendored
2
min/aria2-rpc.min.js
vendored
@ -1 +1 @@
|
|||||||
(()=>{return(t,o)=>{function r(){const o=t.aria2RpcOption;const r=o.host.match(/^http[s]?:\/\//)?o.host:"http://"+o.host;const e="aria2.addUri";return{option:o,host:r,methodName:e}}async function e(t,o=false){try{let r=await t();if(typeof r==="string"){r=JSON.parse(r)}if(r.error!==undefined){if(r.error.code===1){logError(`请求遭到拒绝, 请检查您的密钥相关设置.`)}else{logError(`请求发生错误, code = ${r.error.code}, message = ${r.error.message}`)}return false}if(!o){Toast.success(`成功发送了请求, GID = ${r.result}`,"aria2 RPC",5e3)}return true}catch(t){logError(`无法连接到RPC主机, error = ${t}`);return false}}async function a(t,o=false){const{option:a,host:s,methodName:n}=r();return await e(async()=>{const o=window.btoa(unescape(encodeURIComponent(JSON.stringify(t.params))));const r=`${s}:${a.port}/jsonrpc?method=${n}&id=${t.id}¶ms=${o}`;console.log(`RPC request:`,r);return await Ajax.getJson(r)},o)}async function s(t,o=false){const{option:a,host:s,methodName:n}=r();return await e(async()=>{const o=`${s}:${a.port}/jsonrpc`;return await Ajax.postJson(o,{method:n,id:t.id,params:t.params})},o)}async function n(o,r=false){const e=t.aria2RpcOption;for(const t of o){let o;if(e.method==="get"){o=await a(t,r)}else{o=await s(t,r)}if(r===true&&o===false){logError(`${t.id} 导出失败`)}}}return{export:{sendRpc:n}}}})();
|
(()=>{return(t,o)=>{function r(){const o=t.aria2RpcOption;const r=o.host.match(/^http[s]?:\/\//)?o.host:"http://"+o.host;const e="aria2.addUri";return{option:o,host:r,methodName:e}}async function e(t,o=false){try{let r=await t();if(typeof r==="string"){r=JSON.parse(r)}if(r.error!==undefined){if(r.error.code===1){logError(`请求遭到拒绝, 请检查您的密钥相关设置.`)}else{logError(`请求发生错误, code = ${r.error.code}, message = ${r.error.message}`)}return false}if(!o){Toast.success(`成功发送了请求, GID = ${r.result}`,"aria2 RPC",5e3)}return true}catch(t){logError(`无法连接到RPC主机.`);return false}}async function a(t,o=false){const{option:a,host:s,methodName:n}=r();return await e(async()=>{const o=window.btoa(unescape(encodeURIComponent(JSON.stringify(t.params))));const r=`${s}:${a.port}/jsonrpc?method=${n}&id=${t.id}¶ms=${o}`;console.log(`RPC request:`,r);return await Ajax.getJson(r)},o)}async function s(t,o=false){const{option:a,host:s,methodName:n}=r();return await e(async()=>{const o=`${s}:${a.port}/jsonrpc`;return await Ajax.postJson(o,{method:n,id:t.id,params:t.params})},o)}async function n(o,r=false){const e=t.aria2RpcOption;for(const t of o){let o;if(e.method==="get"){o=await a(t,r)}else{o=await s(t,r)}if(r===true&&o===false){logError(`${t.id} 导出失败`)}}}return{export:{sendRpc:n}}}})();
|
||||||
2
min/i18n.ja-JP.min.js
vendored
2
min/i18n.ja-JP.min.js
vendored
File diff suppressed because one or more lines are too long
@ -431,6 +431,7 @@ export const map = new Map([
|
|||||||
[`复制vld数据`, `vldをコピー`],
|
[`复制vld数据`, `vldをコピー`],
|
||||||
[`导出vld数据`, `vld`],
|
[`导出vld数据`, `vld`],
|
||||||
[`导出aria2 RPC`, `aria2 RPC`],
|
[`导出aria2 RPC`, `aria2 RPC`],
|
||||||
|
[`无法连接到RPC主机.`, `RPCホストに接続できません.`],
|
||||||
[`批量导出`, `バッチエクスポート`],
|
[`批量导出`, `バッチエクスポート`],
|
||||||
[`请至少选择1集或以上的数量!`, `少なくとも1つ以上のセットを選択してください!`],
|
[`请至少选择1集或以上的数量!`, `少なくとも1つ以上のセットを選択してください!`],
|
||||||
[`选集`, `エピソード`],
|
[`选集`, `エピソード`],
|
||||||
@ -714,7 +715,6 @@ export const regex = new Map([
|
|||||||
[/^高清 ([\d]+)P([60]?)([+])?$/, `HD $1P$2$3`],
|
[/^高清 ([\d]+)P([60]?)([+])?$/, `HD $1P$2$3`],
|
||||||
[/^清晰 ([\d]+)P$/, `$1P`],
|
[/^清晰 ([\d]+)P$/, `$1P`],
|
||||||
[/^流畅 ([\d]+)P$/, `$1P`],
|
[/^流畅 ([\d]+)P$/, `$1P`],
|
||||||
[/^无法连接到RPC主机, error=(.+)$/, `RPCホストに接続できません、error=$1`],
|
|
||||||
]);
|
]);
|
||||||
export default {
|
export default {
|
||||||
export: { map, regex },
|
export: { map, regex },
|
||||||
|
|||||||
@ -29,7 +29,7 @@ async function rpc(getResponse, batch = false) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch (error) { // Host or port is invalid
|
catch (error) { // Host or port is invalid
|
||||||
logError(`无法连接到RPC主机, error = ${error}`);
|
logError(`无法连接到RPC主机.`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -31,7 +31,7 @@ async function rpc(getResponse: () => Promise<any>, batch = false) {
|
|||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
} catch (error) { // Host or port is invalid
|
} catch (error) { // Host or port is invalid
|
||||||
logError(`无法连接到RPC主机, error = ${error}`)
|
logError(`无法连接到RPC主机.`)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -423,12 +423,10 @@ class VideoSpeed {
|
|||||||
this.workingDownloader = downloader;
|
this.workingDownloader = downloader;
|
||||||
}
|
}
|
||||||
startMeasure() {
|
startMeasure() {
|
||||||
// console.log(`total bytes = ${this.workingDownloader.totalSize}`)
|
|
||||||
this.intervalTimer = setInterval(() => {
|
this.intervalTimer = setInterval(() => {
|
||||||
const progress = this.workingDownloader.progressMap
|
const progress = this.workingDownloader.progressMap
|
||||||
? [...this.workingDownloader.progressMap.values()].reduce((a, b) => a + b, 0) : 0;
|
? [...this.workingDownloader.progressMap.values()].reduce((a, b) => a + b, 0) : 0;
|
||||||
const loadedBytes = progress - this.lastProgress;
|
const loadedBytes = progress - this.lastProgress;
|
||||||
// console.log(`${progress} - ${this.lastProgress} = ${loadedBytes} (${formatFileSize(loadedBytes)})`)
|
|
||||||
if (this.speedUpdate !== undefined) {
|
if (this.speedUpdate !== undefined) {
|
||||||
this.speedUpdate(formatFileSize(loadedBytes) + '/s');
|
this.speedUpdate(formatFileSize(loadedBytes) + '/s');
|
||||||
}
|
}
|
||||||
|
|||||||
@ -445,12 +445,10 @@ class VideoSpeed {
|
|||||||
this.workingDownloader = downloader
|
this.workingDownloader = downloader
|
||||||
}
|
}
|
||||||
startMeasure() {
|
startMeasure() {
|
||||||
// console.log(`total bytes = ${this.workingDownloader.totalSize}`)
|
|
||||||
this.intervalTimer = setInterval(() => {
|
this.intervalTimer = setInterval(() => {
|
||||||
const progress = this.workingDownloader.progressMap
|
const progress = this.workingDownloader.progressMap
|
||||||
? [...this.workingDownloader.progressMap.values()].reduce((a, b) => a + b, 0) : 0
|
? [...this.workingDownloader.progressMap.values()].reduce((a, b) => a + b, 0) : 0
|
||||||
const loadedBytes = progress - this.lastProgress
|
const loadedBytes = progress - this.lastProgress
|
||||||
// console.log(`${progress} - ${this.lastProgress} = ${loadedBytes} (${formatFileSize(loadedBytes)})`)
|
|
||||||
if (this.speedUpdate !== undefined) {
|
if (this.speedUpdate !== undefined) {
|
||||||
this.speedUpdate(formatFileSize(loadedBytes) + '/s')
|
this.speedUpdate(formatFileSize(loadedBytes) + '/s')
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user