Skip to content

Commit

Permalink
chore: finalize pre-remote switch
Browse files Browse the repository at this point in the history
yes this key is long since changed.
  • Loading branch information
thewander02 authored and ChecksumDev committed Oct 9, 2024
1 parent 17322ea commit 7e9b84b
Show file tree
Hide file tree
Showing 23 changed files with 377 additions and 307 deletions.
6 changes: 3 additions & 3 deletions apps/app-frontend/src/components/ui/servers/LoaderIcon.vue
Original file line number Diff line number Diff line change
Expand Up @@ -169,12 +169,12 @@
</template>

<script setup lang="ts">
import { LoaderIcon } from "@modrinth/assets";
import { LoaderIcon } from '@modrinth/assets'
defineProps({
loader: {
type: String,
default: "",
default: '',
},
});
})
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
</template>

<script setup lang="ts">
import { PyroIcon } from "@modrinth/assets";
import { PyroIcon } from '@modrinth/assets'
</script>
12 changes: 6 additions & 6 deletions apps/app-frontend/src/components/ui/servers/PyroLoading.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@
</template>

<script setup lang="ts">
import { ref, onMounted } from "vue";
import { PyroIcon } from "@modrinth/assets";
import { ref, onMounted } from 'vue'
import { PyroIcon } from '@modrinth/assets'
const showLoading = ref(false);
const showLoading = ref(false)
onMounted(() => {
setTimeout(() => {
showLoading.value = true;
}, 5000);
});
showLoading.value = true
}, 5000)
})
</script>

<style>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@
</template>

<script setup lang="ts">
import { XIcon } from "@modrinth/assets";
import { XIcon } from '@modrinth/assets'
export type StatusState = "Installing" | "Failed";
export type StatusState = 'Installing' | 'Failed'
defineProps<{
state: StatusState;
}>();
state: StatusState
}>()
</script>
6 changes: 5 additions & 1 deletion apps/app-frontend/src/store/websocket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,11 @@ export const useWebSocketStore = defineStore('webSocket', () => {
}
}

async function sendPowerAction(auth: SessionToken, serverId: string, action: 'restart' | 'start' | 'stop' | 'kill') {
async function sendPowerAction(
auth: SessionToken,
serverId: string,
action: 'restart' | 'start' | 'stop' | 'kill',
) {
const connection = getOrCreateConnection(serverId)
const actionName = action.charAt(0).toUpperCase() + action.slice(1)
console.log(`${actionName}ing server ${serverId}`)
Expand Down
206 changes: 103 additions & 103 deletions apps/app-frontend/src/types/servers.ts
Original file line number Diff line number Diff line change
@@ -1,145 +1,145 @@
export interface Mod {
id: string;
filename: string;
id: string
filename: string
modrinth_ids: {
project_id: string;
version_id: string;
};
project_id: string
version_id: string
}
}

interface License {
id: string;
name: string;
url: string;
id: string
name: string
url: string
}

interface DonationUrl {
id: string;
platform: string;
url: string;
id: string
platform: string
url: string
}

interface GalleryItem {
url: string;
featured: boolean;
title: string;
description: string;
created: string;
ordering: number;
url: string
featured: boolean
title: string
description: string
created: string
ordering: number
}

export interface Project {
slug: string;
title: string;
description: string;
categories: string[];
client_side: "required" | "optional";
server_side: "required" | "optional";
body: string;
status: "approved" | "pending" | "rejected";
requested_status: "approved" | "pending" | "rejected";
additional_categories: string[];
issues_url: string;
source_url: string;
wiki_url: string;
discord_url: string;
donation_urls: DonationUrl[];
project_type: "mod" | "resourcepack" | "map" | "plugin";
downloads: number;
icon_url: string;
color: number;
thread_id: string;
monetization_status: "monetized" | "non-monetized";
id: string;
team: string;
body_url: string | null;
moderator_message: string | null;
published: string;
updated: string;
approved: string;
queued: string;
followers: number;
license: License;
versions: string[];
game_versions: string[];
loaders: string[];
gallery: GalleryItem[];
slug: string
title: string
description: string
categories: string[]
client_side: 'required' | 'optional'
server_side: 'required' | 'optional'
body: string
status: 'approved' | 'pending' | 'rejected'
requested_status: 'approved' | 'pending' | 'rejected'
additional_categories: string[]
issues_url: string
source_url: string
wiki_url: string
discord_url: string
donation_urls: DonationUrl[]
project_type: 'mod' | 'resourcepack' | 'map' | 'plugin'
downloads: number
icon_url: string
color: number
thread_id: string
monetization_status: 'monetized' | 'non-monetized'
id: string
team: string
body_url: string | null
moderator_message: string | null
published: string
updated: string
approved: string
queued: string
followers: number
license: License
versions: string[]
game_versions: string[]
loaders: string[]
gallery: GalleryItem[]
}

export interface Version extends Project {
project_id: string;
project_id: string
}

export interface ServerBackup {
id: string;
name: string;
created_at: string;
id: string
name: string
created_at: string
}

export interface Server {
server_id: string;
name: string;
state: string;
server_id: string
name: string
state: string
net: {
ip: string;
port: number;
domain: string;
};
modpack: string | null;
modpack_id: string | null;
project: Project | null;
backups: ServerBackup[];
game: string;
loader: string | null;
loader_version: string | null;
mc_version: string | null;
mods: Mod[];
backup_quota: number;
used_backup_quota: number;
ip: string
port: number
domain: string
}
modpack: string | null
modpack_id: string | null
project: Project | null
backups: ServerBackup[]
game: string
loader: string | null
loader_version: string | null
mc_version: string | null
mods: Mod[]
backup_quota: number
used_backup_quota: number
}

export interface WSAuth {
url: string;
token: string;
url: string
token: string
}

export type ServerState = "running" | "stopped" | "crashed";
export type ServerState = 'running' | 'stopped' | 'crashed'
export type WebsocketEventType =
| "log"
| "auth"
| "stats"
| "power-state"
| "auth-expiring"
| "auth-incorrect"
| (string & {});
| 'log'
| 'auth'
| 'stats'
| 'power-state'
| 'auth-expiring'
| 'auth-incorrect'
| (string & {})

export interface WSEvent {
event: WebsocketEventType;
message: string;
state: ServerState;
event: WebsocketEventType
message: string
state: ServerState
}

export interface Servers {
servers: Server[];
servers: Server[]
}

export interface Stats {
current: {
cpu_percent: number;
ram_usage_bytes: number;
ram_total_bytes: number;
storage_usage_bytes: number;
storage_total_bytes: number;
};
cpu_percent: number
ram_usage_bytes: number
ram_total_bytes: number
storage_usage_bytes: number
storage_total_bytes: number
}
past: {
cpu_percent: number;
ram_usage_bytes: number;
ram_total_bytes: number;
storage_usage_bytes: number;
storage_total_bytes: number;
};
cpu_percent: number
ram_usage_bytes: number
ram_total_bytes: number
storage_usage_bytes: number
storage_total_bytes: number
}
graph: {
cpu: number[];
ram: number[];
};
cpu: number[]
ram: number[]
}
}
2 changes: 2 additions & 0 deletions apps/frontend/nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -324,10 +324,12 @@ export default defineNuxtConfig({
rateLimitKey: process.env.RATE_LIMIT_IGNORE_KEY ?? globalThis.RATE_LIMIT_IGNORE_KEY,
pyroBaseUrl: process.env.PYRO_BASE_URL,
prodOverride: process.env.PROD_OVERRIDE,
masterKey: process.env.PYRO_MASTER_KEY,
public: {
apiBaseUrl: getApiUrl(),
pyroBaseUrl: process.env.PYRO_BASE_URL,
prodOverride: process.env.PROD_OVERRIDE,
masterKey: process.env.PYRO_MASTER_KEY,
siteUrl: getDomain(),
production: isProduction(),
featureFlagOverrides: getFeatureFlagOverrides(),
Expand Down
11 changes: 9 additions & 2 deletions apps/frontend/src/components/ui/servers/ServerGameLabel.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
<template>
<div v-if="game" class="flex flex-row items-center gap-2">
<GameIcon aria-hidden="true" class="size-5 text-secondary" />
<span class="text-sm font-semibold">
<NuxtLink
:to="serverId ? `/servers/manage/${serverId}/options/loader` : ''"
class="text-sm font-semibold"
:class="serverId ? 'hover:underline' : ''"
>
{{ game[0].toUpperCase() + game.slice(1) }} {{ mcVersion }}
</span>
</NuxtLink>
</div>
</template>

Expand All @@ -14,4 +18,7 @@ defineProps<{
game: string;
mcVersion: string;
}>();
const route = useNativeRoute();
const serverId = route.params.id as string;
</script>
8 changes: 5 additions & 3 deletions apps/frontend/src/components/ui/servers/ServerListing.vue
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,16 @@
:loader="loader!"
:loader-version="loader_version ?? ''"
/>
<UiServersServerModLabel v-if="showModLabel" :mods="mods || []" />
<UiServersServerSubdomainLabel
v-if="showSubdomainLabel"
:subdomain="props.net?.domain ?? ''"
/>
</div>
</div>
</NuxtLink>
</template>

<script setup lang="ts">
import { computed, ref } from "vue";
import { ChevronRightIcon } from "@modrinth/assets";
import type { StatusState } from "./ServerInstallStatusPill.vue";
import type { Project, Server } from "~/types/servers";
Expand All @@ -81,7 +83,7 @@ const status = computed(() => ({
const showGameLabel = computed(() => !!props.game);
const showLoaderLabel = computed(() => !!props.loader);
const showModLabel = computed(() => (props.mods?.length ?? 0) > 0);
const showSubdomainLabel = computed(() => !!props.net?.domain);
const { data: projectData } = await useLazyAsyncData<Project>(
`server-project-${props.server_id}`,
Expand Down
Loading

0 comments on commit 7e9b84b

Please sign in to comment.