Skip to content

Commit

Permalink
Merge branch 'hotfix/9.0.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
colin969 committed Jun 27, 2020
2 parents 069a974 + e10ed44 commit 3240ba5
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "flashpoint-launcher",
"version": "9.0.0",
"version": "9.0.1",
"description": "A desktop application used to browse, manage and play games from BlueMaxima's Flashpoint",
"main": "build/main/index.js",
"config": {
Expand Down
11 changes: 11 additions & 0 deletions src/back/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ const state: BackState = {
exePath: createErrorProxy('exePath'),
localeCode: createErrorProxy('countryCode'),
version: createErrorProxy('version'),
customVersion: undefined,
gameManager: {
platformsPath: '',
saveQueue: new EventQueue(),
Expand Down Expand Up @@ -118,6 +119,16 @@ async function onProcessMessage(message: any, sendHandle: any): Promise<void> {
state.preferences = pref;
state.config = conf;

// Check for custom version to report
const versionFilePath = content.isDev ? path.join(process.cwd(), 'version.txt') : path.join(state.config.flashpointPath, 'version.txt');
await fs.access(versionFilePath, fs.constants.F_OK)
.then(async () => {
const data = await fs.readFile(versionFilePath, 'utf8');
state.customVersion = data;
log(state, { source: 'Launcher', content: `Data Version Detected: ${state.customVersion}`});
})
.catch(() => { /** File doesn't exist */ });

// Setup DB
if (!state.connection) {
const options: ConnectionOptions = {
Expand Down
1 change: 1 addition & 0 deletions src/back/responses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ export function registerRequestCallbacks(state: BackState): void {
fileServerPort: state.fileServerPort,
log: state.log,
services: services,
customVersion: state.customVersion,
languages: state.languages,
language: state.languageContainer,
themes: state.themeFiles.map(theme => ({ entryPath: theme.entryPath, meta: theme.meta })),
Expand Down
1 change: 1 addition & 0 deletions src/back/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export type BackState = {
exePath: string;
localeCode: string;
version: string;
customVersion?: string,
gameManager: GameManagerState;
messageQueue: WebSocket.MessageEvent[];
isHandling: boolean;
Expand Down
3 changes: 3 additions & 0 deletions src/main/MainWindowPreload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ window.Shared = {

backUrl: createErrorProxy('backUrl'),

customVersion: undefined,

initialLang: createErrorProxy('initialLang'),
initialLangList: createErrorProxy('initialLangList'),
initialThemes: createErrorProxy('initialThemes'),
Expand Down Expand Up @@ -123,6 +125,7 @@ const onInit = (async () => {
window.Shared.fileServerPort = response.data.fileServerPort;
window.Shared.log.entries = response.data.log;
window.Shared.services = response.data.services;
window.Shared.customVersion = response.data.customVersion;
window.Shared.initialLang = response.data.language;
window.Shared.initialLangList = response.data.languages;
window.Shared.initialThemes = response.data.themes;
Expand Down
9 changes: 6 additions & 3 deletions src/renderer/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -620,9 +620,12 @@ export class App extends React.Component<AppProps, AppState> {
creditsLoaded={this.state.creditsDoneLoading}
miscLoaded={this.state.loaded[BackInit.EXEC]} />
{/* Title-bar (if enabled) */}
{ window.Shared.config.data.useCustomTitlebar ? (
<TitleBar title={`${APP_TITLE} (${remote.app.getVersion()})`} />
) : undefined }
{ window.Shared.config.data.useCustomTitlebar ?
window.Shared.customVersion ? (
<TitleBar title={window.Shared.customVersion} />
) : (
<TitleBar title={`${APP_TITLE} (${remote.app.getVersion()})`} />
) : undefined }
{/* "Content" */}
{ loaded ? (
<>
Expand Down
1 change: 1 addition & 0 deletions src/shared/back/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ export type GetRendererInitDataResponse = {
fileServerPort: number;
log: ILogEntry[];
services: IService[];
customVersion?: string;
languages: LangFile[];
language: LangContainer;
themes: Theme[];
Expand Down
3 changes: 3 additions & 0 deletions src/shared/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ export interface IMainWindowExternal {
/** URL of the back websocket server. */
backUrl: URL;

/** Custom version to display alongside launcher version (useful for packaged copies) */
customVersion?: string;

initialLang: LangContainer;
initialLangList: LangFile[];
initialThemes: Theme[];
Expand Down

0 comments on commit 3240ba5

Please sign in to comment.