Skip to content

Commit ca58113

Browse files
authored
Merge pull request #2525 from planetarium/release/2.7.8
Release/2.7.8 to dev
2 parents 17dae2e + 46799ff commit ca58113

File tree

9 files changed

+90
-15
lines changed

9 files changed

+90
-15
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ jobs:
8282
rm -fR ./dist/mac
8383
rm -fR ./dist/mac-arm64
8484
85-
- uses: actions/upload-artifact@v3.1.2
85+
- uses: actions/upload-artifact@v4
8686
with:
8787
path: dist
8888
name: Dist-${{ matrix.packCmd }}

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ jobs:
151151
ESIGNER_PASSWORD: ${{ secrets.ESIGNER_PASSWORD }}
152152
ESIGNER_TOTP_SECRET: ${{ secrets.ESIGNER_TOTP_SECRET }}
153153

154-
- uses: actions/upload-artifact@v3.1.2
154+
- uses: actions/upload-artifact@v4
155155
with:
156156
path: dist
157157
name: Dist-${{ matrix.packCmd }}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "NineChronicles",
33
"productName": "Nine Chronicles",
4-
"version": "2.7.7",
4+
"version": "2.7.8",
55
"description": "Game Launcher for Nine Chronicles",
66
"author": "Planetarium <engineering@planetariumhq.com>",
77
"license": "GPL-3.0",

src/interfaces/registry.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export type RpcEndpoints = {
1111
"world-boss.rest"?: string[];
1212
"patrol-reward.gql"?: string[];
1313
"guild.rest"?: string[];
14-
"arena.gql"?: string[];
14+
"arena.rest"?: string[];
1515
};
1616

1717
export type Planet = {

src/main/main.ts

Lines changed: 65 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ let gameNode: ChildProcessWithoutNullStreams | null = null;
6767
const client = new NTPClient("time.google.com", 123, { timeout: 5000 });
6868

6969
let registry: Planet[];
70+
let accessiblePlanets: Planet[];
7071
let remoteNode: NodeInfo;
7172
let geoBlock: { ip: string; country: string; isWhitelist?: boolean };
7273

@@ -176,14 +177,16 @@ async function initializeConfig() {
176177
if (!Array.isArray(registry) || registry.length <= 0) {
177178
throw Error("Registry is empty or invalid. No planets found.");
178179
}
180+
accessiblePlanets = await filterAccessiblePlanets(registry);
181+
179182
const planet =
180-
registry.find((v) => v.id === remoteConfig.Planet) ??
183+
accessiblePlanets.find((v) => v.id === remoteConfig.Planet) ??
181184
(() => {
182185
console.log(
183186
"No matching PlanetID found in registry. Using the first planet.",
184187
);
185-
remoteConfig.Planet = registry[0].id;
186-
return registry[0];
188+
remoteConfig.Planet = accessiblePlanets[0].id;
189+
return accessiblePlanets[0];
187190
})();
188191

189192
remoteNode = await initializeNode(planet.rpcEndpoints, true);
@@ -348,6 +351,29 @@ function initializeIpc() {
348351
}
349352
});
350353

354+
ipcMain.on("get-aws-sink-cloudwatch-guid", async (event) => {
355+
const localAppData = process.env.localappdata;
356+
if (process.platform === "win32" && localAppData !== undefined) {
357+
const guidPath = path.join(
358+
localAppData,
359+
"planetarium",
360+
".aws_sink_cloudwatch_guid",
361+
);
362+
363+
if (fs.existsSync(guidPath)) {
364+
event.returnValue = await fs.promises.readFile(guidPath, {
365+
encoding: "utf-8",
366+
});
367+
} else {
368+
event.returnValue = null;
369+
}
370+
371+
return;
372+
}
373+
374+
event.returnValue = "Not supported platform.";
375+
});
376+
351377
ipcMain.on("online-status-changed", (event, status: "online" | "offline") => {
352378
console.log(`online-status-changed: ${status}`);
353379
if (status === "offline") {
@@ -358,10 +384,10 @@ function initializeIpc() {
358384
ipcMain.handle("get-planetary-info", async () => {
359385
// Synchronously wait until registry / remote node initialized
360386
// This should return, otherwise entry point of renderer will stuck in white screen.
361-
while (!registry || !remoteNode) {
387+
while (!registry || !remoteNode || !accessiblePlanets) {
362388
await utils.sleep(100);
363389
}
364-
return [registry, remoteNode];
390+
return [registry, remoteNode, accessiblePlanets];
365391
});
366392

367393
ipcMain.handle("check-geoblock", async () => {
@@ -557,3 +583,37 @@ async function initGeoBlocking() {
557583
});
558584
}
559585
}
586+
587+
async function filterAccessiblePlanets(planets: Planet[]): Promise<Planet[]> {
588+
const accessiblePlanets: Planet[] = [];
589+
590+
for (const planet of planets) {
591+
const endpoints = Object.values(planet.rpcEndpoints["headless.gql"]).flat();
592+
// GraphQL 쿼리 정의
593+
const query = `
594+
query {
595+
nodeStatus {
596+
bootstrapEnded
597+
}
598+
}
599+
`;
600+
// 모든 endpoint에 대해 병렬로 요청을 보냅니다.
601+
const requests = endpoints.map((endpoint) =>
602+
axios.post(endpoint, { query }).then(
603+
(response) => response.status === 200,
604+
() => false, // 요청 실패 시 false 반환
605+
),
606+
);
607+
608+
try {
609+
const results = await Promise.all(requests);
610+
if (results.some((isAccessible) => isAccessible)) {
611+
accessiblePlanets.push(planet);
612+
}
613+
} catch (error) {
614+
console.error(`Error checking endpoints for planet ${planet.id}:`, error);
615+
}
616+
}
617+
618+
return accessiblePlanets;
619+
}

src/renderer/App.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ function App() {
3030
useEffect(() => {
3131
ipcRenderer
3232
.invoke("get-planetary-info")
33-
.then((info: [Planet[], NodeInfo]) => {
34-
planetary.init(info[0], info[1]);
33+
.then((info: [Planet[], NodeInfo, Planet[]]) => {
34+
planetary.init(info[0], info[1], info[2]);
3535
});
3636
ipcRenderer
3737
.invoke("check-geoblock")

src/renderer/views/LoginView/index.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,13 @@ function LoginView() {
102102
label="Planet"
103103
>
104104
{planetary.registry.map((entry) => (
105-
<SelectOption key={entry.id} value={entry.id}>
105+
<SelectOption
106+
key={entry.id}
107+
value={entry.id}
108+
disabled={
109+
!planetary.accessiblePlanets.some((p) => p.id === entry.id)
110+
}
111+
>
106112
{entry.name}
107113
</SelectOption>
108114
))}

src/renderer/views/RegisterView/GetPatronView.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,13 @@ function GetPatronView() {
7171
label="Planet"
7272
>
7373
{planetary.registry.map((entry) => (
74-
<SelectOption key={entry.id} value={entry.id}>
74+
<SelectOption
75+
key={entry.id}
76+
value={entry.id}
77+
disabled={
78+
!planetary.accessiblePlanets.some((p) => p.id === entry.id)
79+
}
80+
>
7581
{entry.name}
7682
</SelectOption>
7783
))}

src/stores/planetary.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ export default class PlanetaryStore {
1313
}
1414

1515
@action
16-
public init(registry: Planet[], node: NodeInfo) {
16+
public init(registry: Planet[], node: NodeInfo, accessiblePlanets: Planet[]) {
1717
this.registry = registry;
18+
this.accessiblePlanets = accessiblePlanets;
1819
this.setPlanet(get("Planet", "0x000000000000"));
1920
this.setNode(node);
2021
}
@@ -25,6 +26,8 @@ export default class PlanetaryStore {
2526
registry!: Planet[];
2627
@observable
2728
planet!: Planet;
29+
@observable
30+
accessiblePlanets!: Planet[];
2831

2932
@action
3033
public setRegistry(registry: Planet[]) {
@@ -67,7 +70,7 @@ export default class PlanetaryStore {
6770
const planet = this.getPlanetById(planetID);
6871
if (planet === undefined) {
6972
console.error("No matching planet ID found, Using Default.");
70-
this.planet = this.registry[0];
73+
this.planet = this.accessiblePlanets[0];
7174
} else this.planet = planet;
7275
this.updateConfigToPlanet();
7376
}

0 commit comments

Comments
 (0)