Skip to content

Commit

Permalink
Pages: VERSION 変数が常に null な問題を修正
Browse files Browse the repository at this point in the history
  • Loading branch information
mei23 committed Jan 30, 2020
1 parent 96d55cc commit f69bd6b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/client/app/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const hostname = address.hostname;
export const url = address.origin;
export const apiUrl = url + '/api';
export const wsUrl = url.replace('http://', 'ws://').replace('https://', 'wss://') + '/streaming';
export const lang = localStorage.getItem('lang') || window.lang; // windowは後方互換性のため
export const lang = localStorage.getItem('lang') || (window as any).lang; // windowは後方互換性のため
export const langs = _LANGS_;
export const locale = JSON.parse(localStorage.getItem('locale'));
export const constants = _CONSTANTS_;
Expand Down
5 changes: 3 additions & 2 deletions src/misc/aiscript/evaluator.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import autobind from 'autobind-decorator';
import * as seedrandom from 'seedrandom';
import { Variable, PageVar, envVarsDef, funcDefs, Block, isFnBlock } from '.';
import { version } from '../../client/app/config';

type Fn = {
slots: string[];
Expand All @@ -16,7 +17,7 @@ export class ASEvaluator {
private envVars: Record<keyof typeof envVarsDef, any>;

private opts: {
randomSeed: string; user?: any; visitor?: any; page?: any; url?: string; version: string;
randomSeed: string; user?: any; visitor?: any; page?: any; url?: string;
};

constructor(variables: Variable[], pageVars: PageVar[], opts: ASEvaluator['opts']) {
Expand All @@ -28,7 +29,7 @@ export class ASEvaluator {

this.envVars = {
AI: 'kawaii',
VERSION: opts.version,
VERSION: version,
URL: opts.page ? `${opts.url}/@${opts.page.user.username}/pages/${opts.page.name}` : '',
LOGIN: opts.visitor != null,
NAME: opts.visitor ? opts.visitor.name || opts.visitor.username : '',
Expand Down

0 comments on commit f69bd6b

Please sign in to comment.