Skip to content

Commit

Permalink
fix: refresh instances on migration complete
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelHillcox committed Aug 8, 2024
1 parent 4acae50 commit c3a5d28
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 20 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"productName": "FTB Electron App",
"name": "ftb-app",
"version": "1.25.17",
"version": "1.25.18",
"private": true,
"main": "background.js",
"email": "[email protected]",
Expand Down
8 changes: 7 additions & 1 deletion src/views/MainApp.vue
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ import os from 'os';
import {constants} from '@/core/constants';
import {SetAccountMethod, SetProfileMethod} from '@/core/state/core/mtAuthState';
import {StoreCredentialsAction} from '@/core/state/core/apiCredentialsState';
import {adsEnabled} from '@/utils';
import {adsEnabled, emitter} from '@/utils';
import {MineTogetherAccount} from '@/core/@types/javaApi';
import Loader from '@/components/atoms/Loader.vue';
import Onboarding from '@/components/core/dialogs/Onboarding.vue';
Expand Down Expand Up @@ -192,6 +192,12 @@ export default class MainApp extends Vue {
await this.startApp();
this.appLoaded = true;
emitter.on("ws.message", (data: any) => {
if (data?.type === "refreshInstancesRequest") {
this.loadInstances();
}
})
}
async initApp() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package net.creeperhost.creeperlauncher.api.data.other;

import net.creeperhost.creeperlauncher.api.data.BaseData;

public class RequestInstanceRefresh extends BaseData {
public RequestInstanceRefresh() {
this.type = "refreshInstancesRequest";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import net.creeperhost.creeperlauncher.Constants;
import net.creeperhost.creeperlauncher.Instances;
import net.creeperhost.creeperlauncher.api.WebSocketHandler;
import net.creeperhost.creeperlauncher.api.data.other.RequestInstanceRefresh;
import net.creeperhost.creeperlauncher.migration.Migration;
import net.creeperhost.creeperlauncher.pack.Instance;
import org.slf4j.Logger;
Expand Down Expand Up @@ -50,4 +52,9 @@ public boolean migrate() {

return true;
}

@Override
public void cleanup() {
WebSocketHandler.sendMessage(new RequestInstanceRefresh());
}
}
18 changes: 0 additions & 18 deletions vue.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
const path = require('path');
// const SentryWebpackPlugin = require('@sentry/webpack-plugin');
const {globSync} = require("glob");
const fs = require('fs');
const {execSync} = require('child_process');
Expand All @@ -9,23 +8,6 @@ const packageJson = JSON.parse(fs.readFileSync('package.json', 'utf-8'));

const webpackPlugins = [];

// if (process.env.GITHUB_REF_NAME) {
// webpackPlugins.push(
// new SentryWebpackPlugin({
// authToken: process.env.SENTRY_AUTH_TOKEN,
// org: 'creeperhost',
// project: 'ftb-app',
// release: `${packageJson.version}`,
// dist: process.env.APP_TARGET_PLATFORM ?? "unknown",
// include: process.env.TARGET_PLATFORM === 'overwolf' ? './overwolf/dist/desktop/' : './dist_electron/bundled/',
// ignore: ['node_modules', 'webpack.config.js'],
// urlPrefix: process.env.TARGET_PLATFORM === 'overwolf'
// ? `overwolf-extension://cmogmmciplgmocnhikmphehmeecmpaggknkjlbag/dist/desktop/`
// : "ftb://./"
// }),
// );
// }

// This is required, the amount of times the IDE will import this just for using the variable is insane
if (process.env.GITHUB_REF_NAME) {
console.log("Checking for bad imports")
Expand Down

0 comments on commit c3a5d28

Please sign in to comment.