Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add Torii local launcher #2663

Open
wants to merge 4 commits into
base: next
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file removed .DS_Store
Binary file not shown.
4 changes: 2 additions & 2 deletions client/apps/game/src/ui/modules/loading-screen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,14 @@ export const LoadingScreen = ({ backgroundImage }: { backgroundImage: string })
};

export function CountdownTimer({ backgroundImage }: { backgroundImage: string }) {
const { seasonStart, countdown, currentBlockTimestamp } = useSeasonStart();
const { seasonStart, countdown, nextBlockTimestamp } = useSeasonStart();

const days = Math.floor(Number(countdown) / (3600 * 24));
const hours = Math.floor((Number(countdown) % (3600 * 24)) / 3600);
const minutes = Math.floor((Number(countdown) % 3600) / 60);
const seconds = Number(countdown) % 60;

if (countdown < 0 || currentBlockTimestamp === 0n || seasonStart === 0n) return null;
if (countdown < 0 || nextBlockTimestamp === 0n || seasonStart === 0n) return null;

return (
<div className="relative min-h-screen w-full pointer-events-auto">
Expand Down
16 changes: 16 additions & 0 deletions client/apps/torii-launcher/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"env": {
"browser": true,
"es6": true,
"node": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:import/recommended",
"plugin:import/electron",
"plugin:import/typescript"
],
"parser": "@typescript-eslint/parser"
}
94 changes: 94 additions & 0 deletions client/apps/torii-launcher/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock
.DS_Store

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache

# next.js build output
.next

# nuxt.js build output
.nuxt

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# Webpack
.webpack/

# Vite
.vite/

# Electron-Forge
out/

**/torii/settings.json
Empty file.
93 changes: 93 additions & 0 deletions client/apps/torii-launcher/forge.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
import { MakerDeb } from "@electron-forge/maker-deb";
import { MakerRpm } from "@electron-forge/maker-rpm";
import { MakerSquirrel } from "@electron-forge/maker-squirrel";
import { FusesPlugin } from "@electron-forge/plugin-fuses";
import { VitePlugin } from "@electron-forge/plugin-vite";
import type { ForgeConfig } from "@electron-forge/shared-types";
import { FuseV1Options, FuseVersion } from "@electron/fuses";

const config: ForgeConfig = {
packagerConfig: {
asar: false,
icon: "public/icon",
},
rebuildConfig: {},
publishers: [
{
name: '@electron-forge/publisher-s3',
config: {
bucket: 'eternum-torii-updates',
public: true
}
},
],
makers: [
new MakerSquirrel({}),
{
name: '@electron-forge/maker-zip',
config: (arch:string) => ({
// Note that we must provide this S3 URL here
// in order to support smooth version transitions
// especially when using a CDN to front your updates
macUpdateManifestBaseUrl: `http://s3.us-east-1.amazonaws.com/eternum-torii-updates/darwin/${arch}`
})
},
{
name: '@electron-forge/maker-zip',
config: (arch: string) => ({
// Note that we must provide this S3 URL here
// in order to support smooth version transitions
// especially when using a CDN to front your updates
macUpdateManifestBaseUrl: `http://s3.us-east-1.amazonaws.com/eternum-torii-updates/darwin/${arch}`
})
},
Comment on lines +26 to +43
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Remove duplicate maker-zip configuration

There are two identical maker-zip configurations with the same S3 URL pattern.

Remove one of the duplicate configurations and consider extracting the S3 URL to a constant:

+const S3_BASE_URL = 'http://s3.us-east-1.amazonaws.com/eternum-torii-updates';
+
 makers: [
   new MakerSquirrel({}),
   {
     name: '@electron-forge/maker-zip',
     config: (arch:string) => ({
-      macUpdateManifestBaseUrl: `http://s3.us-east-1.amazonaws.com/eternum-torii-updates/darwin/${arch}`
+      macUpdateManifestBaseUrl: `${S3_BASE_URL}/darwin/${arch}`
     })
   },
-  {
-    name: '@electron-forge/maker-zip',
-    config: (arch: string) => ({
-      macUpdateManifestBaseUrl: `http://s3.us-east-1.amazonaws.com/eternum-torii-updates/darwin/${arch}`
-    })
-  },
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
{
name: '@electron-forge/maker-zip',
config: (arch:string) => ({
// Note that we must provide this S3 URL here
// in order to support smooth version transitions
// especially when using a CDN to front your updates
macUpdateManifestBaseUrl: `http://s3.us-east-1.amazonaws.com/eternum-torii-updates/darwin/${arch}`
})
},
{
name: '@electron-forge/maker-zip',
config: (arch: string) => ({
// Note that we must provide this S3 URL here
// in order to support smooth version transitions
// especially when using a CDN to front your updates
macUpdateManifestBaseUrl: `http://s3.us-east-1.amazonaws.com/eternum-torii-updates/darwin/${arch}`
})
},
const S3_BASE_URL = 'http://s3.us-east-1.amazonaws.com/eternum-torii-updates';
{
name: '@electron-forge/maker-zip',
config: (arch:string) => ({
// Note that we must provide this S3 URL here
// in order to support smooth version transitions
// especially when using a CDN to front your updates
macUpdateManifestBaseUrl: `${S3_BASE_URL}/darwin/${arch}`
})
},


new MakerRpm({}),
new MakerDeb({}),
{
name: "@electron-forge/maker-dmg",
config: {
background: "./public/icon.png",
format: "ULFO",
icon: "./public/icon.png",
name: "Eternum Launcher",
},
},
],
plugins: [
new VitePlugin({
build: [
{
// `entry` is just an alias for `build.lib.entry` in the corresponding file of `config`.
entry: "src/main.ts",
config: "vite.main.config.ts",
target: "main",
},
{
entry: "src/preload.ts",
config: "vite.preload.config.ts",
target: "preload",
},
],
renderer: [
{
name: "main_window",
config: "vite.renderer.config.ts",
},
],
}),
// Fuses are used to enable/disable various Electron functionality
// at package time, before code signing the application
new FusesPlugin({
version: FuseVersion.V1,
[FuseV1Options.RunAsNode]: false,
[FuseV1Options.EnableCookieEncryption]: true,
[FuseV1Options.EnableNodeOptionsEnvironmentVariable]: false,
[FuseV1Options.EnableNodeCliInspectArguments]: false,
[FuseV1Options.EnableEmbeddedAsarIntegrityValidation]: true,
[FuseV1Options.OnlyLoadAppFromAsar]: false,
}),
],
};

export default config;
1 change: 1 addition & 0 deletions client/apps/torii-launcher/forge.env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/// <reference types="@electron-forge/plugin-vite/forge-vite-env" />
19 changes: 19 additions & 0 deletions client/apps/torii-launcher/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!doctype html>
<html>
<head>
<meta charset="UTF-8" />
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&family=Space+Grotesk:[email protected]&display=swap"
rel="stylesheet"
/>

<title>Eternum Torii Launcher</title>
</head>
<body
>
<div style="-webkit-app-region: drag"></div>
<script type="module" src="/src/renderer.tsx"></script>
</body>
</html>
Loading
Loading