mirror of
https://github.com/the1812/Bilibili-Evolved.git
synced 2025-11-04 21:22:45 +08:00
Fix alway-preview resources
This commit is contained in:
parent
ffbff7132b
commit
260508b00a
@ -1,6 +1,6 @@
|
|||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name Bilibili Evolved (Offline)
|
// @name Bilibili Evolved (Offline)
|
||||||
// @version 418.77
|
// @version 418.79
|
||||||
// @description Bilibili Evolved 的离线版, 所有功能都已内置于脚本中.
|
// @description Bilibili Evolved 的离线版, 所有功能都已内置于脚本中.
|
||||||
// @author Grant Howard, Coulomb-G
|
// @author Grant Howard, Coulomb-G
|
||||||
// @copyright 2019, Grant Howard (https://github.com/the1812) & Coulomb-G (https://github.com/Coulomb-G)
|
// @copyright 2019, Grant Howard (https://github.com/the1812) & Coulomb-G (https://github.com/Coulomb-G)
|
||||||
@ -2235,19 +2235,18 @@ class ResourceManager {
|
|||||||
url,
|
url,
|
||||||
responseType: 'blob',
|
responseType: 'blob',
|
||||||
}))
|
}))
|
||||||
zip.forEach((filename, file) => {
|
let cache = {}
|
||||||
const url = Resource.root + 'min/' + filename
|
const files = zip.file(/.+/)
|
||||||
|
for (const file of files) {
|
||||||
|
const url = Resource.root + 'min/' + file.name
|
||||||
const resource = Object.values(Resource.all).find(it => it.rawUrl === url)
|
const resource = Object.values(Resource.all).find(it => it.rawUrl === url)
|
||||||
if (resource) {
|
if (resource && !resource.alwaysPreview) {
|
||||||
file.async('text').then(text => {
|
const text = await file.async('text')
|
||||||
settings.cache = Object.assign(settings.cache, {
|
cache[resource.key] = text
|
||||||
[resource.key]: text
|
console.log(`bundle update: saved ${resource.key}`)
|
||||||
})
|
|
||||||
// getHash(text).then(hash => console.log(`full download: saved ${resource.key} (${hash})`))
|
|
||||||
console.log(`bundle update: saved ${resource.key}`)
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
|
settings.cache = Object.assign(settings.cache, cache)
|
||||||
// } else {
|
// } else {
|
||||||
// const hashJson = await Ajax.monkey({
|
// const hashJson = await Ajax.monkey({
|
||||||
// url: Resource.root + 'min/bundle.json',
|
// url: Resource.root + 'min/bundle.json',
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name Bilibili Evolved (Preview Offline)
|
// @name Bilibili Evolved (Preview Offline)
|
||||||
// @version 418.77
|
// @version 418.79
|
||||||
// @description Bilibili Evolved 的预览离线版, 可以抢先体验新功能, 并且所有功能都已内置于脚本中.
|
// @description Bilibili Evolved 的预览离线版, 可以抢先体验新功能, 并且所有功能都已内置于脚本中.
|
||||||
// @author Grant Howard, Coulomb-G
|
// @author Grant Howard, Coulomb-G
|
||||||
// @copyright 2019, Grant Howard (https://github.com/the1812) & Coulomb-G (https://github.com/Coulomb-G)
|
// @copyright 2019, Grant Howard (https://github.com/the1812) & Coulomb-G (https://github.com/Coulomb-G)
|
||||||
@ -2235,19 +2235,18 @@ class ResourceManager {
|
|||||||
url,
|
url,
|
||||||
responseType: 'blob',
|
responseType: 'blob',
|
||||||
}))
|
}))
|
||||||
zip.forEach((filename, file) => {
|
let cache = {}
|
||||||
const url = Resource.root + 'min/' + filename
|
const files = zip.file(/.+/)
|
||||||
|
for (const file of files) {
|
||||||
|
const url = Resource.root + 'min/' + file.name
|
||||||
const resource = Object.values(Resource.all).find(it => it.rawUrl === url)
|
const resource = Object.values(Resource.all).find(it => it.rawUrl === url)
|
||||||
if (resource) {
|
if (resource && !resource.alwaysPreview) {
|
||||||
file.async('text').then(text => {
|
const text = await file.async('text')
|
||||||
settings.cache = Object.assign(settings.cache, {
|
cache[resource.key] = text
|
||||||
[resource.key]: text
|
console.log(`bundle update: saved ${resource.key}`)
|
||||||
})
|
|
||||||
// getHash(text).then(hash => console.log(`full download: saved ${resource.key} (${hash})`))
|
|
||||||
console.log(`bundle update: saved ${resource.key}`)
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
|
settings.cache = Object.assign(settings.cache, cache)
|
||||||
// } else {
|
// } else {
|
||||||
// const hashJson = await Ajax.monkey({
|
// const hashJson = await Ajax.monkey({
|
||||||
// url: Resource.root + 'min/bundle.json',
|
// url: Resource.root + 'min/bundle.json',
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name Bilibili Evolved (Preview)
|
// @name Bilibili Evolved (Preview)
|
||||||
// @version 1.9.1
|
// @version 1.9.2
|
||||||
// @description Bilibili Evolved 的预览版, 可以抢先体验新功能.
|
// @description Bilibili Evolved 的预览版, 可以抢先体验新功能.
|
||||||
// @author Grant Howard, Coulomb-G
|
// @author Grant Howard, Coulomb-G
|
||||||
// @copyright 2019, Grant Howard (https://github.com/the1812) & Coulomb-G (https://github.com/Coulomb-G)
|
// @copyright 2019, Grant Howard (https://github.com/the1812) & Coulomb-G (https://github.com/Coulomb-G)
|
||||||
@ -1202,12 +1202,24 @@ class Resource {
|
|||||||
console.log(`hit cache: ${key}`)
|
console.log(`hit cache: ${key}`)
|
||||||
resolve(cache)
|
resolve(cache)
|
||||||
} else {
|
} else {
|
||||||
this.text = onlineData[this.rawUrl]
|
this.text = onlineData[this.url]
|
||||||
console.log(`load online data: ${key}`)
|
// settings.cache = Object.assign(settings.cache, {
|
||||||
settings.cache = Object.assign(settings.cache, {
|
// [key]: this.text
|
||||||
[key]: this.text
|
// })
|
||||||
})
|
if (text) {
|
||||||
resolve(this.text)
|
console.log(`load online data: ${key}`)
|
||||||
|
resolve(this.text)
|
||||||
|
} else {
|
||||||
|
Ajax.monkey({ url: this.url })
|
||||||
|
.then(text => {
|
||||||
|
this.text = text
|
||||||
|
settings.cache = Object.assign(settings.cache, {
|
||||||
|
[key]: text
|
||||||
|
})
|
||||||
|
resolve(this.text)
|
||||||
|
})
|
||||||
|
.catch(error => reject(error))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Ajax.monkey({ url: this.url })
|
Ajax.monkey({ url: this.url })
|
||||||
@ -2257,19 +2269,18 @@ class ResourceManager {
|
|||||||
url,
|
url,
|
||||||
responseType: 'blob',
|
responseType: 'blob',
|
||||||
}))
|
}))
|
||||||
zip.forEach((filename, file) => {
|
let cache = {}
|
||||||
const url = Resource.root + 'min/' + filename
|
const files = zip.file(/.+/)
|
||||||
|
for (const file of files) {
|
||||||
|
const url = Resource.root + 'min/' + file.name
|
||||||
const resource = Object.values(Resource.all).find(it => it.rawUrl === url)
|
const resource = Object.values(Resource.all).find(it => it.rawUrl === url)
|
||||||
if (resource) {
|
if (resource && !resource.alwaysPreview) {
|
||||||
file.async('text').then(text => {
|
const text = await file.async('text')
|
||||||
settings.cache = Object.assign(settings.cache, {
|
cache[resource.key] = text
|
||||||
[resource.key]: text
|
console.log(`bundle update: saved ${resource.key}`)
|
||||||
})
|
|
||||||
// getHash(text).then(hash => console.log(`full download: saved ${resource.key} (${hash})`))
|
|
||||||
console.log(`bundle update: saved ${resource.key}`)
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
|
settings.cache = Object.assign(settings.cache, cache)
|
||||||
// } else {
|
// } else {
|
||||||
// const hashJson = await Ajax.monkey({
|
// const hashJson = await Ajax.monkey({
|
||||||
// url: Resource.root + 'min/bundle.json',
|
// url: Resource.root + 'min/bundle.json',
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name Bilibili Evolved
|
// @name Bilibili Evolved
|
||||||
// @version 1.9.1
|
// @version 1.9.2
|
||||||
// @description 强大的哔哩哔哩增强脚本: 下载视频, 音乐, 封面, 弹幕 / 自定义播放器画质, 模式, 布局 / 自定义顶栏, 删除广告, 夜间模式 / 触屏设备支持
|
// @description 强大的哔哩哔哩增强脚本: 下载视频, 音乐, 封面, 弹幕 / 自定义播放器画质, 模式, 布局 / 自定义顶栏, 删除广告, 夜间模式 / 触屏设备支持
|
||||||
// @author Grant Howard, Coulomb-G
|
// @author Grant Howard, Coulomb-G
|
||||||
// @copyright 2019, Grant Howard (https://github.com/the1812) & Coulomb-G (https://github.com/Coulomb-G)
|
// @copyright 2019, Grant Howard (https://github.com/the1812) & Coulomb-G (https://github.com/Coulomb-G)
|
||||||
@ -1202,12 +1202,24 @@ class Resource {
|
|||||||
console.log(`hit cache: ${key}`)
|
console.log(`hit cache: ${key}`)
|
||||||
resolve(cache)
|
resolve(cache)
|
||||||
} else {
|
} else {
|
||||||
this.text = onlineData[this.rawUrl]
|
this.text = onlineData[this.url]
|
||||||
console.log(`load online data: ${key}`)
|
// settings.cache = Object.assign(settings.cache, {
|
||||||
settings.cache = Object.assign(settings.cache, {
|
// [key]: this.text
|
||||||
[key]: this.text
|
// })
|
||||||
})
|
if (text) {
|
||||||
resolve(this.text)
|
console.log(`load online data: ${key}`)
|
||||||
|
resolve(this.text)
|
||||||
|
} else {
|
||||||
|
Ajax.monkey({ url: this.url })
|
||||||
|
.then(text => {
|
||||||
|
this.text = text
|
||||||
|
settings.cache = Object.assign(settings.cache, {
|
||||||
|
[key]: text
|
||||||
|
})
|
||||||
|
resolve(this.text)
|
||||||
|
})
|
||||||
|
.catch(error => reject(error))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Ajax.monkey({ url: this.url })
|
Ajax.monkey({ url: this.url })
|
||||||
@ -2257,19 +2269,18 @@ class ResourceManager {
|
|||||||
url,
|
url,
|
||||||
responseType: 'blob',
|
responseType: 'blob',
|
||||||
}))
|
}))
|
||||||
zip.forEach((filename, file) => {
|
let cache = {}
|
||||||
const url = Resource.root + 'min/' + filename
|
const files = zip.file(/.+/)
|
||||||
|
for (const file of files) {
|
||||||
|
const url = Resource.root + 'min/' + file.name
|
||||||
const resource = Object.values(Resource.all).find(it => it.rawUrl === url)
|
const resource = Object.values(Resource.all).find(it => it.rawUrl === url)
|
||||||
if (resource) {
|
if (resource && !resource.alwaysPreview) {
|
||||||
file.async('text').then(text => {
|
const text = await file.async('text')
|
||||||
settings.cache = Object.assign(settings.cache, {
|
cache[resource.key] = text
|
||||||
[resource.key]: text
|
console.log(`bundle update: saved ${resource.key}`)
|
||||||
})
|
|
||||||
// getHash(text).then(hash => console.log(`full download: saved ${resource.key} (${hash})`))
|
|
||||||
console.log(`bundle update: saved ${resource.key}`)
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
|
settings.cache = Object.assign(settings.cache, cache)
|
||||||
// } else {
|
// } else {
|
||||||
// const hashJson = await Ajax.monkey({
|
// const hashJson = await Ajax.monkey({
|
||||||
// url: Resource.root + 'min/bundle.json',
|
// url: Resource.root + 'min/bundle.json',
|
||||||
|
|||||||
@ -39,7 +39,7 @@ namespace BilibiliEvolved.Build
|
|||||||
{
|
{
|
||||||
var filename = Path.GetFileName(url);
|
var filename = Path.GetFileName(url);
|
||||||
var hash = string.Join("", sha256.ComputeHash(File.OpenRead(url)).Select(b => b.ToString("X2")).ToArray());
|
var hash = string.Join("", sha256.ComputeHash(File.OpenRead(url)).Select(b => b.ToString("X2")).ToArray());
|
||||||
zip.CreateEntryFromFile(url, filename);
|
zip.CreateEntryFromFile(url, filename, CompressionLevel.NoCompression);
|
||||||
hashDict.Add(filename, hash);
|
hashDict.Add(filename, hash);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
BIN
min/bundle.zip
BIN
min/bundle.zip
Binary file not shown.
@ -1,6 +1,6 @@
|
|||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name Bilibili Evolved (Preview)
|
// @name Bilibili Evolved (Preview)
|
||||||
// @version 1.9.1
|
// @version 1.9.2
|
||||||
// @description Bilibili Evolved 的预览版, 可以抢先体验新功能.
|
// @description Bilibili Evolved 的预览版, 可以抢先体验新功能.
|
||||||
// @author Grant Howard, Coulomb-G
|
// @author Grant Howard, Coulomb-G
|
||||||
// @copyright 2019, Grant Howard (https://github.com/the1812) & Coulomb-G (https://github.com/Coulomb-G)
|
// @copyright 2019, Grant Howard (https://github.com/the1812) & Coulomb-G (https://github.com/Coulomb-G)
|
||||||
|
|||||||
@ -244,19 +244,18 @@ export class ResourceManager {
|
|||||||
url,
|
url,
|
||||||
responseType: 'blob',
|
responseType: 'blob',
|
||||||
}))
|
}))
|
||||||
zip.forEach((filename, file) => {
|
let cache = {}
|
||||||
const url = Resource.root + 'min/' + filename
|
const files = zip.file(/.+/)
|
||||||
|
for (const file of files) {
|
||||||
|
const url = Resource.root + 'min/' + file.name
|
||||||
const resource = Object.values(Resource.all).find(it => it.rawUrl === url)
|
const resource = Object.values(Resource.all).find(it => it.rawUrl === url)
|
||||||
if (resource) {
|
if (resource && !resource.alwaysPreview) {
|
||||||
file.async('text').then(text => {
|
const text = await file.async('text')
|
||||||
settings.cache = Object.assign(settings.cache, {
|
cache[resource.key] = text
|
||||||
[resource.key]: text
|
console.log(`bundle update: saved ${resource.key}`)
|
||||||
})
|
|
||||||
// getHash(text).then(hash => console.log(`full download: saved ${resource.key} (${hash})`))
|
|
||||||
console.log(`bundle update: saved ${resource.key}`)
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
|
settings.cache = Object.assign(settings.cache, cache)
|
||||||
// } else {
|
// } else {
|
||||||
// const hashJson = await Ajax.monkey({
|
// const hashJson = await Ajax.monkey({
|
||||||
// url: Resource.root + 'min/bundle.json',
|
// url: Resource.root + 'min/bundle.json',
|
||||||
|
|||||||
@ -59,12 +59,24 @@ export class Resource {
|
|||||||
console.log(`hit cache: ${key}`)
|
console.log(`hit cache: ${key}`)
|
||||||
resolve(cache)
|
resolve(cache)
|
||||||
} else {
|
} else {
|
||||||
this.text = onlineData[this.rawUrl]
|
this.text = onlineData[this.url]
|
||||||
console.log(`load online data: ${key}`)
|
// settings.cache = Object.assign(settings.cache, {
|
||||||
settings.cache = Object.assign(settings.cache, {
|
// [key]: this.text
|
||||||
[key]: this.text
|
// })
|
||||||
})
|
if (text) {
|
||||||
resolve(this.text)
|
console.log(`load online data: ${key}`)
|
||||||
|
resolve(this.text)
|
||||||
|
} else {
|
||||||
|
Ajax.monkey({ url: this.url })
|
||||||
|
.then(text => {
|
||||||
|
this.text = text
|
||||||
|
settings.cache = Object.assign(settings.cache, {
|
||||||
|
[key]: text
|
||||||
|
})
|
||||||
|
resolve(this.text)
|
||||||
|
})
|
||||||
|
.catch(error => reject(error))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Ajax.monkey({ url: this.url })
|
Ajax.monkey({ url: this.url })
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
1.9.1
|
1.9.2
|
||||||
Loading…
Reference in New Issue
Block a user