cleanup of frontend
This commit is contained in:
parent
718e47c3ab
commit
826dad2ad0
@ -130,3 +130,4 @@ ns.success("Welcome");
|
|||||||
const ss = FuseSearchService.getInstance<ActiveUserViewModel>([""]);
|
const ss = FuseSearchService.getInstance<ActiveUserViewModel>([""]);
|
||||||
|
|
||||||
const test = Builder<UserViewDeps>().build();
|
const test = Builder<UserViewDeps>().build();
|
||||||
|
|
||||||
|
@ -1,17 +1,13 @@
|
|||||||
import { ChatMessageDTO } from "../dto/ChatMessageDTO";
|
|
||||||
|
|
||||||
import * as log from "loglevel";
|
import * as log from "loglevel";
|
||||||
|
import { ChatMessageDTO } from "../dto/ChatMessageDTO";
|
||||||
import { ChatMessageViewModel } from "../viewmodel/ChatMessageViewModel";
|
|
||||||
|
|
||||||
import { JsonAPI } from "../singleton/JsonAPI";
|
|
||||||
|
|
||||||
import { fetchErrorHandler } from "./FetchErrorHandler";
|
|
||||||
|
|
||||||
import { EncryptionService } from "../service/EncryptionService";
|
import { EncryptionService } from "../service/EncryptionService";
|
||||||
import { SJCLEncryptionService } from "../service/SJCLEncryptionService";
|
import { SJCLEncryptionService } from "../service/SJCLEncryptionService";
|
||||||
import { ChatModel } from "./ChatModel"
|
import { JsonAPI } from "../singleton/JsonAPI";
|
||||||
import { Sprintf } from "../singleton/Sprintf";
|
import { Sprintf } from "../singleton/Sprintf";
|
||||||
|
import { ChatMessageViewModel } from "../viewmodel/ChatMessageViewModel";
|
||||||
|
import { ChatModel } from "./ChatModel";
|
||||||
|
import { fetchErrorHandler } from "./FetchErrorHandler";
|
||||||
|
|
||||||
export class ChatModelHelper {
|
export class ChatModelHelper {
|
||||||
private static readonly _encryptionService: EncryptionService = new SJCLEncryptionService();
|
private static readonly _encryptionService: EncryptionService = new SJCLEncryptionService();
|
||||||
|
|
||||||
@ -26,8 +22,6 @@ export class ChatModelHelper {
|
|||||||
return data.map(vm => this.toChatMessageVM(vm, passphrase));
|
return data.map(vm => this.toChatMessageVM(vm, passphrase));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static toChatMessageVM(chatMessageDTO: ChatMessageDTO, passphrase: string): ChatMessageViewModel {
|
private static toChatMessageVM(chatMessageDTO: ChatMessageDTO, passphrase: string): ChatMessageViewModel {
|
||||||
|
@ -67,7 +67,7 @@ export class UserModel implements Subject {
|
|||||||
*/
|
*/
|
||||||
public getActiveUsers(): void {
|
public getActiveUsers(): void {
|
||||||
if(JsonAPI.authToken!= null){
|
if(JsonAPI.authToken!= null){
|
||||||
this.getActiveUsersAjax(JsonAPI.authToken, JsonAPI.ACTIVE_USERS_GET)
|
this.getActiveUsersAjax(JsonAPI.authToken)
|
||||||
.then(data => {
|
.then(data => {
|
||||||
// // activeUsers = data;
|
// // activeUsers = data;
|
||||||
// sessionStorage.setItem('activeUsers', JSON.stringify(data));
|
// sessionStorage.setItem('activeUsers', JSON.stringify(data));
|
||||||
@ -82,10 +82,9 @@ export class UserModel implements Subject {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async getActiveUsersAjax(authToken2: string, URL: string): Promise<any> {
|
async getActiveUsersAjax(authToken: string): Promise<any> {
|
||||||
let headers = new Headers();
|
let headers = new Headers();
|
||||||
// headers.append('Authorization', basicAuthToken);
|
headers.append('X-AUTH-TOKEN', authToken);
|
||||||
headers.append('X-AUTH-TOKEN', authToken2);
|
|
||||||
let response = await fetch(JsonAPI.ACTIVE_USERS_GET, {
|
let response = await fetch(JsonAPI.ACTIVE_USERS_GET, {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
headers: headers
|
headers: headers
|
||||||
|
@ -3,7 +3,7 @@ import * as sjcl from "sjcl";
|
|||||||
import { MessageCipherDTO } from "../dto/MessageCipherDTO";
|
import { MessageCipherDTO } from "../dto/MessageCipherDTO";
|
||||||
|
|
||||||
export class SJCLEncryptionService implements EncryptionService {
|
export class SJCLEncryptionService implements EncryptionService {
|
||||||
private readonly params = { mode: "gcm", ts: 128, adata: "", iter: 10000}
|
private readonly params = { mode: "gcm", ts: 128, adata: "", iter: 10000 }
|
||||||
public encrypt(passphrase: string, plainText: string): MessageCipherDTO {
|
public encrypt(passphrase: string, plainText: string): MessageCipherDTO {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
return JSON.parse(sjcl.encrypt(passphrase, plainText, this.params) as string) as MessageCipherDTO;
|
return JSON.parse(sjcl.encrypt(passphrase, plainText, this.params) as string) as MessageCipherDTO;
|
||||||
|
@ -1,27 +1,19 @@
|
|||||||
import { Observer } from "../observe/Observer";
|
|
||||||
import { TemplateFactory } from "../template/TemplateFactory";
|
|
||||||
import { ChatModel } from "../model/ChatModel";
|
|
||||||
import { ChatMessageViewModel } from "../viewmodel/ChatMessageViewModel";
|
|
||||||
import * as log from 'loglevel';
|
|
||||||
import * as DOMPurify from 'dompurify';
|
import * as DOMPurify from 'dompurify';
|
||||||
import { MarkDownService } from "../service/MarkDownService";
|
import * as log from 'loglevel';
|
||||||
import { MarkDownItMarkDownService } from "../service/MarkDownItMarkDownService";
|
|
||||||
import { JsonAPI } from "../singleton/JsonAPI";
|
|
||||||
import { MessageCipherDTO } from "../dto/MessageCipherDTO";
|
|
||||||
import { SJCLEncryptionService } from "../service/SJCLEncryptionService";
|
|
||||||
import { EncryptionService } from "../service/EncryptionService";
|
|
||||||
import { ChatMessageDTO } from "../dto/ChatMessageDTO";
|
import { ChatMessageDTO } from "../dto/ChatMessageDTO";
|
||||||
import { fetchHandler } from "./FetchHandler";
|
import { MessageCipherDTO } from "../dto/MessageCipherDTO";
|
||||||
|
import { ChatModel } from "../model/ChatModel";
|
||||||
|
import { Observer } from "../observe/Observer";
|
||||||
|
import { EncryptionService } from "../service/EncryptionService";
|
||||||
|
import { MarkDownService } from "../service/MarkDownService";
|
||||||
|
import { JsonAPI } from "../singleton/JsonAPI";
|
||||||
|
import { ChatMessageViewModel } from "../viewmodel/ChatMessageViewModel";
|
||||||
import { ChatViewDeps } from "./ChatViewDeps";
|
import { ChatViewDeps } from "./ChatViewDeps";
|
||||||
|
import { fetchHandler } from "./FetchHandler";
|
||||||
|
|
||||||
export class ChatView implements Observer {
|
export class ChatView implements Observer {
|
||||||
private readonly _chatModel: ChatModel;
|
private readonly _chatModel: ChatModel;
|
||||||
private readonly _messageContainer: HTMLElement;
|
private readonly _messageContainer: HTMLElement;
|
||||||
// private readonly _messageSendTemplate = TemplateFactory.getTemplate('msg_container_send_template');
|
|
||||||
// private readonly _messageReceiveTemplate = TemplateFactory.getTemplate('msg_container_template');
|
|
||||||
// private readonly _markdownService: MarkDownService = new MarkDownItMarkDownService();
|
|
||||||
// private readonly _encryptionService: EncryptionService = new SJCLEncryptionService();
|
|
||||||
|
|
||||||
private readonly _messageSendTemplate: Handlebars.TemplateDelegate<ChatMessageViewModel>;
|
private readonly _messageSendTemplate: Handlebars.TemplateDelegate<ChatMessageViewModel>;
|
||||||
private readonly _messageReceiveTemplate: Handlebars.TemplateDelegate<ChatMessageViewModel>;
|
private readonly _messageReceiveTemplate: Handlebars.TemplateDelegate<ChatMessageViewModel>;
|
||||||
private readonly _markdownService: MarkDownService;
|
private readonly _markdownService: MarkDownService;
|
||||||
|
@ -128,7 +128,7 @@
|
|||||||
<div class="d-flex bd-highlight">
|
<div class="d-flex bd-highlight">
|
||||||
<div class="img_cont">
|
<div class="img_cont">
|
||||||
<img src="https://static.turbosquid.com/Preview/001292/481/WV/_D.jpg" class="rounded-circle user_img">
|
<img src="https://static.turbosquid.com/Preview/001292/481/WV/_D.jpg" class="rounded-circle user_img">
|
||||||
<span class="online_icon"></span>
|
<!-- <span class="online_icon"></span> -->
|
||||||
</div>
|
</div>
|
||||||
<div class="user_info">
|
<div class="user_info">
|
||||||
<span id="user-name-span">Chat with Khalid</span>
|
<span id="user-name-span">Chat with Khalid</span>
|
||||||
|
Loading…
Reference in New Issue
Block a user