Skip to content

Commit

Permalink
feat: ✨ added support for solar engine (#706)
Browse files Browse the repository at this point in the history
Co-authored-by: TBHGodPro <[email protected]>
Co-authored-by: Naibuu <[email protected]>
Co-authored-by: RadNotRed <[email protected]>
  • Loading branch information
3 people authored Dec 1, 2022
1 parent 36cfdc3 commit 42d9e9c
Show file tree
Hide file tree
Showing 58 changed files with 1,798 additions and 1,695 deletions.
6 changes: 3 additions & 3 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ If applicable, add screenshots to help explain your problem.

**Environment (please complete the following information):**
- OS: [e.g. Windows]
- Launcher version [eg. 4.0.1]
- Patcher version [eg. 1.6] (If you can't find this, leave blank)
- Solar Stats version (if applicable)
- Launcher Version [eg. 4.0.1]
- Engine Version [eg. 1.6] (If you can't find this, leave blank)
- Solar Stats Version (if applicable)

**Additional context**
Add any other context about the problem here.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ When you launch the app, you will be welcomed by a user interface similar to the

⚠️ **Please note that Solar Tweaks is not a replacement for Lunar Client. Solar Tweaks is a modification tool for Lunar Client**

Tweak and customize your game by going to the **Patcher** tab, change the launcher and JRE preferences in the **Settings** tab and launch the game using any tab you want since the big green button is always there.
Tweak and customize your game by going to the **Engine** tab, change the launcher and JRE preferences in the **Settings** tab and launch the game using any tab you want since the big green button is always there.

# Building from source 🏗️

Expand Down
1,380 changes: 703 additions & 677 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@
"discord-rpc": "^4.0.1",
"electron-settings": "^4.0.2",
"extract-zip": "^2.0.1",
"net": "^1.0.2",
"node-machine-id": "^1.1.12",
"procbridge": "^1.1.1",
"uuid": "^9.0.0",
"vuex": "^4.1.0",
"zip-local": "^0.3.5"
Expand Down
7 changes: 0 additions & 7 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,6 @@
document.getElementById('loader-icon').style.height = '150px';
document.getElementById('loader-icon').style.opacity = '1';
}, 50);
// Hide the loading screen after 1.5 seconds
/*
setTimeout(
() => document.getElementById('loader-container').remove(),
1500
);
*/
</script>
<noscript>
<strong
Expand Down
9 changes: 4 additions & 5 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ export default {
},
async mounted() {
settings.configure({
prettify: true,
});
// Setup solartweaks folder
const directories = [
[],
Expand Down Expand Up @@ -68,11 +72,6 @@ export default {
// Discord RPC
login();
},
beforeMount() {
settings.configure({
prettify: true,
});
},
};
</script>

Expand Down
File renamed without changes.
11 changes: 5 additions & 6 deletions src/assets/global.css
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,17 @@ p {
/* Panton */

@font-face {
font-family: "Panton";
font-family: 'Panton';
font-style: normal;
font-weight: 390;
src: local("Panton"),
url("./fonts/Panton-BlackCaps.woff2") format("woff");
src: local('Panton'), url('./fonts/Panton-BlackCaps.woff2') format('woff');
font-display: swap;
}

/* Minecraft */
@font-face {
font-family: "Minecraft";
src: url("./fonts/Minecraft-Regular.woff2") format("woff2");
font-family: 'Minecraft';
src: url('./fonts/Minecraft-Regular.woff2') format('woff2');
font-weight: normal;
font-style: normal;
font-display: swap;
Expand Down Expand Up @@ -73,4 +72,4 @@ body {

::-webkit-scrollbar {
display: none;
}
}
Binary file added src/assets/icons/allowCrackedAccounts.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
Binary file removed src/assets/icons/mantle.png
Binary file not shown.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
Binary file added src/assets/icons/removeProfilesCap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/icons/toggleSprintText.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
5 changes: 5 additions & 0 deletions src/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
presets: [
'@vue/cli-plugin-babel/preset'
]
}
81 changes: 79 additions & 2 deletions src/background.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
'use strict';

import { app, protocol, BrowserWindow } from 'electron';
import { app, BrowserWindow, protocol } from 'electron';
import { createServer } from 'net';
import { Server } from 'procbridge';
import { createProtocol } from 'vue-cli-plugin-electron-builder/lib';

// import installExtension, { VUEJS3_DEVTOOLS } from 'electron-devtools-installer';
const isDevelopment = app.isPackaged;
const isDevelopment = !app.isPackaged;

// Scheme must be registered before the app is ready
protocol.registerSchemesAsPrivileged([
Expand Down Expand Up @@ -53,6 +55,7 @@ app.on('activate', () => {
// On macOS it's common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open.
if (BrowserWindow.getAllWindows().length === 0) createWindow();
else BrowserWindow.getAllWindows().forEach((win) => win.show());
});

// This method will be called when Electron has finished
Expand Down Expand Up @@ -84,3 +87,77 @@ if (isDevelopment) {
});
}
}

const IPCServer = new Server('127.0.0.1', 28189, async (method, data) => {
switch (method) {
case 'open-window':
console.log('Opening Login Window');
return new Promise(async (res) => {
const window = new BrowserWindow({
width: data.width,
height: data.height,
autoHideMenuBar: true,
show: false,
resizable: false,
title: 'Loading...',
fullscreenable: false,
});
let finalURL = null;
window.webContents.addListener('will-redirect', (event, url) => {
if (url.startsWith(data.targetUrlPrefix)) {
finalURL = url;
window.close();
}
});
window.on('close', () => {
window.removeAllListeners();
res(
finalURL === null
? { status: 'CLOSED_WITH_NO_URL' }
: { status: 'MATCHED_TARGET_URL', url: finalURL }
);
});
window.webContents.session.clearCache();
window.webContents.session.clearStorageData();
window.loadURL(data.url);
window.on('show', () => {
window.setAlwaysOnTop(true);
window.setAlwaysOnTop(false);
});
window.once('ready-to-show', () => {
console.log('Showing Login Window');
window.show();
});
});
default:
console.error('Unknown IPC Method:', method);
break;
}
});

function isPortAvailable(port) {
return new Promise((res) => {
const server = createServer()
.addListener('error', () => res(false))
.addListener('listening', () => {
server.addListener('close', () => res(true));
server.close();
})
.listen(port, '127.0.0.1');
});
}
async function startIPCServer() {
const available = await isPortAvailable(28189);
if (available) {
console.log('Starting IPC Server');
IPCServer.start();
console.log('Started IPC Server');
} else {
console.warn(
'Failed to start IPC Server: Port not avilable. Will try again in 30 seconds.'
);
setTimeout(() => startIPCServer(), 3e4);
}
}

startIPCServer();
13 changes: 8 additions & 5 deletions src/components/Content.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,31 +11,34 @@
import Play from './Content/Play.vue';
import Home from './Content/Home.vue';
import Servers from './Content/Servers.vue';
import Patcher from './Content/Patcher.vue';
import Engine from './Content/Engine.vue';
import Settings from './Content/Settings.vue';
import About from './Content/About.vue';
import Debug from './Content/Debug.vue';
import SentryNotification from './SentryNotification';
import { verifyEngine } from '../javascript/engine';
export default {
name: 'Content',
components: {
Play,
Home,
Servers,
Patcher,
Engine,
Settings,
About,
Debug,
SentryNotification,
},
mounted: () => {
async mounted() {
await verifyEngine();
setTimeout(
() => document.getElementById('loader-container').remove(),
// Give it an extra 50ms to load children
Date.now() - document.created < 750
? 750 - (Date.now() - document.created)
: 0
? 800 - (Date.now() - document.created)
: 50
);
},
};
Expand Down
6 changes: 4 additions & 2 deletions src/components/Content/About.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
Solar Tweaks is a modification tool for Lunar Client. By modifying
the game's code when it gets loaded, we add a variety of features
that enhance your Minecraft experience. Browse and configure our
Modules to your own needs under the Patcher tab, launch with a
Modules to your own needs under the Engine tab, launch with a
single click, and enjoy a new fully improved Lunar Client.
<br />
We are not affiliated with "Mojang, AB" or "Moonsworth, LLC". We are
Expand Down Expand Up @@ -78,7 +78,9 @@
>
<button
class="button"
:class="SentryEnabled ? 'button-red' : ''"
v-bind:class="{
'button-red': SentryEnabled,
}"
@click="toggleSentry()"
>
{{ SentryEnabled ? 'DISABLE' : 'ENABLE' }} LOGGING
Expand Down
Loading

0 comments on commit 42d9e9c

Please sign in to comment.