Skip to content

Commit d3f67aa

Browse files
committed
Accent colors, preparing for launch
1 parent f1367db commit d3f67aa

File tree

13 files changed

+116
-84
lines changed

13 files changed

+116
-84
lines changed

README-EN.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
[Русский](https://github.com/MegaSa1nt/GCS-Client/blob/new/README.md) | English
2+
3+
# GCS-Client
4+
### Launcher for your GDPS with updating via patches
5+
[Launcher backend](https://github.com/MegaSa1nt/GCS-Client-backend) is required for launcher to work
6+
### Stack
7+
Front:
8+
`SvelteKit`
9+
`Vite`
10+
11+
Desktop:
12+
`Tauri`
13+
14+
For running dev-build:
15+
1. `npm i`, this command will install everything required
16+
2. `npm run tauri dev`, this command will start launcher, first run will be very long
17+
18+
For building:
19+
`npm run tauri build`
20+
21+
Setup tutorial:
22+
*later*

README.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
Русский | [English](https://github.com/MegaSa1nt/GCS-Client/blob/new/README-EN.md)
2+
13
# GCS-Client
24
### Лаунчер для вашей приватки с системой обновлений посредством патчей файлов
35
Для работы обновлений необходим [бэкэнд лаунчера](https://github.com/MegaSa1nt/GCS-Client-backend)
@@ -13,7 +15,8 @@
1315
1. `npm i`, эта команда установит всё необходимое
1416
2. `npm run tauri dev`, эта команда запустит лаунчер, первый раз будет очень долгим
1517

16-
- [x] [Переписать бэкэнд загрузки на Bun + Elysia](https://github.com/MegaSa1nt/GCS-Client-backend)
17-
- [x] Доделать лаунчер технически
18-
- [ ] Доделать верстку
19-
- [ ] Выпуск первой релизной версии
18+
Для сборки:
19+
`npm run tauri build`
20+
21+
Туториал по настройке:
22+
*позже*

src/components/ProfilePost/profilePost.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
postReplies[postID] = false;
4242
document.getElementById("profilePostSpinner" + postID).classList.add(style.show);
4343
return new Promise(async function(r) {
44-
const settings = library.getSettings();
44+
const settings = await library.getSettings();
4545
fetch(settings.dashboard_api_url + "replies.php", {
4646
method: "POST",
4747
body: "commentID=" + postID,

src/components/ProfilePostReply/profilePostReply.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
3131
async function checkReplies(postID) {
3232
return new Promise(async function(r) {
33-
const settings = library.getSettings();
33+
const settings = await library.getSettings();
3434
fetch(settings.dashboard_api_url + "replies.php", {
3535
method: "POST",
3636
body: "commentID=" + postID,

src/components/ProfilePostSecond/profilePostSecond.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
postReplies[postID] = false;
4242
document.getElementById("profilePostSpinner" + postID).classList.add(style.show);
4343
return new Promise(async function(r) {
44-
const settings = library.getSettings();
44+
const settings = await library.getSettings();
4545
fetch(settings.dashboard_api_url + "replies.php", {
4646
method: "POST",
4747
body: "commentID=" + postID,

src/components/Select/select.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
--item-is-active-color="black"
1515
--item-hover-color="black"
1616
--list-background="#242424"
17-
--item-hover-bg="#3ee667"
18-
--item-is-active-bg="#3ee667"
17+
--item-hover-bg="var(--accent-color)"
18+
--item-is-active-bg="var(--accent-color)"
1919
--list-border-radius="10px"
2020
--multi-item-border-radius="10px"
2121
--font-size="15px"

src/components/SettingsSidebar/settingsSidebar.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import { page } from '$app/stores';
55
66
const colors = {
7-
"active": '#3EE667',
7+
"active": 'var(--accent-color)',
88
"none": '#C7C6CA'
99
};
1010

src/components/Sidebar/sidebar.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
library.initializeVariables();
88
99
const colors = {
10-
"active": '#3EE667',
10+
"active": 'var(--accent-color)',
1111
"none": '#C7C6CA'
1212
};
1313

src/components/Toggle/toggle.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
export let off = undefined;
1111
export let switchColor = "#000";
1212
export let untoggledSwitchColor = "#eee";
13-
export let toggledColor = "#3EE667";
13+
export let toggledColor = "var(--accent-color)";
1414
export let untoggledColor = "#5b5b5b";
1515
1616
import { createEventDispatcher } from "svelte";

src/libs/library.js

Lines changed: 34 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ library.initializeEvents = async function() {
7979
}
8080

8181
const gameCheckInterval = setInterval(async function() {
82-
const settings = library.getSettings();
82+
const settings = await library.getSettings();
8383
library.checkProcess(settings.game_exe);
8484
}, 500);
8585

@@ -96,22 +96,24 @@ library.initializeVariables = function() {
9696

9797
library.getSettings = function() {
9898
library.initializeVariables();
99-
const resourcePath = await resourceDir();
100-
return {
101-
updates_api_url: "https://updates.example.com/",
102-
dashboard_api_url: "https://example.com/dashboard/api/",
103-
gdps_name: "GDPS",
104-
game_exe: "GDPS.exe",
105-
106-
update_time: localStorage.update_time,
107-
resource_path: resourcePath
108-
}
99+
return new Promise(async function(r) {
100+
const resourcePath = await resourceDir();
101+
r({
102+
updates_api_url: "https://updates.gcs.icu/",
103+
dashboard_api_url: "https://api.gcs.icu/",
104+
gdps_name: "GreenCatsServer",
105+
game_exe: "GreenCatsServer.exe",
106+
107+
update_time: localStorage.update_time,
108+
resource_path: resourcePath
109+
});
110+
});
109111
}
110112

111113
library.checkUpdates = async function() {
112114
if(window.isCheckingUpdate) return;
113115
await library.changeIsCheckingUpdateState(true);
114-
const settings = library.getSettings();
116+
const settings = await library.getSettings();
115117
if(settings.update_time == 0) {
116118
console.log('You should install game ;)');
117119
await library.changeIsCheckingUpdateState(false);
@@ -124,7 +126,7 @@ library.checkUpdates = async function() {
124126
library.changePendingUpdateState(false);
125127
return true;
126128
} else {
127-
library.sendNotification(settings.foundUpdate.title, settings.foundUpdate.description);
129+
library.sendNotification(strings.foundUpdate.title, strings.foundUpdate.description);
128130
console.log("Updates were found!");
129131
window.new_updates = response;
130132
library.changeIsCheckingUpdateState(false);
@@ -142,7 +144,7 @@ library.installGame = async function() {
142144
if(window.isUpdatingGame) return;
143145
library.changeUpdatingGameState(true);
144146
library.changePendingUpdateState(false);
145-
const settings = library.getSettings();
147+
const settings = await library.getSettings();
146148
const lastUpdateTimestamp = await library.getLatestUpdateTimestamp();
147149
const configPath = await resolve(await appCacheDir() + "/temp.7z");
148150
console.log('Starting downloading game...');
@@ -153,7 +155,7 @@ library.installGame = async function() {
153155
if(stdout === null) {
154156
console.log('Adding all files to SQL... (that means it also calculates MD5 checksum for all files)');
155157
await library.addFolderToSQL(settings.resource_path);
156-
library.sendNotification(settings.gameInstalled.title, settings.gameInstalled.description);
158+
library.sendNotification(strings.gameInstalled.title, strings.gameInstalled.description);
157159
console.log('Game successfully downloaded!');
158160
library.changeUpdatingGameState(false);
159161
library.cleanTemporaryFiles();
@@ -181,7 +183,7 @@ library.installGame = async function() {
181183
}
182184

183185
library.cleanTemporaryFiles = async function(patchTimestamp = 0) {
184-
const settings = library.getSettings();
186+
const settings = await library.getSettings();
185187
const configPath = await appCacheDir();
186188
await remove(configPath + "/temp.7z").catch(err => {console.log("Temporary game archive was not found. Nothing to delete!");});
187189
if(patchTimestamp != 0) {
@@ -224,7 +226,7 @@ library.openOrInstallGame = async function() {
224226
if(isGameRunning) return;
225227
if(isPendingUpdate) return library.updateGame();
226228
clearInterval(gameCheckInterval);
227-
const settings = library.getSettings();
229+
const settings = await library.getSettings();
228230
await library.changeIsGameStartingState(true);
229231
await open(await join(settings.resource_path, settings.game_exe)).then(res => {
230232
library.changeIsGameStartingState(false);
@@ -240,7 +242,7 @@ library.openOrInstallGame = async function() {
240242

241243
library.updateGame = async function() {
242244
if(window.isUpdatingGame) return;
243-
const settings = library.getSettings();
245+
const settings = await library.getSettings();
244246
if(settings.update_time == 0) return library.installGame();
245247
library.changePendingUpdateState(false);
246248
library.changeUpdatingGameState(true);
@@ -249,15 +251,15 @@ library.updateGame = async function() {
249251
await library.patchGame(new_updates[i]);
250252
}
251253
const lastUpdateTimestamp = new_updates[new_updates.length - 1];
252-
library.sendNotification(settings.gameUpdated.title, settings.gameUpdated.description);
254+
library.sendNotification(strings.gameUpdated.title, strings.gameUpdated.description);
253255
console.log('Game successfully updated!');
254256
library.changeUpdatingGameState(false);
255257
library.cleanTemporaryFiles();
256258
localStorage.update_time = lastUpdateTimestamp;
257259
}
258260

259261
library.getLatestUpdateTimestamp = async function() {
260-
const settings = library.getSettings();
262+
const settings = await library.getSettings();
261263
return new Promise(r => {
262264
fetch(settings.updates_api_url + "lastUpdate").then(res => res.json()).then(response => {
263265
r(response.timestamp);
@@ -269,7 +271,7 @@ library.getLatestUpdateTimestamp = async function() {
269271
}
270272

271273
library.patchGame = async function(patchTimestamp) {
272-
const settings = library.getSettings();
274+
const settings = await library.getSettings();
273275
const patchArchivePath = await resolve(await appCacheDir() + "/patch_" + patchTimestamp + ".7z");
274276
const patchFolderPath = await resolve(await appCacheDir() + "/patch_" + patchTimestamp);
275277
console.log('Downloading patch ' + patchTimestamp + '...');
@@ -368,7 +370,7 @@ library.addFolderToSQL = async function(folder) {
368370
}
369371

370372
library.addFilesToSQL = async function(allFiles) {
371-
const settings = library.getSettings();
373+
const settings = await library.getSettings();
372374
var i = 0;
373375
for(i = 0; i < allFiles.length; i++) {
374376
const fileRelativePath = allFiles[i];
@@ -378,7 +380,7 @@ library.addFilesToSQL = async function(allFiles) {
378380
}
379381

380382
library.addGameFoldersToSQL = async function(allFolders) {
381-
const settings = library.getSettings();
383+
const settings = await library.getSettings();
382384
var i = 0;
383385
for(i = 0; i < allFolders.length; i++) {
384386
const folderRelativePath = allFolders[i];
@@ -393,7 +395,7 @@ library.removeFilesFromSQL = async function(allFiles) {
393395

394396
library.uninstallGame = async function() {
395397
if(window.isUpdatingGame) return;
396-
const settings = library.getSettings();
398+
const settings = await library.getSettings();
397399
console.log('Deleting game...');
398400
library.changeUpdatingGameState(true);
399401
const gameFiles = await db.select("SELECT file FROM files");
@@ -409,15 +411,15 @@ library.uninstallGame = async function() {
409411
await db.execute("DELETE FROM files");
410412
await db.execute("DELETE FROM folders");
411413
localStorage.update_time = 0;
412-
library.sendNotification(settings.gameDeleted.title, settings.gameDeleted.description);
414+
library.sendNotification(strings.gameDeleted.title, strings.gameDeleted.description);
413415
console.log('Game was successfully deleted! ...');
414416
library.changePendingUpdateState(true);
415417
library.changeUpdatingGameState(false);
416418
library.checkUpdates();
417419
}
418420

419421
library.removeEmptyFolders = async function() {
420-
const settings = library.getSettings();
422+
const settings = await library.getSettings();
421423
var i = game_folders.length - 1;
422424
for(i = game_folders.length - 1; i >= 0; i--) {
423425
const folderPath = game_folders[i];
@@ -440,7 +442,7 @@ library.checkProcess = async function(process) {
440442

441443
library.verifyGameFilesIntegrity = async function() {
442444
if(window.isUpdatingGame) return;
443-
const settings = library.getSettings();
445+
const settings = await library.getSettings();
444446
console.log("Verifying game files integrity...");
445447
library.changeUpdatingGameState(true);
446448
const gameFiles = await db.select("SELECT * FROM files");
@@ -468,7 +470,7 @@ library.verifyGameFilesIntegrity = async function() {
468470

469471
library.downloadSpecificFiles = async function(downloadFiles) {
470472
return new Promise(async function(r) {
471-
const settings = library.getSettings();
473+
const settings = await library.getSettings();
472474
console.log("Downloading some specific files...");
473475
const downloadArchivePath = await resolve(await appCacheDir() + "/download.7z");
474476
invoke('download_archive', { url: settings.updates_api_url + "files", tempPath: downloadArchivePath, files: JSON.stringify({ files: downloadFiles })}).then(stdout => {
@@ -494,15 +496,15 @@ library.downloadSpecificFiles = async function(downloadFiles) {
494496

495497
library.getProfile = function(accountID) {
496498
return new Promise(async function(r) {
497-
const settings = library.getSettings();
499+
const settings = await library.getSettings();
498500
fetch(settings.dashboard_api_url + "profile.php?accountID=" + accountID).then(res => res.json()).then(response => {
499501
r(response);
500502
});
501503
});
502504
}
503505

504506
library.openGameFolder = async function() {
505-
const settings = library.getSettings();
507+
const settings = await library.getSettings();
506508
open(settings.resource_path);
507509
}
508510

@@ -511,9 +513,9 @@ library.sendNotification = async function(title, body) {
511513
sendNotification({title: title.toString(), body: body.toString()});
512514
}
513515

514-
library.checkIfPlayerIsLoggedIn = function() {
516+
library.checkIfPlayerIsLoggedIn = async function() {
515517
if(!localStorage.auth.length) return false;
516-
const settings = library.getSettings();
518+
const settings = await library.getSettings();
517519
fetch(settings.dashboard_api_url + "login.php?auth=" + localStorage.auth).then(r => r.json()).then(response => {
518520
if(!response.success) {
519521
library.logout();

0 commit comments

Comments
 (0)