Skip to content

Commit 1671533

Browse files
committed
patch: feat enhancement + bug fixes
1 parent 3594d4b commit 1671533

File tree

14 files changed

+53
-28
lines changed

14 files changed

+53
-28
lines changed

.github/actions/setup/action.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@ runs:
1313
node-version: 18
1414
registry-url: https://registry.npmjs.org/
1515

16-
- name: Install dependencies
17-
shell: bash
18-
run: pnpm i
19-
2016
- name: Restore Turborepo Cache
2117
uses: actions/cache@v3
2218
with:

.github/workflows/build-client.yaml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ name: Build and Release Desktop Client
33
on:
44
workflow_dispatch:
55
inputs:
6-
serverip:
7-
default: '0.0.0.0:4000'
6+
server_url:
7+
default: 'http://127.0.0.1:4000'
88
required: false
99
type: string
10-
description: 'Server IP (with port) for RCS CTF API Server'
10+
description: 'Server URL (with port) for RCS CTF API Server'
1111
release_version:
1212
default: '0.0.0-dev'
1313
required: false
@@ -53,11 +53,14 @@ jobs:
5353

5454
- name: Setup Environment
5555
uses: ./.github/actions/setup
56-
56+
5757
- name: Copy before build
5858
run: |
59-
cd packages/deployer-url
60-
node entrypoint.js ${{ github.event.inputs.serverip }}
59+
bash bootstrap.sh ${{ github.event.inputs.server_url }}
60+
61+
- name: Install dependencies
62+
shell: bash
63+
run: pnpm i
6164

6265
- name: Build
6366
run: pnpm build:client

.github/workflows/build.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,13 @@ jobs:
2424
- name: Setup Environment
2525
uses: ./.github/actions/setup
2626

27+
- name: Run before install
28+
run: |
29+
bash bootstrap.sh http://127.0.0.1:4000
30+
31+
- name: Install dependencies
32+
shell: bash
33+
run: pnpm i
34+
2735
- name: Install Dependencies
2836
run: pnpm build

apps/web/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55
"type": "module",
66
"scripts": {
77
"dev": "vite",
8+
"dev:client": "cross-env VITE_CL_MODE=client vite",
89
"build": "vite build",
9-
"build:client": "cross-env MODE=client vite build",
10+
"build:client": "cross-env VITE_CL_MODE=client vite build",
1011
"lint": "eslint . --ext js,jsx --report-unused-disable-directives --max-warnings 0",
1112
"preview": "vite preview"
1213
},

apps/web/src/libs/api.client.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import ip from "deployer-url"
1+
import customhost from "deployer-url"
22
import axios from 'axios';
33

4-
let url;
4+
export let url;
55

6-
if (import.meta.env.MODE == "client") {
7-
url = ip;
6+
if (import.meta.env.VITE_CL_MODE == "client") {
7+
url = customhost;
88
} else {
99
url = import.meta.env.VITE_API_URL;
1010
}

apps/web/src/pages/about.jsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import '../App.css'
22
import 'react-toastify/dist/ReactToastify.css';
33
import Navbar from '../components/navbar';
4+
import { url } from '../libs/api.client';
45

56
function Home() {
67
return (
@@ -16,6 +17,11 @@ function Home() {
1617
<div className="action-card">
1718
<a href="https://www.youtube.com/watch?v=9Pzj7Aj25lw">How to use the scoreboard</a>
1819
</div>
20+
21+
<h2>API URL</h2>
22+
<div className="action-card">
23+
{url}
24+
</div>
1925
</div>
2026
</>
2127
)

bootstrap.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
3+
cd packages/deployer-url || exit
4+
node entrypoint.js "$@"

packages/deployer-url/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
host.js

packages/deployer-url/config.json

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
1-
import fs from 'node:fs';
1+
/* eslint-disable unicorn/prefer-node-protocol */
2+
import fs from "fs";
23

34
const processargs = process.argv.slice(2);
4-
const ip = processargs[0];
5+
const host = processargs[0];
56

6-
fs.writeFileSync('./config.json', JSON.stringify({ ip }));
7+
let data = `
8+
let hostname = "${host}";
9+
export default hostname;
10+
`;
711

8-
console.log("Deployer URL set to " + ip + ".");
12+
fs.writeFileSync('./host.js', data);
13+
14+
console.log("Deployer URL set to " + host + ".");

0 commit comments

Comments
 (0)