mirror of
https://github.com/NoCrypt/migu.git
synced 2026-05-21 01:01:51 +00:00
feat: add auto updater toggle
This commit is contained in:
parent
5883ebb887
commit
5620a99776
6 changed files with 19 additions and 3 deletions
|
|
@ -24,6 +24,8 @@
|
||||||
import { SUPPORTS } from '@/modules/support.js';
|
import { SUPPORTS } from '@/modules/support.js';
|
||||||
import { click } from '@/modules/click.js';
|
import { click } from '@/modules/click.js';
|
||||||
import { client } from '@/modules/torrent.js';
|
import { client } from '@/modules/torrent.js';
|
||||||
|
import { settings } from '@/modules/settings.js';
|
||||||
|
import IPC from '@/modules/ipc.js';
|
||||||
|
|
||||||
export let page = 'home'
|
export let page = 'home'
|
||||||
|
|
||||||
|
|
@ -31,6 +33,8 @@
|
||||||
$: maxwidth = $isMobile ? '200px' : '60rem'
|
$: maxwidth = $isMobile ? '200px' : '60rem'
|
||||||
|
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
|
if($settings.enableAutoUpdate && SUPPORTS.update) IPC.emit('update')
|
||||||
|
|
||||||
if (SUPPORTS.isAndroid) {
|
if (SUPPORTS.isAndroid) {
|
||||||
let backButtonPressTimeout;
|
let backButtonPressTimeout;
|
||||||
window.Capacitor.Plugins.App.addListener("backButton", () => {
|
window.Capacitor.Plugins.App.addListener("backButton", () => {
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
export const SUPPORTS = {
|
export const SUPPORTS = {
|
||||||
offscreenRender: true,
|
offscreenRender: true,
|
||||||
update: false,
|
update: true,
|
||||||
angle: true,
|
angle: true,
|
||||||
doh: true,
|
doh: true,
|
||||||
dht: true,
|
dht: true,
|
||||||
|
|
|
||||||
|
|
@ -136,6 +136,7 @@ export const defaults = {
|
||||||
slowSeeding: true,
|
slowSeeding: true,
|
||||||
disableStartupVideo: true,
|
disableStartupVideo: true,
|
||||||
amoledTheme: true,
|
amoledTheme: true,
|
||||||
|
enableAutoUpdate: true,
|
||||||
torrentPersist: false,
|
torrentPersist: false,
|
||||||
torrentDHT: false,
|
torrentDHT: false,
|
||||||
torrentPeX: false,
|
torrentPeX: false,
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@
|
||||||
import { resetSettings } from '@/modules/settings.js'
|
import { resetSettings } from '@/modules/settings.js'
|
||||||
import IPC from '@/modules/ipc.js'
|
import IPC from '@/modules/ipc.js'
|
||||||
import { SUPPORTS } from '@/modules/support.js'
|
import { SUPPORTS } from '@/modules/support.js'
|
||||||
|
import SettingCard from './SettingCard.svelte';
|
||||||
|
|
||||||
async function importSettings () {
|
async function importSettings () {
|
||||||
localStorage.setItem('settings', await navigator.clipboard.readText())
|
localStorage.setItem('settings', await navigator.clipboard.readText())
|
||||||
|
|
@ -25,6 +26,10 @@
|
||||||
}
|
}
|
||||||
setInterval(checkUpdate, 1200000)
|
setInterval(checkUpdate, 1200000)
|
||||||
</script>
|
</script>
|
||||||
|
<script>
|
||||||
|
export let settings
|
||||||
|
</script>
|
||||||
|
|
||||||
<div class='d-inline-flex flex-column'>
|
<div class='d-inline-flex flex-column'>
|
||||||
<button
|
<button
|
||||||
use:click={importSettings}
|
use:click={importSettings}
|
||||||
|
|
@ -39,6 +44,12 @@
|
||||||
Export Settings To Clipboard
|
Export Settings To Clipboard
|
||||||
</button>
|
</button>
|
||||||
{#if SUPPORTS.update}
|
{#if SUPPORTS.update}
|
||||||
|
<SettingCard title='Enable auto update' description='Enables auto updater upon startup. Disable this if you have issues with it.'>
|
||||||
|
<div class='custom-switch'>
|
||||||
|
<input type='checkbox' id='enable-auto-updater' bind:checked={settings.enableAutoUpdate} />
|
||||||
|
<label for='enable-auto-updater'>{settings.enableAutoUpdate ? 'On' : 'Off'}</label>
|
||||||
|
</div>
|
||||||
|
</SettingCard>
|
||||||
<button
|
<button
|
||||||
use:click={checkUpdate}
|
use:click={checkUpdate}
|
||||||
class='btn btn-primary mx-20 mt-10'
|
class='btn btn-primary mx-20 mt-10'
|
||||||
|
|
|
||||||
|
|
@ -149,7 +149,7 @@
|
||||||
</Tab>
|
</Tab>
|
||||||
<Tab>
|
<Tab>
|
||||||
<div class='root h-full w-full overflow-y-md-auto p-20' use:smoothScroll>
|
<div class='root h-full w-full overflow-y-md-auto p-20' use:smoothScroll>
|
||||||
<AppSettings />
|
<AppSettings bind:settings={$settings} />
|
||||||
<div class='h-250' />
|
<div class='h-250' />
|
||||||
</div>
|
</div>
|
||||||
</Tab>
|
</Tab>
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ ipcMain.on('update', () => {
|
||||||
autoUpdater.checkForUpdatesAndNotify()
|
autoUpdater.checkForUpdatesAndNotify()
|
||||||
})
|
})
|
||||||
|
|
||||||
autoUpdater.checkForUpdatesAndNotify()
|
// autoUpdater.checkForUpdatesAndNotify()
|
||||||
export default class Updater {
|
export default class Updater {
|
||||||
hasUpdate = false
|
hasUpdate = false
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue