Skip to content

Commit

Permalink
Fix version showing
Browse files Browse the repository at this point in the history
  • Loading branch information
OmniTroid committed Jan 31, 2024
1 parent 3b45995 commit 34e7c00
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
5 changes: 5 additions & 0 deletions vite.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import path from 'path';
import dotenv from 'dotenv';
import packageJson from './package.json'

import { defineConfig } from 'vite';

// this will update the process.env with environment variables in .env file
Expand All @@ -24,4 +26,7 @@ export default defineConfig({
emptyOutDir: true,
sourcemap: true,
},
define: {
__APP_VERSION__: JSON.stringify(packageJson.version)
}
});
12 changes: 3 additions & 9 deletions webAO/master.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
import { safeTags } from './encoding';

declare global {
interface Window {
setServ: (ID: number) => void;
}
}

interface AOServer {
name: string,
description: string,
Expand All @@ -18,7 +12,8 @@ interface AOServer {
assets?: string,
}

const clientVersion = process.env.npm_package_version;
declare let __APP_VERSION__: string;
const clientVersion = __APP_VERSION__;

// const MASTERSERVER_IP = 'master.aceattorneyonline.com:27014';
const serverlist_domain = 'servers.aceattorneyonline.com';
Expand Down Expand Up @@ -66,8 +61,7 @@ export function setServ(ID: number) {
const serverDesc = safeTags(server.description);
document.getElementById('serverdescription_content').innerHTML = `<b>${onlineStr}</b><br>${serverDesc}`;
}
window.setServ = setServ;

(window as any).setServ = setServ;

// Fetches the serverlist from the masterserver
// Returns a properly typed list of servers
Expand Down

0 comments on commit 34e7c00

Please sign in to comment.