gddhy

_(:з」∠)_ 加载中...
  • 主页
  • 归档
  • 工具
  • 关于
所有文章 友链

gddhy

_(:з」∠)_ 加载中...

  • 主页
  • 归档
  • 工具
  • 关于

Magisk自定义更新通道

2021-06-28
字数统计:508字 阅读时长≈2分

直连Github国内网络环境有时会有点问题,所以利用Cloudflare Workers搭建了个magisk通道,利用workers直接获取magisk所需要的json文件

更新通道

stable.json

1
https://magisk.gddhy.net/stable.json

beta.json

1
https://magisk.gddhy.net/beta.json

canary.json

1
https://magisk.gddhy.net/canary.json

(点击链接窗口可以看到复制按钮)

jsdelivr的cdn链接

直接使用这几个效果或许会更好,毕竟有jsdelivr的cdn加速,会比workers去拉取github的文件再返回要快
stable.json

1
https://cdn.jsdelivr.net/gh/topjohnwu/magisk-files/stable.json

beta.json

1
https://cdn.jsdelivr.net/gh/topjohnwu/magisk-files/beta.json

canary.json

1
https://cdn.jsdelivr.net/gh/topjohnwu/magisk-files/canary.json

Magisk正式版从v22开始管理器、安装包、卸载包三合一,若需要从Recovery中刷入,只需要将 apk 后缀改为 zip 便可以直接刷入,若要卸载,将下载的apk文件改名为 uninstall.zip 刷入即可完成卸载

源码

workers每天的请求次数有限制,若上面链接不能使用,可以自行搭建使用

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
async function gatherResponse(response) {
const { headers } = response
const contentType = headers.get("content-type") || ""
if (contentType.includes("application/json")) {
return JSON.stringify(await response.json())
}
else if (contentType.includes("application/text")) {
return await response.text()
}
else if (contentType.includes("text/html")) {
return await response.text()
}
else {
return await response.text()
}
}

async function handleRequest(type) {
if(type == 0){
return Response.redirect(WEB_SITE, statusCode)
}
const init = {
headers: {
"content-type": "application/json;charset=UTF-8",
},
}
const response = await fetch(type == 1 ? JSON_STABLE : ( type == 2 ? JSON_BETA : JSON_CANARY), init)
const results = await gatherResponse(response)
return new Response(results, init)
}

addEventListener("fetch", event => {
const str = event.request.url
var type = 0
if(str.indexOf("stable.json")>=0){
type = 1
} else if(str.indexOf("beta.json")>=0){
type = 2
} else if(str.indexOf("canary.json")>=0){
type = 3
}
return event.respondWith(handleRequest(type))
})

const WEB_SITE = 'https://gddhy.net/2021/magisk-zi-ding-yi-geng-xin-tong-dao/'
const JSON_STABLE = 'https://raw.githubusercontent.com/topjohnwu/magisk-files/master/stable.json'
const JSON_BETA = 'https://raw.githubusercontent.com/topjohnwu/magisk-files/master/beta.json'
const JSON_CANARY = 'https://raw.githubusercontent.com/topjohnwu/magisk-files/master/canary.json'
const statusCode = 301
赏

谢谢你请我吃糖果

微信

扫一扫,分享到微信

微信分享二维码
易编辑
安卓语言设置
  1. 1. 更新通道
  2. 2. jsdelivr的cdn链接
  3. 3. 源码
留言已关闭
:gddhy
© gddhy
Hexo Theme Yilia by Litten
  • 所有文章
  • 友链

tag:

  • Android
  • 软件分享
  • game
  • Hexo
  • JavaScript
  • 旧机博物馆
  • MIUI
  • Java
  • git
  • Termux
  • mtk
  • 原神
  • Win
  • Html
  • 安卓学习笔记

    缺失模块

  • Luminous' Home
  • 影子博客
  • 四次元领域
  • 初之音
  • Mr.Pumpkin
  • ZhaoQuinn 's Blog