mirror of
https://github.com/dkmstr/openuds-gui.git
synced 2024-12-22 17:33:48 +03:00
advancing
This commit is contained in:
parent
e31a248484
commit
9872eccad7
@ -5,7 +5,7 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"ng": "ng",
|
"ng": "ng",
|
||||||
"start": "ng serve --host 0.0.0.0 --port 9000 --proxy-config proxy.conf.json",
|
"start": "ng serve --host 0.0.0.0 --port 9000 --proxy-config proxy.conf.json",
|
||||||
"build": "ng build --prod --output-hashing=none --aot --deleteOutputPath --build-optimizer --deploy-url /static/modern/ --base-href /modern",
|
"build": "ng build --prod --output-hashing=none --aot --deleteOutputPath --build-optimizer --deploy-url /uds/res/modern/ --base-href /uds/page",
|
||||||
"postbuild": "python3 toUDS.py",
|
"postbuild": "python3 toUDS.py",
|
||||||
"test": "ng test",
|
"test": "ng test",
|
||||||
"lint": "ng lint",
|
"lint": "ng lint",
|
||||||
|
@ -1,95 +1,5 @@
|
|||||||
{
|
{
|
||||||
"/js": {
|
"/uds": {
|
||||||
"target": {
|
|
||||||
"host": "172.27.0.1",
|
|
||||||
"protocol": "http:",
|
|
||||||
"port": 8000
|
|
||||||
},
|
|
||||||
"secure": false,
|
|
||||||
"changeOrigin": true,
|
|
||||||
"logLevel": "info"
|
|
||||||
},
|
|
||||||
"/modern/services/": {
|
|
||||||
"target": {
|
|
||||||
"host": "172.27.0.1",
|
|
||||||
"protocol": "http:",
|
|
||||||
"port": 8000
|
|
||||||
},
|
|
||||||
"secure": false,
|
|
||||||
"changeOrigin": true,
|
|
||||||
"logLevel": "info"
|
|
||||||
},
|
|
||||||
"/enable": {
|
|
||||||
"target": {
|
|
||||||
"host": "172.27.0.1",
|
|
||||||
"protocol": "http:",
|
|
||||||
"port": 8000
|
|
||||||
},
|
|
||||||
"secure": false,
|
|
||||||
"changeOrigin": true,
|
|
||||||
"logLevel": "info"
|
|
||||||
},
|
|
||||||
"/galimg": {
|
|
||||||
"target": {
|
|
||||||
"host": "172.27.0.1",
|
|
||||||
"protocol": "http:",
|
|
||||||
"port": 8000
|
|
||||||
},
|
|
||||||
"secure": false,
|
|
||||||
"changeOrigin": true,
|
|
||||||
"logLevel": "info"
|
|
||||||
},
|
|
||||||
"/transicon": {
|
|
||||||
"target": {
|
|
||||||
"host": "172.27.0.1",
|
|
||||||
"protocol": "http:",
|
|
||||||
"port": 8000
|
|
||||||
},
|
|
||||||
"secure": false,
|
|
||||||
"changeOrigin": true,
|
|
||||||
"logLevel": "info"
|
|
||||||
},
|
|
||||||
"/static/img": {
|
|
||||||
"target": {
|
|
||||||
"host": "172.27.0.1",
|
|
||||||
"protocol": "http:",
|
|
||||||
"port": 8000
|
|
||||||
},
|
|
||||||
"secure": false,
|
|
||||||
"changeOrigin": true,
|
|
||||||
"logLevel": "info"
|
|
||||||
},
|
|
||||||
"/i18n": {
|
|
||||||
"target": {
|
|
||||||
"host": "172.27.0.1",
|
|
||||||
"protocol": "http:",
|
|
||||||
"port": 8000
|
|
||||||
},
|
|
||||||
"secure": false,
|
|
||||||
"changeOrigin": true,
|
|
||||||
"logLevel": "info"
|
|
||||||
},
|
|
||||||
"/modern/login/": {
|
|
||||||
"target": {
|
|
||||||
"host": "172.27.0.1",
|
|
||||||
"protocol": "http:",
|
|
||||||
"port": 8000
|
|
||||||
},
|
|
||||||
"secure": false,
|
|
||||||
"changeOrigin": true,
|
|
||||||
"logLevel": "info"
|
|
||||||
},
|
|
||||||
"/modern/logout": {
|
|
||||||
"target": {
|
|
||||||
"host": "172.27.0.1",
|
|
||||||
"protocol": "http:",
|
|
||||||
"port": 8000
|
|
||||||
},
|
|
||||||
"secure": false,
|
|
||||||
"changeOrigin": true,
|
|
||||||
"logLevel": "info"
|
|
||||||
},
|
|
||||||
"/customAuth": {
|
|
||||||
"target": {
|
"target": {
|
||||||
"host": "172.27.0.1",
|
"host": "172.27.0.1",
|
||||||
"protocol": "http:",
|
"protocol": "http:",
|
||||||
|
@ -40,13 +40,12 @@ export class ServiceComponent implements OnInit {
|
|||||||
klass.push('maintenance');
|
klass.push('maintenance');
|
||||||
} else if (this.service.not_accesible) {
|
} else if (this.service.not_accesible) {
|
||||||
klass.push('forbidden');
|
klass.push('forbidden');
|
||||||
}
|
}
|
||||||
|
|
||||||
return klass;
|
return klass;
|
||||||
}
|
}
|
||||||
|
|
||||||
getTransportIcon(transId: string) {
|
getTransportIcon(transId: string) {
|
||||||
return this.api.transportIcon(transId);
|
return this.api.transportIconURL(transId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -13,7 +13,8 @@
|
|||||||
<mat-menu #userMenu="matMenu">
|
<mat-menu #userMenu="matMenu">
|
||||||
<button mat-menu-item *ngIf="api.user.isStaff" (click)="admin()"><i class="material-icons">dashboard</i><uds-translate>Dashboard</uds-translate></button>
|
<button mat-menu-item *ngIf="api.user.isStaff" (click)="admin()"><i class="material-icons">dashboard</i><uds-translate>Dashboard</uds-translate></button>
|
||||||
<button mat-menu-item routerLink="/"><i class="material-icons">settings</i><uds-translate>Preferences</uds-translate></button>
|
<button mat-menu-item routerLink="/"><i class="material-icons">settings</i><uds-translate>Preferences</uds-translate></button>
|
||||||
<button mat-menu-item routerLink="/downloads"><i class="material-icons">file_download</i><uds-translate>Downloads</uds-translate></button>
|
<button mat-menu-item routerLink="/downloads"><i class="material-icons">file_download</i><uds-translate>Downloads</uds-translate></button>
|
||||||
|
<button mat-menu-item (click)='logout()'><i class="material-icons" style="color: red">exit_to_app</i><uds-translate>Logout</uds-translate></button>
|
||||||
</mat-menu>
|
</mat-menu>
|
||||||
|
|
||||||
<!-- shriked menu -->
|
<!-- shriked menu -->
|
||||||
|
@ -38,7 +38,11 @@ export class NavbarComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
admin() {
|
admin() {
|
||||||
window.location.href = this.api.config.urls.admin;
|
this.api.gotoAdmin();
|
||||||
|
}
|
||||||
|
|
||||||
|
logout() {
|
||||||
|
this.api.logout();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
<div class="plugins">
|
<div class="plugins">
|
||||||
<div class="plugin" *ngFor="let p of api.plugins" (click)="download(p.url)">
|
<div class="plugin" *ngFor="let p of api.plugins" (click)="download(p.url)">
|
||||||
<div class="image">
|
<div class="image">
|
||||||
<img src="/static/modern/img/{{ p.name }}.png">
|
<img [src]="img(p.name)">
|
||||||
</div>
|
</div>
|
||||||
<div class="platform">
|
<div class="platform">
|
||||||
{{ p.name }}
|
{{ p.name }}
|
||||||
|
@ -17,7 +17,11 @@ export class ClientDownloadComponent implements OnInit {
|
|||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
}
|
}
|
||||||
|
|
||||||
download(url) {
|
download(url: string) {
|
||||||
window.location.href = url;
|
window.location.href = url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
img(image: string) {
|
||||||
|
return this.api.staticURL( 'modern/img/' + image + '.png');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
<div class="login-container">
|
<div class="login-container">
|
||||||
|
|
||||||
<div class="login-brand">
|
<div class="login-brand">
|
||||||
<img src="/static/modern/img/login-img.png">
|
<img [src]="api.staticURL('modern/img/login-img.png')">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="login-info">
|
<div class="login-info">
|
||||||
|
@ -15,6 +15,7 @@ export interface Authenticator {
|
|||||||
|
|
||||||
// URLs related
|
// URLs related
|
||||||
export interface UDSUrls {
|
export interface UDSUrls {
|
||||||
|
readonly static: string;
|
||||||
readonly changeLang: string;
|
readonly changeLang: string;
|
||||||
readonly login: string;
|
readonly login: string;
|
||||||
readonly logout: string;
|
readonly logout: string;
|
||||||
@ -27,17 +28,16 @@ export interface UDSUrls {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface UDSConfig {
|
export interface UDSConfig {
|
||||||
version: string;
|
readonly version: string;
|
||||||
version_stamp: string;
|
readonly version_stamp: string;
|
||||||
language: string;
|
readonly language: string;
|
||||||
available_languages: Lang[];
|
readonly available_languages: Lang[];
|
||||||
static: string;
|
readonly authenticators: Authenticator[];
|
||||||
authenticators: Authenticator[];
|
readonly os: string;
|
||||||
os: string;
|
readonly csrf_field: string;
|
||||||
csrf_field: string;
|
readonly csrf: string;
|
||||||
csrf: string;
|
readonly urls: UDSUrls;
|
||||||
urls: UDSUrls;
|
readonly bypassPluginDetection: boolean;
|
||||||
bypassPluginDetection: boolean;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Downloadable {
|
export interface Downloadable {
|
||||||
|
@ -7,6 +7,8 @@ import { JSONServicesInformation, JSONEnabledService } from './types/services';
|
|||||||
import { UDSGuiService } from './gui/uds-gui.service';
|
import { UDSGuiService } from './gui/uds-gui.service';
|
||||||
import { Plugin } from './helpers/plugin';
|
import { Plugin } from './helpers/plugin';
|
||||||
|
|
||||||
|
import { environment } from '../environments/environment';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class UDSApiService {
|
export class UDSApiService {
|
||||||
readonly user: User;
|
readonly user: User;
|
||||||
@ -33,19 +35,29 @@ export class UDSApiService {
|
|||||||
return udsData.plugins;
|
return udsData.plugins;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Client enabler */
|
||||||
enabler(serviceId: string, transportId: string) {
|
enabler(serviceId: string, transportId: string) {
|
||||||
const enabler = this.config.urls.enabler.replace('param1', serviceId).replace('param2', transportId);
|
const enabler = this.config.urls.enabler.replace('param1', serviceId).replace('param2', transportId);
|
||||||
return this.http.get<JSONEnabledService>(enabler);
|
return this.http.get<JSONEnabledService>(enabler);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Images & static related */
|
||||||
galleryImageURL(imageId: string) {
|
galleryImageURL(imageId: string) {
|
||||||
return this.config.urls.galleryImage.replace('param1', imageId);
|
return this.config.urls.galleryImage.replace('param1', imageId);
|
||||||
}
|
}
|
||||||
|
|
||||||
transportIcon(transportId: string) {
|
transportIconURL(transportId: string) {
|
||||||
return this.config.urls.transportIcon.replace('param1', transportId);
|
return this.config.urls.transportIcon.replace('param1', transportId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
staticURL(url: string) {
|
||||||
|
if (environment.production) {
|
||||||
|
return this.config.urls.static + url;
|
||||||
|
} else {
|
||||||
|
return '/static' + url;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets services information
|
* Gets services information
|
||||||
*/
|
*/
|
||||||
@ -65,6 +77,14 @@ export class UDSApiService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gotoAdmin() {
|
||||||
|
window.location.href = this.config.urls.admin;
|
||||||
|
}
|
||||||
|
|
||||||
|
logout() {
|
||||||
|
window.location.href = this.config.urls.logout;
|
||||||
|
}
|
||||||
|
|
||||||
launchURL(udsURL): void {
|
launchURL(udsURL): void {
|
||||||
this.plugin.launchURL(udsURL);
|
this.plugin.launchURL(udsURL);
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
</script>
|
</script>
|
||||||
<!-- DYNAMIC_DATA -->
|
<!-- DYNAMIC_DATA -->
|
||||||
<script type="text/javascript" src="server/es.js"></script>
|
<script type="text/javascript" src="server/es.js"></script>
|
||||||
<script type="text/javascript" src="/js"></script>
|
<script type="text/javascript" src="/uds/js"></script>
|
||||||
<!-- ENDDYNAMIC_DATA -->
|
<!-- ENDDYNAMIC_DATA -->
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
|
2
toUDS.py
2
toUDS.py
@ -157,7 +157,7 @@ def createDirs():
|
|||||||
|
|
||||||
#
|
#
|
||||||
# def buildSource():
|
# def buildSource():
|
||||||
# os.system('ng build --prod --output-hashing=none --aot --deleteOutputPath --build-optimizer --deploy-url /static/modern')
|
# os.system('ng build --prod --output-hashing=none --aot --deleteOutputPath --build-optimizer --deploy-url /uds/res/modern/ --base-href /uds/page')
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
Loading…
Reference in New Issue
Block a user