Repo created
This commit is contained in:
parent
f3a6b3a320
commit
f954c78789
614 changed files with 135712 additions and 2 deletions
14
_scripts/add-iv-supported-links.js
Normal file
14
_scripts/add-iv-supported-links.js
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
|
||||
const { readFile, writeFile } = require('fs/promises')
|
||||
const { join } = require('path')
|
||||
|
||||
;(async () => {
|
||||
const manifest = (await readFile(join(__dirname, '../android/app/src/main/AndroidManifest.xml'))).toString()
|
||||
const invidiousInstances = JSON.parse((await readFile(join(__dirname, '../static/invidious-instances.json'))).toString())
|
||||
const supportedLinks = manifest.match(/<!-- supported links -->[\s\S]*?<!-- \/supported links -->/gm)
|
||||
const instancesXml = invidiousInstances.map(({ url, cors}) => {
|
||||
return `<data android:host="${url.replace('https://', '')}" />`
|
||||
}).join('\n ')
|
||||
const postManifest = manifest.replace(supportedLinks[0], `<!-- supported links -->\n ${instancesXml}\n <!-- \/supported links -->`)
|
||||
await writeFile(join(__dirname, '../android/app/src/main/AndroidManifest.xml'), postManifest)
|
||||
})()
|
||||
Loading…
Add table
Add a link
Reference in a new issue