Skip to content

Commit

Permalink
feat: UPOS服务器可应用到所有视频。#135
Browse files Browse the repository at this point in the history
  • Loading branch information
msojocs committed Nov 9, 2024
1 parent 1fe0699 commit 44d7124
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.MD
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## 🚀 功能

- roaming: 更新UPOS服务器列表。
- 视频播放:UPOS服务器可应用到所有视频。

# 🌈 v1.15.2-1 / 2024-11-06

Expand Down
2 changes: 2 additions & 0 deletions extensions/area_unlimit/hook/RoamingPage.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ <h4 class="b_text mt_0">upos服务器设置</h4>
<br>
PAC代理(例如:https://bili.api.jysafe.cn/pac.php?proxy=127.0.0.1:7890):
<el-input v-model="pacLink" @change="changePACLink"></el-input>
<br>
应用到所有视频:<el-switch v-model="uposApplyAll" @change="setUposApplyAll"></el-switch>
</div>
</div>
<div class="settings_content--item server-item">
Expand Down
17 changes: 17 additions & 0 deletions extensions/area_unlimit/hook/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -981,6 +981,23 @@ const URL_HOOK = {
UTILS.enableReferer()
},

/**
* 获取播放链接
* @param {XMLHttpRequest} req 原请求结果
* @returns {Promise<void>}
*/
'//api.bilibili.com/x/player/wbi/playurl': async (req) => {
// 默认pc,要referer
UTILS.enableReferer()
const upos = localStorage.upos || ""
const isReplaceAkamai = localStorage.replaceAkamai === "true"
if (localStorage.uposApplyAll === 'true')
{
// 应用到所有视频
req.responseText = UTILS.replaceUpos(req.responseText, uposMap[upos], isReplaceAkamai, '')
}
},

/**
* 用户信息
* @param {XMLHttpRequest} req 原请求结果
Expand Down
9 changes: 9 additions & 0 deletions extensions/area_unlimit/hook/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ window.log = window.log ||{
},
],
uposKey: localStorage.upos || 'none',
uposApplyAll: localStorage.uposApplyAll == 'true',
replaceAkamai: localStorage.replaceAkamai === "true",
pacLink: localStorage.pacLink || "",
serverList: {
Expand Down Expand Up @@ -328,6 +329,14 @@ window.log = window.log ||{
type: 'success'
})
},
setUposApplyAll: function(isAll) {
this.$notify({
title: 'Success',
message: "成功",
type: 'success'
})
localStorage.uposApplyAll = isAll ? 'true' : 'false'
},
changeReplaceAkamai: function () {
this.$notify({
title: 'Success',
Expand Down

0 comments on commit 44d7124

Please sign in to comment.