initial commit
This commit is contained in:
commit
d50cdd2a77
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
node_modules/
|
||||
yarn.lock
|
50
app.js
Normal file
50
app.js
Normal file
|
@ -0,0 +1,50 @@
|
|||
const { app, BrowserWindow, ipcMain, dialog } = require('electron');
|
||||
const { setupTitlebar, attachTitlebarToWindow } = require('custom-electron-titlebar/main');
|
||||
const windowManager = require('./ui/windowManager');
|
||||
|
||||
const run = () => {
|
||||
const gotTheLock = app.requestSingleInstanceLock()
|
||||
if (!gotTheLock) {
|
||||
app.quit();
|
||||
return;
|
||||
}
|
||||
setupTitlebar();
|
||||
|
||||
let mainWindow;
|
||||
app.whenReady().then(() => {
|
||||
|
||||
mainWindow = createWindow()
|
||||
app.on('activate', function () {
|
||||
if (BrowserWindow.getAllWindows().length === 0) mainWindow = createWindow();
|
||||
})
|
||||
app.on('window-all-closed', () => {
|
||||
app.quit()
|
||||
})
|
||||
ipcMain.handle('open-folder-dialog', async (event) => {
|
||||
const yes = await dialog.showOpenDialog({
|
||||
properties: ['openDirectory']
|
||||
})
|
||||
return yes.filePaths;
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
function createWindow() {
|
||||
// Create the browser window.
|
||||
const win = windowManager.createWindow(480, 320);
|
||||
|
||||
win.loadFile('./html/index.html');
|
||||
|
||||
attachTitlebarToWindow(win);
|
||||
win.webContents.on('new-window', function (e, url) {
|
||||
e.preventDefault();
|
||||
});
|
||||
win.webContents.on('did-finish-load', function () {
|
||||
if (win.webContents.getZoomFactor() != 0.9)
|
||||
win.webContents.setZoomFactor(0.9)
|
||||
});
|
||||
|
||||
return win;
|
||||
}
|
||||
|
||||
run();
|
BIN
assets/logo.png
Normal file
BIN
assets/logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 53 KiB |
23
assets/mdb.min.css
vendored
Normal file
23
assets/mdb.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
20
assets/mdb.min.js
vendored
Normal file
20
assets/mdb.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
51
html/index.html
Normal file
51
html/index.html
Normal file
|
@ -0,0 +1,51 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<title>EZPPLauncher</title>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<link href="../assets/mdb.min.css" rel="stylesheet" />
|
||||
</head>
|
||||
|
||||
<body class="fixed-sn mdb-skin-custom" data-spy="scroll" data-target="#scrollspy" data-offset="15"
|
||||
oncontextmenu="return false;">
|
||||
<main style="margin-top: 2rem;">
|
||||
<div class="noselect">
|
||||
<div class="position-relative overflow-hidden p-3 p-md-5 m-md-3 text-center text-lg-end d-flex align-items-center justify-content-center"
|
||||
style="border-radius: 0.5em;">
|
||||
<div class="position-relative overflow-hidden p-3 p-md-5 m-md-3">
|
||||
<div class="container py-2 h-100">
|
||||
<div class="row d-flex justify-content-center align-items-center h-100">
|
||||
<div class="col col-xl-10">
|
||||
<div class="card" style="border-radius: 1rem;">
|
||||
<div class="row g-0">
|
||||
<div class="card-body p-4 p-lg-5 text-black">
|
||||
<div class="d-flex align-items-center mb-3 pb-1 text-white">
|
||||
<span class="h1 fw-bold mb-0">EZPPLauncher</span>
|
||||
</div>
|
||||
<h5 class="fw-normal mb-3 pb-3 text-white text-start"
|
||||
style="letter-spacing: 1px;">
|
||||
Launch osu! with connection to the EZPPFarm server
|
||||
</h5>
|
||||
<div class="pt-1 mb-4">
|
||||
<button id="launch-btn" class="btn btn-primary btn-lg btn-block"
|
||||
type="button" style="background-color:#d6016f">Launch</button>
|
||||
</div>
|
||||
<button class="btn btn-dark btn-sm float-start" id="folder-btn">
|
||||
set osu! directory
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
</body>
|
||||
<script type="text/javascript" src="../assets/mdb.min.js"></script>
|
||||
|
||||
</html>
|
51
package.json
Normal file
51
package.json
Normal file
|
@ -0,0 +1,51 @@
|
|||
{
|
||||
"name": "ezpplauncher",
|
||||
"version": "1.0.0",
|
||||
"main": "app.js",
|
||||
"license": "MIT",
|
||||
"build": {
|
||||
"appId": "farm.ezpp.ezppfarm.launcher",
|
||||
"productName": "ezpplauncher",
|
||||
"directories": {
|
||||
"output": "release",
|
||||
"buildResources": "dist"
|
||||
},
|
||||
"asar": true,
|
||||
"win": {
|
||||
"icon": "./assets/logo.png",
|
||||
"target": [
|
||||
"portable"
|
||||
]
|
||||
},
|
||||
"nsis": {
|
||||
"runAfterFinish": true
|
||||
},
|
||||
"portable": {
|
||||
"artifactName": "EZPPLauncher.exe"
|
||||
}
|
||||
},
|
||||
"frontend": {
|
||||
"config": {
|
||||
"applicationName": "EZPPLauncher"
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"start": "electron .",
|
||||
"pack-win": "electron-builder --x64",
|
||||
"pack-win32": "electron-builder --ia32",
|
||||
"pack-winarm": "electron-builder --arm64",
|
||||
"pack-linux": "electron-builder --dir --linux --ia32 --arm64 --x64",
|
||||
"pack-mac": "electron-builder --dir --mac --ia32 --arm64 --x64",
|
||||
"dist": "electron-builder"
|
||||
},
|
||||
"devDependencies": {
|
||||
"electron": "^17.4.3",
|
||||
"electron-builder": "^23.0.3",
|
||||
"electron-packager": "^15.5.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"axios": "^0.27.2",
|
||||
"custom-electron-titlebar": "^4.1.1",
|
||||
"jquery": "^3.6.0"
|
||||
}
|
||||
}
|
22
preload/preload.js
Normal file
22
preload/preload.js
Normal file
|
@ -0,0 +1,22 @@
|
|||
const { ipcRenderer } = require('electron');
|
||||
const { Titlebar, Color } = require('custom-electron-titlebar');
|
||||
let titlebar;
|
||||
|
||||
window.addEventListener('DOMContentLoaded', () => {
|
||||
titlebar = new Titlebar({
|
||||
backgroundColor: Color.fromHex("#303030"),
|
||||
itemBackgroundColor: Color.fromHex("#121212"),
|
||||
icon: "https://ez-pp.farm/static/logos/circle.png",
|
||||
menu: null,
|
||||
maximizable: false
|
||||
});
|
||||
|
||||
titlebar.updateTitle("EZPPLauncher");
|
||||
|
||||
const $ = require('jquery');
|
||||
|
||||
$("#folder-btn").on('click', async () => {
|
||||
const folderLoc = await ipcRenderer.invoke('open-folder-dialog');
|
||||
alert(folderLoc);
|
||||
});
|
||||
})
|
40
ui/windowManager.js
Normal file
40
ui/windowManager.js
Normal file
|
@ -0,0 +1,40 @@
|
|||
const path = require("path");
|
||||
const { BrowserWindow } = require('electron');
|
||||
const { attachTitlebarToWindow } = require('custom-electron-titlebar/main');
|
||||
|
||||
module.exports = {
|
||||
createWindow: function (windowWidth, windowHeight) {
|
||||
const window = new BrowserWindow({
|
||||
width: windowWidth,
|
||||
height: windowHeight,
|
||||
minHeight: windowHeight / 1.25,
|
||||
minWidth: windowWidth / 1.25,
|
||||
frame: false,
|
||||
titleBarStyle: 'hidden',
|
||||
backgroundColor: "#121212",
|
||||
resizable: false,
|
||||
maximizable: false,
|
||||
minimizable: true,
|
||||
alwaysOnTop: false,
|
||||
webPreferences: {
|
||||
nodeIntegration: true,
|
||||
enableRemoteModule: true,
|
||||
show: false,
|
||||
zoomFactor: 0.9,
|
||||
preload: path.join(__dirname, '../preload/preload.js')
|
||||
},
|
||||
icon: './assets/logo.png'
|
||||
})
|
||||
window.hide();
|
||||
|
||||
window.webContents.once("did-finish-load", function (event, input) {
|
||||
window.show();
|
||||
});
|
||||
|
||||
window.webContents.setUserAgent("EZPPLauncher");
|
||||
attachTitlebarToWindow(window);
|
||||
window.webContents.openDevTools();
|
||||
|
||||
return window;
|
||||
},
|
||||
}
|
Loading…
Reference in New Issue
Block a user