Skip to content

Commit

Permalink
1、修复7.1.80以后脚本失效的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
nining377 committed Feb 17, 2021
1 parent df3f442 commit 3748775
Show file tree
Hide file tree
Showing 11 changed files with 80 additions and 17 deletions.
35 changes: 35 additions & 0 deletions .idea/jarRepositories.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ android {
applicationId "com.raincat.unblockmusicpro"
minSdkVersion 14
targetSdkVersion 23
versionCode 282
versionName "2.8.2"
versionCode 283
versionName "2.8.3"
archivesBaseName = "UnblockMusic.Pro_Xposed_${versionName}"
}
buildTypes {
Expand Down
6 changes: 4 additions & 2 deletions app/src/main/assets/UnblockNeteaseMusic-0.25.3/.dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@
.dockerignore

LICENSE
Procfile
*.md

node_modules
npm-debug.log

Dockerfile*
*.yml
src/browser/

src/browser/
ca.*
*.worker.js
5 changes: 4 additions & 1 deletion app/src/main/assets/UnblockNeteaseMusic-0.25.3/.npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,7 @@

Dockerfile*
*.yml
src/browser/

src/browser/
ca.*
*.worker.js
20 changes: 20 additions & 0 deletions app/src/main/assets/UnblockNeteaseMusic-0.25.3/endpoint.worker.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
addEventListener('fetch', event => {
event.respondWith(handleRequest(event.request))
})

const pattern = /^\/package\/([0-9a-zA-Z_\-=]+)\/(\w+\.\w+)$/

const handleRequest = async request => {
const notFound = new Response(null, { status: 404 })
const path = new URL(request.url).pathname
const [matched, base64Url, fileName] = pattern.exec(path || '') || []
if (!matched) return notFound
let url = base64Url.replace(/-/g, '+').replace(/_/g, '/')
try { url = new URL(atob(url)) } catch(_) { url = null }
if (!url) return notFound
const headers = new Headers(request.headers)
headers.set('host', url.host)
headers.delete('cookie')
const { method, body } = request
return fetch(url, { method, headers, body })
}
4 changes: 1 addition & 3 deletions app/src/main/assets/UnblockNeteaseMusic-0.25.3/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@
},
"author": "nondanee",
"license": "MIT",
"dependencies": {
"long": "^4.0.0"
},
"dependencies": {},
"publishConfig": {
"access": "public"
}
Expand Down
10 changes: 5 additions & 5 deletions app/src/main/assets/UnblockNeteaseMusic-0.25.3/src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,12 @@ server.authentication = config.token || null
global.endpoint = config.endpoint
if (config.endpoint) server.whitelist.push(escape(config.endpoint))

hosts['music.httpdns.c.163.com'] = random(['59.111.181.35', '59.111.181.38'])
hosts['httpdns.n.netease.com'] = random(['59.111.179.213', '59.111.179.214'])
// hosts['music.httpdns.c.163.com'] = random(['59.111.181.35', '59.111.181.38'])
// hosts['httpdns.n.netease.com'] = random(['59.111.179.213', '59.111.179.214'])

const dns = host => new Promise((resolve, reject) => require('dns').lookup(host, {all: true}, (error, records) => error ? reject(error) : resolve(records.map(record => record.address))))
const httpdns = host => require('./request')('POST', 'https://music.httpdns.c.163.com/d', {}, host).then(response => response.json()).then(jsonBody => jsonBody.dns.reduce((result, domain) => result.concat(domain.ips), []))
const httpdns2 = host => require('./request')('GET', 'https://httpdns.n.netease.com/httpdns/v2/d?domain=' + host).then(response => response.json()).then(jsonBody => Object.keys(jsonBody.data).map(key => jsonBody.data[key]).reduce((result, value) => result.concat(value.ip || []), []))
const httpdns = host => require('./request')('POST', 'http://music.httpdns.c.163.com/d', {}, host).then(response => response.json()).then(jsonBody => jsonBody.dns.reduce((result, domain) => result.concat(domain.ips), []))
const httpdns2 = host => require('./request')('GET', 'http://httpdns.n.netease.com/httpdns/v2/d?domain=' + host).then(response => response.json()).then(jsonBody => Object.keys(jsonBody.data).map(key => jsonBody.data[key]).reduce((result, value) => result.concat(value.ip || []), []))

Promise.all([httpdns, httpdns2].map(query => query(target.join(','))).concat(target.map(dns)))
.then(result => {
Expand All @@ -83,4 +83,4 @@ Promise.all([httpdns, httpdns2].map(query => query(target.join(','))).concat(tar
if (port[0]) server.http.listen(port[0], address).once('listening', () => log(0))
if (port[1]) server.https.listen(port[1], address).once('listening', () => log(1))
})
.catch(error => console.log(error))
.catch(error => console.log(error))
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,11 @@ const track = id => {
.find(format => format.itag === 140)
// .filter(format => [249, 250, 140, 251].includes(format.itag)) // NetaseMusic PC client do not support webm format
// .sort((a, b) => b.bitrate - a.bitrate)[0]
const target = parse(stream.cipher)
const target = parse(stream.signatureCipher)
return stream.url || (target.sp.includes('sig') ? cache(signature, undefined, 24 * 60 * 60 * 1000).then(sign => target.url + '&sig=' + sign(target.s)) : target.url)
})
}

const check = info => cache(key ? apiSearch : search, info).then(track)

module.exports = {check, track}
module.exports = {check, track}
5 changes: 5 additions & 0 deletions app/src/main/assets/log/update.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
2、有问题先看问题解答
3、本软件免费,首发于酷安,转载请注明出处。

2021.2.17 V2.8.3
1、我终于想起了自己github密码(误)
2、主要是把脚本代码更新到了最新,因为@nondanee 已经基本上不维护脚本了,所以能用到啥时候就啥时候啦,咱们有缘再见!
注:建议删除SDCard目录下的UnblockMusicPro文件夹与清除网易云音乐数据以重新释放脚本

2020.7.11 V2.8.2
1、修复7.1.80以后脚本失效的问题

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ private void initView() {

tv_version.setText(BuildConfig.VERSION_NAME);
tv_perfect[0].setText("Google:4.3.1");
tv_perfect[1].setText("Global:6.0.0~7.2.0");
tv_perfect[1].setText("Global:6.0.0~8.1.10");

share = getSharedPreferences("share", Context.MODE_WORLD_READABLE);
originIndex = share.getInt("origin", 0);
Expand Down

0 comments on commit 3748775

Please sign in to comment.