start of CSRF
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
import { Component } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
|
import { SystemConfigService } from './system-config.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-root',
|
selector: 'app-root',
|
||||||
@@ -7,4 +8,15 @@ import { Component } from '@angular/core';
|
|||||||
})
|
})
|
||||||
export class AppComponent {
|
export class AppComponent {
|
||||||
title = 'Tech UI';
|
title = 'Tech UI';
|
||||||
|
|
||||||
|
constructor(private systemConfigService: SystemConfigService) { }
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
console.log("app component init");
|
||||||
|
this.systemConfigService.getSystemConfig().subscribe(
|
||||||
|
x => console.log('Observer got a next value: ' + x),
|
||||||
|
err => console.error('Observer got an error: ' + err),
|
||||||
|
() => console.log('Observer got a complete notification')
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+15
-1
@@ -1,5 +1,6 @@
|
|||||||
import { BrowserModule } from '@angular/platform-browser';
|
import { BrowserModule } from '@angular/platform-browser';
|
||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
|
import { HttpClientModule, HttpClientXsrfModule } from '@angular/common/http';
|
||||||
|
|
||||||
import { MatTableModule } from '@angular/material/table';
|
import { MatTableModule } from '@angular/material/table';
|
||||||
import { MatPaginatorModule } from '@angular/material/paginator';
|
import { MatPaginatorModule } from '@angular/material/paginator';
|
||||||
@@ -13,7 +14,12 @@ import { StatusListComponent } from './status-list/status-list.component';
|
|||||||
import { FolderListComponent } from './folder-list/folder-list.component';
|
import { FolderListComponent } from './folder-list/folder-list.component';
|
||||||
import { DeviceListComponent } from './device-list/device-list.component';
|
import { DeviceListComponent } from './device-list/device-list.component';
|
||||||
import { StatusToggleComponent } from './status-toggle/status-toggle.component';
|
import { StatusToggleComponent } from './status-toggle/status-toggle.component';
|
||||||
|
import { DeviceListDataSource } from './device-list/device-list-datasource';
|
||||||
|
|
||||||
|
const deviceID = (): String => {
|
||||||
|
const dID: String = globalThis.metadata['deviceID'];
|
||||||
|
return dID.substring(0, 5)
|
||||||
|
}
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
declarations: [
|
declarations: [
|
||||||
@@ -30,9 +36,17 @@ import { StatusToggleComponent } from './status-toggle/status-toggle.component';
|
|||||||
MatTableModule,
|
MatTableModule,
|
||||||
MatPaginatorModule,
|
MatPaginatorModule,
|
||||||
MatSortModule,
|
MatSortModule,
|
||||||
MatButtonToggleModule
|
MatButtonToggleModule,
|
||||||
|
HttpClientModule,
|
||||||
|
HttpClientXsrfModule.withOptions({
|
||||||
|
headerName: 'X-CSRF-Token-' + deviceID(),
|
||||||
|
cookieName: 'CSRF-Token-' + deviceID(),
|
||||||
|
})
|
||||||
],
|
],
|
||||||
providers: [],
|
providers: [],
|
||||||
bootstrap: [AppComponent]
|
bootstrap: [AppComponent]
|
||||||
})
|
})
|
||||||
|
|
||||||
export class AppModule { }
|
export class AppModule { }
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<title>TechUi</title>
|
<title>TechUi</title>
|
||||||
@@ -8,8 +9,11 @@
|
|||||||
<link rel="icon" type="image/x-icon" href="favicon.ico">
|
<link rel="icon" type="image/x-icon" href="favicon.ico">
|
||||||
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500&display=swap" rel="stylesheet">
|
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500&display=swap" rel="stylesheet">
|
||||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
||||||
|
<script type="text/javascript" src="http://127.0.0.1:8384/meta.js"></script>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<app-root></app-root>
|
<app-root></app-root>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
Reference in New Issue
Block a user