SPA
This commit is contained in:
+1
-1
@@ -15,7 +15,7 @@
|
|||||||
"options": {
|
"options": {
|
||||||
"outputPath": "dist/server",
|
"outputPath": "dist/server",
|
||||||
"main": "src/backend/Launcher.ts",
|
"main": "src/backend/Launcher.ts",
|
||||||
"tsConfig": "tsconfig.server.json"
|
"tsConfig": "tsconfig.json"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Generated
+387
-5648
File diff suppressed because it is too large
Load Diff
+2
-13
@@ -4,12 +4,12 @@
|
|||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"tsc": "tsc",
|
"tsc": "tsc",
|
||||||
"launch": "node lib/src/backend/Launcher.js",
|
"launch": "node dist/server/main.js",
|
||||||
"start": "npm run build && npm run launch",
|
"start": "npm run build && npm run launch",
|
||||||
"start-backend": "npm run build-backend && npm run launch",
|
"start-backend": "npm run build-backend && npm run launch",
|
||||||
"test": "rm -rf data && npm run build-backend && mocha lib/test/backendTest.js",
|
"test": "rm -rf data && npm run build-backend && mocha lib/test/backendTest.js",
|
||||||
"build": "npm run build-backend && npm run build-frontend",
|
"build": "npm run build-backend && npm run build-frontend",
|
||||||
"build-backend": "npm run clean-backend && ng v && ng run frontcraft:server",
|
"build-backend": "npm run clean-backend && tsc",
|
||||||
"build-frontend": "npm run clean-frontend && (mkdir static || rm -rf static/*) && npm run build-dashboard",
|
"build-frontend": "npm run clean-frontend && (mkdir static || rm -rf static/*) && npm run build-dashboard",
|
||||||
"build-dashboard": "cd src/frontend && npm i && npm run build && cp -r dist/* ../../static",
|
"build-dashboard": "cd src/frontend && npm i && npm run build && cp -r dist/* ../../static",
|
||||||
"clean": "rm -rf data && npm run clean-backend && npm run clean-frontend",
|
"clean": "rm -rf data && npm run clean-backend && npm run clean-frontend",
|
||||||
@@ -25,14 +25,7 @@
|
|||||||
"author": "frontblock.me",
|
"author": "frontblock.me",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@angular-devkit/build-angular": "^0.900.5",
|
|
||||||
"@angular/compiler": "^9.0.5",
|
|
||||||
"@angular/compiler-cli": "^9.0.5",
|
|
||||||
"@angular/platform-server": "^9.0.5",
|
|
||||||
"@nguniversal/express-engine": "^9.0.1",
|
|
||||||
"@nguniversal/module-map-ngfactory-loader": "^8.2.6",
|
|
||||||
"@types/mocha": "^5.2.7",
|
"@types/mocha": "^5.2.7",
|
||||||
"angular": "^1.7.9",
|
|
||||||
"bsert": "0.0.10",
|
"bsert": "0.0.10",
|
||||||
"bsock": "^0.1.9",
|
"bsock": "^0.1.9",
|
||||||
"child-process-promise": "^2.2.1",
|
"child-process-promise": "^2.2.1",
|
||||||
@@ -64,10 +57,6 @@
|
|||||||
"xml2js": "^0.4.22"
|
"xml2js": "^0.4.22"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@angular/cli": "^9.0.5",
|
|
||||||
"@types/express": "^4.17.0",
|
|
||||||
"@types/node": "^11.13.19",
|
|
||||||
"@types/semver": "^6.0.1",
|
|
||||||
"madge": "^3.6.0",
|
"madge": "^3.6.0",
|
||||||
"mocha": "^7.0.0",
|
"mocha": "^7.0.0",
|
||||||
"terser-webpack-plugin": "^1.4.1",
|
"terser-webpack-plugin": "^1.4.1",
|
||||||
|
|||||||
+22
-17
@@ -22,9 +22,9 @@ import { Injector } from '../Injector/Injector';
|
|||||||
import { Shoutbox } from '../Components/Shoutbox/Shoutbox';
|
import { Shoutbox } from '../Components/Shoutbox/Shoutbox';
|
||||||
import { PubSub } from '../Components/PubSub/PubSub';
|
import { PubSub } from '../Components/PubSub/PubSub';
|
||||||
|
|
||||||
import { ngExpressEngine } from '@nguniversal/express-engine';
|
//import { ngExpressEngine } from '../../frontend/node_modules/@nguniversal/express-engine';
|
||||||
import { APP_BASE_HREF } from '@angular/common';
|
//import { APP_BASE_HREF } from '../../frontend/';
|
||||||
import { AppServerModule } from './app.server.module';
|
//import { AppServerModule } from './app.server.module';
|
||||||
|
|
||||||
|
|
||||||
const logger = getLogger("admin", 'debug')
|
const logger = getLogger("admin", 'debug')
|
||||||
@@ -134,13 +134,12 @@ implements TableDefinitionExporter, IAdmin {
|
|||||||
|
|
||||||
let port:number = this.config.getConfig().httpPort
|
let port:number = this.config.getConfig().httpPort
|
||||||
this.express = express()
|
this.express = express()
|
||||||
this.express.use('/', express.static('static'))
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
this.express.engine('html', ngExpressEngine({
|
this.express.engine('html', ngExpressEngine({
|
||||||
bootstrap: AppServerModule,
|
bootstrap: AppServerModule,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
this.express.set('view engine', 'html');
|
this.express.set('view engine', 'html');
|
||||||
this.express.set('views', 'static');
|
this.express.set('views', 'static');
|
||||||
|
|
||||||
@@ -148,15 +147,23 @@ implements TableDefinitionExporter, IAdmin {
|
|||||||
this.express.get('*.*', express.static('static', {
|
this.express.get('*.*', express.static('static', {
|
||||||
maxAge: '1y'
|
maxAge: '1y'
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
this.express.get("/", (request, response) => {
|
||||||
|
response.status(200)
|
||||||
|
response.sendFile('index.html');
|
||||||
|
})
|
||||||
|
|
||||||
// All regular routes use the Universal engine
|
// All regular routes use the Universal engine
|
||||||
this.express.get('*', (req, res) => {
|
this.express.get('*', (req, res) => {
|
||||||
res.render('index', { req, providers: [{ provide: APP_BASE_HREF, useValue: req.baseUrl }] });
|
res.status(301)
|
||||||
|
res.redirect('/')
|
||||||
|
//res.render('index', { req, providers: [{ provide: APP_BASE_HREF, useValue: req.baseUrl }] });
|
||||||
});
|
});
|
||||||
|
*/
|
||||||
|
/* */
|
||||||
|
// get the compiled FrontendPlugins.js
|
||||||
|
this.express.use('/', express.static('static'))
|
||||||
|
|
||||||
/**
|
|
||||||
* get the compiled FrontendPlugins.js
|
|
||||||
*/
|
|
||||||
this.express.get('/plugins/:id'+".js", async (request, response) => {
|
this.express.get('/plugins/:id'+".js", async (request, response) => {
|
||||||
const pth = Path.resolve("plugins/"+request.params.id, "FrontendPlugin.js");
|
const pth = Path.resolve("plugins/"+request.params.id, "FrontendPlugin.js");
|
||||||
const file = await fs.readFile(pth)
|
const file = await fs.readFile(pth)
|
||||||
@@ -167,17 +174,13 @@ implements TableDefinitionExporter, IAdmin {
|
|||||||
response.send(frontend)
|
response.send(frontend)
|
||||||
})
|
})
|
||||||
|
|
||||||
/**
|
// serve the index.html from the static folder
|
||||||
* serve the index.html from the static folder
|
|
||||||
*/
|
|
||||||
this.express.get("/", (request, response) => {
|
this.express.get("/", (request, response) => {
|
||||||
response.status(200)
|
response.status(200)
|
||||||
response.sendFile('index.html');
|
response.sendFile('index.html');
|
||||||
})
|
})
|
||||||
|
|
||||||
/**
|
// redirect all the other traffic to the single page app
|
||||||
* redirect all the other traffic to the single page app
|
|
||||||
*/
|
|
||||||
this.express.get("*", (request, response) => {
|
this.express.get("*", (request, response) => {
|
||||||
response.status(301)
|
response.status(301)
|
||||||
response.redirect('/')
|
response.redirect('/')
|
||||||
@@ -187,6 +190,8 @@ implements TableDefinitionExporter, IAdmin {
|
|||||||
this.httpServer.listen(port, () => {
|
this.httpServer.listen(port, () => {
|
||||||
logger.info('Admin panel listening for HTTP on *'+port)
|
logger.info('Admin panel listening for HTTP on *'+port)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
/* */
|
||||||
}
|
}
|
||||||
|
|
||||||
private stopWebserver(){
|
private stopWebserver(){
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { NgModule } from '@angular/core';
|
/*
|
||||||
import { ServerModule } from '@angular/platform-server';
|
import { NgModule } from '../../frontend/node_modules/@angular/core';
|
||||||
import { ModuleMapLoaderModule } from '@nguniversal/module-map-ngfactory-loader';
|
import { ServerModule } from '../../frontend/node_modules/@angular/platform-server';
|
||||||
|
import { ModuleMapLoaderModule } from '../../frontend/node_modules/@nguniversal/module-map-ngfactory-loader';
|
||||||
|
|
||||||
import { AppModule } from '../../frontend/src/app/app.module';
|
import { AppModule } from '../../frontend/src/app/app.module';
|
||||||
import { AppComponent } from '../../frontend/src/app/app.component';
|
import { AppComponent } from '../../frontend/src/app/app.component';
|
||||||
@@ -17,3 +18,4 @@ import { AppComponent } from '../../frontend/src/app/app.component';
|
|||||||
bootstrap: [ AppComponent ],
|
bootstrap: [ AppComponent ],
|
||||||
})
|
})
|
||||||
export class AppServerModule {}
|
export class AppServerModule {}
|
||||||
|
*/
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
import { RPCServer, Socket, RPCInterface } from "rpclibrary";
|
import { RPCServer, Socket, RPCInterface } from "rpclibrary";
|
||||||
import { Inject, Injectable } from "../../Injector/ServiceDecorator";
|
import { Inject, Injectable } from "../../Injector/ServiceDecorator";
|
||||||
import { FrontworkAdmin } from "../../Admin/Admin";
|
|
||||||
import { GuildManager } from "../Guild/GuildManager";
|
import { GuildManager } from "../Guild/GuildManager";
|
||||||
import { ItemManager } from "../Item/ItemManager";
|
import { ItemManager } from "../Item/ItemManager";
|
||||||
import { RaidManager } from "../Raid/RaidManager";
|
import { RaidManager } from "../Raid/RaidManager";
|
||||||
@@ -35,7 +34,7 @@ implements FrontworkComponent<UserManagerIfc, UserManagerFeatureIfc>, IUserManag
|
|||||||
name = "UserManager" as "UserManager"
|
name = "UserManager" as "UserManager"
|
||||||
|
|
||||||
@Inject(IAdmin)
|
@Inject(IAdmin)
|
||||||
private admin: FrontworkAdmin
|
private admin: IAdmin
|
||||||
|
|
||||||
@Inject(IGuildManager)
|
@Inject(IGuildManager)
|
||||||
private guild : GuildManager
|
private guild : GuildManager
|
||||||
@@ -50,7 +49,7 @@ implements FrontworkComponent<UserManagerIfc, UserManagerFeatureIfc>, IUserManag
|
|||||||
private character : CharacterManager
|
private character : CharacterManager
|
||||||
|
|
||||||
exporters :any[] = []
|
exporters :any[] = []
|
||||||
rankServer : Serverstate<{}, FrontcraftFeatureIfc>
|
rankServer : Serverstate<{}, FrontcraftFeatureIfc>
|
||||||
userLogins : {[username in string] : UserRecord} = {}
|
userLogins : {[username in string] : UserRecord} = {}
|
||||||
allowed: string[] = []
|
allowed: string[] = []
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import { RPCExporter } from "rpclibrary";
|
|||||||
* @returns {GenericClassDecorator<Type<any>>}
|
* @returns {GenericClassDecorator<Type<any>>}
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
export const Injectable = (_interface?: Type<any>) : GenericClassDecorator<Type<any>> => {
|
export function Injectable (_interface?: Type<any>) : GenericClassDecorator<Type<any>> {
|
||||||
return (target: Type<any>) => {
|
return (target: Type<any>) => {
|
||||||
Injector.modules.push({
|
Injector.modules.push({
|
||||||
implements: _interface,
|
implements: _interface,
|
||||||
@@ -20,10 +20,10 @@ export const Injectable = (_interface?: Type<any>) : GenericClassDecorator<Type<
|
|||||||
* @returns {GenericClassDecorator<Type<any>>}
|
* @returns {GenericClassDecorator<Type<any>>}
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
export const RootComponent = (config : {
|
export function RootComponent(config : {
|
||||||
injectable : Type<any>
|
injectable : Type<any>
|
||||||
injects : Type<RPCExporter>[]
|
injects : Type<RPCExporter>[]
|
||||||
}) : GenericClassDecorator<Type<any>> => {
|
}) : GenericClassDecorator<Type<any>>{
|
||||||
return (target: Type<any>) => {
|
return (target: Type<any>) => {
|
||||||
Injector.rootModules = config.injects
|
Injector.rootModules = config.injects
|
||||||
Injector.rootInterface = config.injectable
|
Injector.rootInterface = config.injectable
|
||||||
@@ -31,7 +31,7 @@ export const RootComponent = (config : {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const Inject = (type: any) => {
|
export function Inject(type: any) {
|
||||||
return function (_this, key) {
|
return function (_this, key) {
|
||||||
Injector.injectionQueue.push({what: type, target: _this, where:key})
|
Injector.injectionQueue.push({what: type, target: _this, where:key})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
//import { enableProdMode } from '../frontend/node_modules/@angular/core';
|
||||||
|
//enableProdMode();
|
||||||
Generated
+4554
-8042
File diff suppressed because it is too large
Load Diff
@@ -13,7 +13,7 @@
|
|||||||
"ng": "ng",
|
"ng": "ng",
|
||||||
"conventional-changelog": "conventional-changelog",
|
"conventional-changelog": "conventional-changelog",
|
||||||
"start": "ng serve",
|
"start": "ng serve",
|
||||||
"build": "ng build --aot",
|
"build": "ng build",
|
||||||
"build:prod": "npm run build -- --prod --aot",
|
"build:prod": "npm run build -- --prod --aot",
|
||||||
"test": "ng test",
|
"test": "ng test",
|
||||||
"test:coverage": "rimraf coverage && npm run test -- --code-coverage",
|
"test:coverage": "rimraf coverage && npm run test -- --code-coverage",
|
||||||
@@ -44,7 +44,7 @@
|
|||||||
"@nebular/auth": "4.4.0",
|
"@nebular/auth": "4.4.0",
|
||||||
"@nebular/eva-icons": "4.4.0",
|
"@nebular/eva-icons": "4.4.0",
|
||||||
"@nebular/security": "4.4.0",
|
"@nebular/security": "4.4.0",
|
||||||
"@nebular/theme": "4.4.0",
|
"@nebular/theme": "^4.4.0",
|
||||||
"@swimlane/ngx-charts": "^10.0.0",
|
"@swimlane/ngx-charts": "^10.0.0",
|
||||||
"angular-tree-component": "7.2.0",
|
"angular-tree-component": "7.2.0",
|
||||||
"angular2-chartjs": "0.4.1",
|
"angular2-chartjs": "0.4.1",
|
||||||
@@ -109,6 +109,6 @@
|
|||||||
"ts-node": "3.2.2",
|
"ts-node": "3.2.2",
|
||||||
"tslint": "^5.7.0",
|
"tslint": "^5.7.0",
|
||||||
"tslint-language-service": "^0.9.9",
|
"tslint-language-service": "^0.9.9",
|
||||||
"typescript": "3.4.5"
|
"typescript": "^3.5.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,8 +3,9 @@
|
|||||||
* Copyright Akveo. All Rights Reserved.
|
* Copyright Akveo. All Rights Reserved.
|
||||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||||
*/
|
*/
|
||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit, Inject, PLATFORM_ID, APP_ID } from '@angular/core';
|
||||||
import { ApiService } from './frontcraft/services/login-api';
|
import { ApiService } from './frontcraft/services/login-api';
|
||||||
|
import { isPlatformBrowser } from '@angular/common';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ngx-app',
|
selector: 'ngx-app',
|
||||||
@@ -12,11 +13,17 @@ import { ApiService } from './frontcraft/services/login-api';
|
|||||||
})
|
})
|
||||||
export class AppComponent implements OnInit {
|
export class AppComponent implements OnInit {
|
||||||
|
|
||||||
constructor(private loginSvc: ApiService) {
|
constructor(
|
||||||
|
private loginSvc: ApiService,
|
||||||
|
@Inject(PLATFORM_ID) private platformId: Object,
|
||||||
|
@Inject(APP_ID) private appId: string
|
||||||
|
) {
|
||||||
|
if(!isPlatformBrowser(platformId)){
|
||||||
|
global['window'] = {}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
window['s'] = this.loginSvc
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ export class FrontcraftRaidComponent implements OnInit, OnDestroy{
|
|||||||
tokens:{},
|
tokens:{},
|
||||||
tier: 'null'
|
tier: 'null'
|
||||||
}
|
}
|
||||||
tokens = {}
|
tokens: {[itemname in string]: (Character & SRToken & Item)[]} = {}
|
||||||
displayedtokens = {}
|
displayedtokens = {}
|
||||||
search = ""
|
search = ""
|
||||||
uuid
|
uuid
|
||||||
@@ -51,7 +51,6 @@ export class FrontcraftRaidComponent implements OnInit, OnDestroy{
|
|||||||
private dialogService : NbDialogService,
|
private dialogService : NbDialogService,
|
||||||
private toast: NbToastrService
|
private toast: NbToastrService
|
||||||
){
|
){
|
||||||
window['r'] = this
|
|
||||||
router.events.subscribe(event => {
|
router.events.subscribe(event => {
|
||||||
if (event instanceof NavigationStart) {
|
if (event instanceof NavigationStart) {
|
||||||
this.ngOnDestroy()
|
this.ngOnDestroy()
|
||||||
@@ -163,7 +162,6 @@ export class FrontcraftRaidComponent implements OnInit, OnDestroy{
|
|||||||
const raiddata = await raidManager.getRaidData(<any>{
|
const raiddata = await raidManager.getRaidData(<any>{
|
||||||
id: param
|
id: param
|
||||||
})
|
})
|
||||||
console.log(raiddata);
|
|
||||||
|
|
||||||
this.display(raiddata)
|
this.display(raiddata)
|
||||||
|
|
||||||
|
|||||||
+16
-2
@@ -2,13 +2,27 @@
|
|||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"strictPropertyInitialization": false,
|
"strictPropertyInitialization": false,
|
||||||
"noImplicitAny": false,
|
"noImplicitAny": false,
|
||||||
"target": "ESnext",
|
"target": "esNext",
|
||||||
"declaration": true,
|
"declaration": true,
|
||||||
|
"module": "commonjs",
|
||||||
|
"moduleResolution": "node",
|
||||||
"strict": true,
|
"strict": true,
|
||||||
"experimentalDecorators": true,
|
"experimentalDecorators": true,
|
||||||
"emitDecoratorMetadata": true
|
"emitDecoratorMetadata": true,
|
||||||
|
|
||||||
|
"outDir": "./lib",
|
||||||
|
//"types": ["node"],
|
||||||
|
"strictNullChecks": false
|
||||||
},
|
},
|
||||||
|
"include": ["src/backend/**/*"],
|
||||||
|
"exclude": [
|
||||||
|
"./src/frontend/**/*",
|
||||||
|
"./node_modules/**/*",
|
||||||
|
"./src/frontend/node_modules/**/*",
|
||||||
|
"./test",
|
||||||
|
],
|
||||||
"angularCompilerOptions": {
|
"angularCompilerOptions": {
|
||||||
|
"enableIvy": false,
|
||||||
"entryModule": "./src/backend/Admin/app.server.module#AppServerModule"
|
"entryModule": "./src/backend/Admin/app.server.module#AppServerModule"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
{
|
|
||||||
"extends": "./tsconfig.json",
|
|
||||||
"compilerOptions": {
|
|
||||||
"outDir": "./lib",
|
|
||||||
"module": "commonjs",
|
|
||||||
"types": ["node"]
|
|
||||||
},
|
|
||||||
"include": ["src/backend/**/*", "test/**/*"],
|
|
||||||
"exclude": ["node_modules", "**/__tests__/*"],
|
|
||||||
|
|
||||||
"angularCompilerOptions": {
|
|
||||||
"entryModule": "./src/app/app.server.module#AppServerModule"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user