Skip to content

Commit fa8c028

Browse files
committed
feature: show cs build info on game node server
1 parent f932906 commit fa8c028

File tree

3 files changed

+43
-0
lines changed

3 files changed

+43
-0
lines changed

components/game-server-nodes/GameServerNodeRow.vue

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ import { Trash2, RefreshCw } from "lucide-vue-next";
3535
<TableCell>
3636
<template v-if="gameServerNode.build_id">
3737
{{ gameServerNode.build_id }}
38+
<template v-if="gameServerNode.build_id != csVersion">
39+
<Button variant="destructive" size="sm" @click="updateCs"
40+
>Update CS</Button
41+
>
42+
</template>
3843
</template>
3944
<template
4045
v-else-if="
@@ -229,6 +234,11 @@ export default {
229234
},
230235
},
231236
},
237+
computed: {
238+
csVersion() {
239+
return useApplicationSettingsStore().csBuildInfo?.buildid;
240+
},
241+
},
232242
methods: {
233243
async updateCs() {
234244
await this.$apollo.mutate({

pages/game-server-nodes/index.vue

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,18 @@ import { Info } from "lucide-vue-next";
6767
</template>
6868
</PageHeading>
6969

70+
<Alert class="flex items-center gap-4">
71+
<div class="flex items-center gap-2">
72+
<Info class="h-4 w-4" />
73+
<AlertTitle class="m-0">CS2 Version Information:</AlertTitle>
74+
</div>
75+
<AlertDescription class="m-0 flex items-center gap-2">
76+
<span>Build ID: {{ csVersion }}</span>
77+
<span class="text-muted-foreground">•</span>
78+
<span>Last Updated: {{ csVersionLastUpdated?.toLocaleString() }}</span>
79+
</AlertDescription>
80+
</Alert>
81+
7082
<Card class="p-4">
7183
<Table>
7284
<TableHeader>
@@ -175,6 +187,14 @@ export default {
175187
supportsGameServerNodes() {
176188
return useApplicationSettingsStore().supportsGameServerNodes;
177189
},
190+
csVersion() {
191+
return useApplicationSettingsStore().csBuildInfo?.buildid;
192+
},
193+
csVersionLastUpdated() {
194+
return new Date(
195+
useApplicationSettingsStore().csBuildInfo?.timeupdated * 1000,
196+
);
197+
},
178198
},
179199
};
180200
</script>

stores/ApplicationSettings.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,18 @@ export const useApplicationSettingsStore = defineStore(
130130

131131
subscribeToAvailableRegions();
132132

133+
const csBuildInfo = computed(() => {
134+
const version = settings.value.find(({ name }) => {
135+
return name === "cs_version";
136+
})?.value;
137+
138+
if (!version) {
139+
return;
140+
}
141+
142+
return JSON.parse(version);
143+
});
144+
133145
return {
134146
settings,
135147
availableRegions,
@@ -139,6 +151,7 @@ export const useApplicationSettingsStore = defineStore(
139151
supportsDiscordBot,
140152
supportsGameServerNodes,
141153
playerNameRegistration,
154+
csBuildInfo,
142155
};
143156
},
144157
);

0 commit comments

Comments
 (0)