修复设置默认解析网址

This commit is contained in:
haiyangcui
2021-04-20 22:13:16 +02:00
parent 0b198381b1
commit c7ca3df50d
4 changed files with 20 additions and 22 deletions

View File

@@ -342,7 +342,7 @@ export default {
videoTitle: true,
airplay: true,
closeVideoTouch: true,
ignores: ['cssFullscreen', 'replay', 'error'], // 为了切换播放器类型时避免显示错误刷新,暂时忽略错误
ignores: ['replay', 'error'], // 为了切换播放器类型时避免显示错误刷新,暂时忽略错误
preloadTime: 300
},
state: {

View File

@@ -173,7 +173,7 @@
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="closeDialog">取消</el-button>
<el-button type="danger" @click="get7kParseURL">重置</el-button>
<el-button type="danger" @click="resetDefaultParseURL">重置</el-button>
<el-button type="primary" @click="configDefaultParseURL">确定</el-button>
</span>
</el-dialog>
@@ -187,7 +187,7 @@
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="closeDialog">取消</el-button>
<el-button type="danger" @click="getDefaultdeSitesDataURL">重置</el-button>
<el-button type="danger" @click="resetDefaultSitesDataURL">重置</el-button>
<el-button type="primary" @click="configSitesDataURL">确定</el-button>
</span>
</el-dialog>
@@ -334,7 +334,7 @@ export default {
this.d = res
this.setting = this.d
if (!this.setting.defaultParseURL) this.configDefaultParseURL()
if (!this.setting.sitesDataURL) this.getDefaultdeSitesDataURL()
if (!this.setting.sitesDataURL) this.resetDefaultSitesDataURL()
})
},
getDefaultSites () {
@@ -380,24 +380,20 @@ export default {
this.d.excludeRootClasses = !this.d.excludeRootClasses
this.updateSettingEvent()
},
async get7kParseURL () {
const parseURL = await zy.get7kParseURL()
if (parseURL.startsWith('http')) {
this.$message.success('获取成功,更新应用默认解析接口地址...')
this.setting.defaultParseURL = parseURL
}
async resetDefaultParseURL () {
this.setting.defaultParseURL = 'https://jx.bpba.cc/?v='
},
async configDefaultParseURL () {
if (!this.setting.defaultParseURL) await this.get7kParseURL()
if (!this.setting.defaultParseURL) await this.resetDefaultParseURL()
this.d.defaultParseURL = this.setting.defaultParseURL?.trim()
this.show.configDefaultParseUrlDialog = false
this.updateSettingEvent()
},
getDefaultdeSitesDataURL () {
resetDefaultSitesDataURL () {
this.setting.sitesDataURL = 'https://gitee.com/cuiocean/ZY-Player-Resources/raw/main/Sites/Sites.json'
},
configSitesDataURL () {
if (!this.setting.sitesDataURL) this.getDefaultdeSitesDataURL()
if (!this.setting.sitesDataURL) this.resetDefaultSitesDataURL()
this.d.sitesDataURL = this.setting.sitesDataURL
this.show.configSitesDataUrlDialog = false
this.updateSettingEvent()

View File

@@ -90,6 +90,17 @@ db.version(11).stores({
})
})
db.version(11).stores({
setting: 'id, theme, shortcut, view, volume, externalPlayer, searchGroup, excludeRootClasses, excludeR18Films, forwardTimeInSec, starViewMode, recommandationViewMode,' +
'searchViewMode, password, proxy, allowPassWhenIptvCheck, autocleanWhenIptvCheck, rootClassFilter, r18ClassFilter, classFilter, restoreWindowPositionAndSize,' +
'windowPositionAndSize, pauseWhenMinimize, sitesDataURL, defaultParseURL'
}).upgrade(trans => {
trans.setting.toCollection().modify(setting => {
setting.sitesDataURL = 'https://gitee.com/cuiocean/ZY-Player-Resources/raw/main/Sites/Sites.json'
setting.defaultParseURL = 'https://jx.bpba.cc/?v='
})
})
db.on('populate', () => {
db.setting.bulkAdd(iniSetting)
db.sites.bulkAdd(sites)

View File

@@ -563,15 +563,6 @@ const zy = {
})
})
},
get7kParseURL () {
return new Promise((resolve, reject) => {
axios.get('https://zy.7kjx.com/').then(res => {
const $ = cheerio.load(res.data)
const parseURL = $('body > div.container > div > div.stui-pannel > div.col-pd > p:contains("解析接口:")').first().find('a').text()
resolve(parseURL)
}).catch(err => { reject(err) })
})
},
getDefaultSites () {
const url = 'https://gitee.com/cuiocean/ZY-Player-Resources/raw/main/Sites/Sites.json'
return new Promise((resolve, reject) => {