Disable installing internal updates when installed with dpkg
This commit is contained in:
parent
840b356885
commit
fb3c2fc33b
|
@ -101,4 +101,8 @@ export default new class extends Module {
|
||||||
return this.config.versions.core;
|
return this.config.versions.core;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get disableUpdater() {
|
||||||
|
return this.config.disableUpdater;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,7 +98,7 @@ export default new class extends Module {
|
||||||
update.text = `${update.id.charAt(0).toUpperCase()}${update.id.slice(1)}`;
|
update.text = `${update.id.charAt(0).toUpperCase()}${update.id.slice(1)}`;
|
||||||
update.hint = `Current: ${update.currentVersion} | Latest: ${update.version}`;
|
update.hint = `Current: ${update.currentVersion} | Latest: ${update.version}`;
|
||||||
update.status = {
|
update.status = {
|
||||||
update: true,
|
update: !Globals.disableUpdater.includes(update.id),
|
||||||
updating: false,
|
updating: false,
|
||||||
updated: false,
|
updated: false,
|
||||||
error: null
|
error: null
|
||||||
|
@ -164,7 +164,7 @@ export default new class extends Module {
|
||||||
}
|
}
|
||||||
|
|
||||||
toggleUpdate(update) {
|
toggleUpdate(update) {
|
||||||
update.status.update = !update.status.update;
|
update.status.update = !update.status.update && !Globals.disableUpdater.includes(update.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
async startUpdate() {
|
async startUpdate() {
|
||||||
|
|
|
@ -12,7 +12,8 @@
|
||||||
<div class="bd-settingSwitch">
|
<div class="bd-settingSwitch">
|
||||||
<div class="bd-title">
|
<div class="bd-title">
|
||||||
<h3>{{item.text}}</h3>
|
<h3>{{item.text}}</h3>
|
||||||
<h3 class="bd-updaterStatus bd-err" v-if="item.status.error">Update Failed!</h3>
|
<h3 class="bd-updaterStatus" v-if="disabled">Use your package manager to install</h3>
|
||||||
|
<h3 class="bd-updaterStatus bd-err" v-else-if="item.status.error">Update Failed!</h3>
|
||||||
<h3 class="bd-updaterStatus bd-ok" v-else-if="item.status.updated">Done</h3>
|
<h3 class="bd-updaterStatus bd-ok" v-else-if="item.status.updated">Done</h3>
|
||||||
<div class="bd-spinner7" v-else-if="item.status.updating" />
|
<div class="bd-spinner7" v-else-if="item.status.updating" />
|
||||||
<h3 class="bd-updaterStatus" v-else>Unknown</h3>
|
<h3 class="bd-updaterStatus" v-else>Unknown</h3>
|
||||||
|
@ -23,6 +24,6 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
props: ['item']
|
props: ['item', 'disabled']
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -18,15 +18,14 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="bd-formDivider"></div>
|
<div class="bd-formDivider"></div>
|
||||||
<div v-for="update in bdUpdates">
|
<div v-for="update in bdUpdates">
|
||||||
<UpdaterStatus :item="update" v-if="update.status.updating" />
|
<UpdaterStatus :item="update" :disabled="isDisabled(update)" v-if="update.status.updating || isDisabled(update)" />
|
||||||
<UpdaterToggle :item="update" :toggle="() => updater.toggleUpdate(update)" v-else />
|
<UpdaterToggle :item="update" :toggle="() => updater.toggleUpdate(update)" v-else />
|
||||||
<div class="bd-formDivider"></div>
|
<div class="bd-formDivider"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="bd-formButton bd-button" @click="update">
|
|
||||||
Update
|
<FormButton @click="update" :disabled="!updatesSelected || updating">Update</FormButton>
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</SettingsWrapper>
|
</SettingsWrapper>
|
||||||
</template>
|
</template>
|
||||||
|
@ -37,6 +36,7 @@
|
||||||
import SettingsWrapper from './SettingsWrapper.vue';
|
import SettingsWrapper from './SettingsWrapper.vue';
|
||||||
import UpdaterToggle from './UpdaterToggle.vue';
|
import UpdaterToggle from './UpdaterToggle.vue';
|
||||||
import UpdaterStatus from './UpdaterStatus.vue';
|
import UpdaterStatus from './UpdaterStatus.vue';
|
||||||
|
import FormButton from '../common/FormButton.vue';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
|
@ -49,7 +49,8 @@
|
||||||
components: {
|
components: {
|
||||||
SettingsWrapper,
|
SettingsWrapper,
|
||||||
UpdaterToggle,
|
UpdaterToggle,
|
||||||
UpdaterStatus
|
UpdaterStatus,
|
||||||
|
FormButton
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
updatesAvailable() {
|
updatesAvailable() {
|
||||||
|
@ -66,11 +67,20 @@
|
||||||
},
|
},
|
||||||
bdUpdates() {
|
bdUpdates() {
|
||||||
return this.updater.bdUpdates;
|
return this.updater.bdUpdates;
|
||||||
|
},
|
||||||
|
updatesSelected() {
|
||||||
|
return this.updater.updates.bd.find(update => update.status.update);
|
||||||
|
},
|
||||||
|
updating() {
|
||||||
|
return this.updater.updates.bd.find(update => update.status.updating);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
update() {
|
update() {
|
||||||
this.updater.startUpdate();
|
this.updater.startUpdate();
|
||||||
|
},
|
||||||
|
isDisabled(update) {
|
||||||
|
return Globals.disableUpdater.includes(update.id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,10 @@ const TEST_ARGS = () => {
|
||||||
'editor': path.resolve(_basePath, 'editor', 'dist'),
|
'editor': path.resolve(_basePath, 'editor', 'dist'),
|
||||||
// tmp: path.join(_basePath, 'tmp')
|
// tmp: path.join(_basePath, 'tmp')
|
||||||
tmp: path.join(os.tmpdir(), 'betterdiscord', `${process.getuid()}`)
|
tmp: path.join(os.tmpdir(), 'betterdiscord', `${process.getuid()}`)
|
||||||
}
|
},
|
||||||
|
disableUpdater: [
|
||||||
|
'core', 'client', 'editor'
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const TEST_EDITOR = TESTS && true;
|
const TEST_EDITOR = TESTS && true;
|
||||||
|
|
|
@ -66,7 +66,8 @@ export default class Config extends Module {
|
||||||
return {
|
return {
|
||||||
version: this.version,
|
version: this.version,
|
||||||
versions: this.versions,
|
versions: this.versions,
|
||||||
paths: this.paths
|
paths: this.paths,
|
||||||
|
disableUpdater: this.disableUpdater
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,4 +75,9 @@ export default class Config extends Module {
|
||||||
compatibility() {
|
compatibility() {
|
||||||
this.args.paths = Object.entries(this.args.paths).map(([id, path]) => ({ id, path }));
|
this.args.paths = Object.entries(this.args.paths).map(([id, path]) => ({ id, path }));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get disableUpdater() {
|
||||||
|
return this.args.disableUpdater || (this.args.disableUpdater = []);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,6 +90,10 @@ export default class Updater extends Module {
|
||||||
|
|
||||||
async updateBd(update) {
|
async updateBd(update) {
|
||||||
try {
|
try {
|
||||||
|
if (this.bd.config.disableUpdater.includes(update.id)) {
|
||||||
|
throw {message: `Not installing ${update.id} as updates are disabled. Use your package manager to install updates instead.`};
|
||||||
|
}
|
||||||
|
|
||||||
console.log('[BetterDiscord:Updater] Updating', update.id);
|
console.log('[BetterDiscord:Updater] Updating', update.id);
|
||||||
await this.downloadTarGz(`https://github.com/JsSucks/BetterDiscordApp${update.remote}`, this.bd.config.getPath('base'));
|
await this.downloadTarGz(`https://github.com/JsSucks/BetterDiscordApp${update.remote}`, this.bd.config.getPath('base'));
|
||||||
this.updateFinished(update);
|
this.updateFinished(update);
|
||||||
|
@ -117,6 +121,12 @@ export default class Updater extends Module {
|
||||||
// TODO cleaner
|
// TODO cleaner
|
||||||
if (bd.length) {
|
if (bd.length) {
|
||||||
for (const update of bd) {
|
for (const update of bd) {
|
||||||
|
if (this.bd.config.disableUpdater.includes(update.id)) {
|
||||||
|
update.error = {message: `Not installing ${update.id} as updates are disabled. Use your package manager to install updates instead.`};
|
||||||
|
this.bd.sendToDiscord('updater-updateError', update);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await FileUtils.rm(`${this.bd.config.getPath(update.id)}_old`);
|
await FileUtils.rm(`${this.bd.config.getPath(update.id)}_old`);
|
||||||
// Try to rename dirs first
|
// Try to rename dirs first
|
||||||
|
|
Loading…
Reference in New Issue