Fix Android app store buttons
This commit is contained in:
parent
80c4de0637
commit
e54dbe03e3
2 changed files with 19 additions and 11 deletions
|
@ -48,15 +48,15 @@ function install_aurora_store() {
|
||||||
aurora_store_worker.onmessage = e => {
|
aurora_store_worker.onmessage = e => {
|
||||||
if (e.data == 'success') {
|
if (e.data == 'success') {
|
||||||
document.getElementById('aurora-store-btn').outerHTML =
|
document.getElementById('aurora-store-btn').outerHTML =
|
||||||
`<button type="button btn-success" id="aurora-store-btn" onclick="install_aurora_store()"
|
`<button type="button btn-success" id="aurora-store-btn" onclick="require('child_process').spawn('waydroid', ['app', 'launch', 'com.aurora.store'])"
|
||||||
class="btn btn-success" disabled>Installed</button>`
|
class="btn btn-success">Open</button>`
|
||||||
} else if (e.data == 'failed') {
|
} else if (e.data == 'failed') {
|
||||||
document.getElementById('aurora-store-btn').outerHTML =
|
document.getElementById('aurora-store-btn').outerHTML =
|
||||||
`<button type="button btn-success" id="aurora-store-btn" onclick="install_aurora_store()"
|
`<button type="button btn-success" id="aurora-store-btn" onclick="install_aurora_store()"
|
||||||
class="btn btn-success" disabled>Failed</button>`
|
class="btn btn-success" disabled>Failed</button>`
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
document.getElementById('aurora-store-btn').outerHTML =
|
document.getElementById('aurora-store-btn').outerHTML =
|
||||||
`<button type="button btn-success" id="aurora-store-btn" onclick="install_aurora_store()"
|
`<button type="button btn-success" id="aurora-store-btn" onclick="install_aurora_store()"
|
||||||
class="btn btn-success">Install</button>`
|
class="btn btn-success">Install</button>`
|
||||||
}, 2000)
|
}, 2000)
|
||||||
}
|
}
|
||||||
|
@ -85,15 +85,15 @@ function install_f_droid() {
|
||||||
f_droid_worker.onmessage = e => {
|
f_droid_worker.onmessage = e => {
|
||||||
if (e.data == 'success') {
|
if (e.data == 'success') {
|
||||||
document.getElementById('f-droid-btn').outerHTML =
|
document.getElementById('f-droid-btn').outerHTML =
|
||||||
`<button type="button btn-success" id="f-droid-btn" onclick="install_f_droid()"
|
`<button type="button btn-success" id="fdroid-btn" onclick="require('child_process').spawn('waydroid', ['app', 'launch', 'org.fdroid.fdroid'])"
|
||||||
class="btn btn-primary" disabled>Installed</button>`
|
class="btn btn-primary">Open</button>`
|
||||||
} else if (e.data == 'failed') {
|
} else if (e.data == 'failed') {
|
||||||
document.getElementById('f-droid-btn').outerHTML =
|
document.getElementById('f-droid-btn').outerHTML =
|
||||||
`<button type="button btn-success" id="f-droid-btn" onclick="install_f_droid()"
|
`<button type="button btn-success" id="f-droid-btn" onclick="install_f_droid()"
|
||||||
class="btn btn-primary" disabled>Failed</button>`
|
class="btn btn-primary" disabled>Failed</button>`
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
document.getElementById('f-droid-btn').outerHTML =
|
document.getElementById('f-droid-btn').outerHTML =
|
||||||
`<button type="button btn-success" id="f-droid-btn" onclick="install_f_droid()"
|
`<button type="button btn-success" id="f-droid-btn" onclick="install_f_droid()"
|
||||||
class="btn btn-primary">Install</button>`
|
class="btn btn-primary">Install</button>`
|
||||||
}, 2000)
|
}, 2000)
|
||||||
}
|
}
|
||||||
|
@ -114,14 +114,22 @@ require('fs').stat('/var/lib/waydroid', (err, stat) => {
|
||||||
require('child_process').spawn('waydroid', ['session', 'start'])
|
require('child_process').spawn('waydroid', ['session', 'start'])
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (require('child_process').spawnSync('waydroid', ['app', 'list']).stdout.includes('com.aurora.store')) {
|
if (require('child_process').spawnSync('waydroid', ['app', 'list']).stdout.includes('com.aurora.store')) {
|
||||||
|
document.getElementById('aurora-store-btn').outerHTML =
|
||||||
|
`<button type="button btn-success" id="aurora-store-btn" onclick="require('child_process').spawn('waydroid', ['app', 'launch', 'com.aurora.store'])"
|
||||||
|
class="btn btn-success">Open</button>`
|
||||||
|
} else {
|
||||||
document.getElementById('aurora-store-btn').outerHTML =
|
document.getElementById('aurora-store-btn').outerHTML =
|
||||||
`<button type="button btn-success" id="aurora-store-btn" onclick="install_aurora_store()"
|
`<button type="button btn-success" id="aurora-store-btn" onclick="install_aurora_store()"
|
||||||
class="btn btn-success" disabled>Installed</button>`
|
class="btn btn-success">Install</button>`
|
||||||
}
|
}
|
||||||
if (require('child_process').spawnSync('waydroid', ['app', 'list']).stdout.includes('org.fdroid.fdroid')) {
|
if (require('child_process').spawnSync('waydroid', ['app', 'list']).stdout.includes('org.fdroid.fdroid')) {
|
||||||
document.getElementById('f-droid-btn').outerHTML =
|
document.getElementById('f-droid-btn').outerHTML =
|
||||||
`<button type="button btn-success" id="fdroid-btn" onclick="install_f_droid()"
|
`<button type="button btn-success" id="fdroid-btn" onclick="require('child_process').spawn('waydroid', ['app', 'launch', 'org.fdroid.fdroid'])"
|
||||||
class="btn btn-primary" disabled>Installed</button>`
|
class="btn btn-primary">Open</button>`
|
||||||
|
} else {
|
||||||
|
document.getElementById('f-droid-btn').outerHTML =
|
||||||
|
`<button type="button btn-success" id="f-droid-btn" onclick="install_f_droid()"
|
||||||
|
class="btn btn-primary">Install</button>`
|
||||||
}
|
}
|
||||||
}, 1000)
|
}, 1000)
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -59,7 +59,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<button type="button" id="f-droid-btn" onclick="waydroid_open_settings()"
|
<button type="button" onclick="waydroid_open_settings()"
|
||||||
class="btn btn-primary">Open Settings</button>
|
class="btn btn-primary">Open Settings</button>
|
||||||
<br><br>
|
<br><br>
|
||||||
<strong>Useful information</strong>
|
<strong>Useful information</strong>
|
||||||
|
|
Loading…
Reference in a new issue