A self hosted chat application with end-to-end encrypted messaging.
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
import { Controller } from "./controller/AbstractController"; import { UserModel } from "./model/UserModel" import { Model } from "./model/AbstractModel"; import { View } from "./view/AbstractView"; import { UserView } from "./view/UserView"; import { UserController } from "./controller/UserController"; import { ModelFactory } from "./model/ModelFactory"; import { ActiveUserViewModel } from "./viewmodel/ActiveUserViewModel"; import { ChatMessageViewModel } from "./viewmodel/ChatMessageViewModel"; import * as Handlebars from "handlebars"; import { ChatModel } from "./model/ChatModel"; import { ChatView } from "./view/ChatView"; import { ChatController } from "./controller/ChatController"; import { JsonAPI } from "./singleton/JsonAPI"; import * as log from 'loglevel'; import { EncryptionService } from "./service/EncryptionService"; import { SJCLEncryptionService } from "./service/SJCLEncryptionService"; import { MessageCipherDTO } from "./dto/MessageCipherDTO"; import { SearchService } from "./service/SearchService"; import { FuseSearchService } from "./service/FuseSearchService"; import { ChatMessageDTO } from "./dto/ChatMessageDTO"; import { NotificationService } from "./service/NotificationService"; import { AlertifyNotificationService } from "./service/AlertifyNotificationService"; import * as sprintf2 from "sprintf-js";
const usersListElement = document.getElementById('contacts-box'); const userSearchButton = document.getElementById('user-search'); const userSearchInputElement = document.getElementById('user-search-term') const userSearchCancelButton = document.getElementById('user-search-cancel')
log.setLevel("TRACE")
const chatModel = new ChatModel();
const userModel = new UserModel(); // const userModel = ModelFactory.createModel("USER");
// @ts-ignore: Argument of type 'HTMLElement | null' is not assignable to parameter of type 'HTMLElement'. Type 'null' is not assignable to type 'HTMLElement'.
const userView = new UserView(userModel, chatModel, usersListElement, userSearchInputElement, userSearchButton, userSearchCancelButton);
// console.log(userBox);
userModel.attach(userView); // userView.model
const userController = new UserController(userModel, userView); // userController.test();
// userModel.someBusinessMethod(activeUsersMock);
log.info("hello");
const chatArea = document.getElementById('chat-area-new'); // @ts-ignore: Argument of type 'HTMLElement | null' is not assignable to parameter of type 'HTMLElement'. Type 'null' is not assignable to type 'HTMLElement'.
const chatView = new ChatView(chatModel, chatArea); chatModel.attach(chatView); const chatController = new ChatController(chatModel, chatView);
function someFunc(vm: ActiveUserViewModel): void { // log.info(vm);
// logger.info(vm)
}
userController.getActiveUsers();
log.info("test"); // someFunc(activeUserViewModelMock);
// @ts-ignore: Object is possibly 'null'.
var source = document.getElementById("msg_container_template").innerHTML;
var msgContainerTemplate = Handlebars.compile(source);
JsonAPI.ACTIVE_USERS_GET + 'aef';
const encryptionService: EncryptionService = new SJCLEncryptionService(); let messageCipherDTO: MessageCipherDTO = encryptionService.encrypt("password","data"); console.log(encryptionService.decrypt("password", messageCipherDTO));
Handlebars.registerHelper('avatar', function() { return '<div class="img_cont_msg"> <img src="https://static.turbosquid.com/Preview/001292/481/WV/_D.jpg" class="rounded-circle user_img_msg"> </div>'; });
const testList: ChatMessageDTO[] = []; const cmSearchService: SearchService<ChatMessageDTO> = new FuseSearchService(["userName"]); // @ts-ignore
log.info(sprintf("test sprintf")) log.info(sprintf2.sprintf("test sprintf")) const ns: NotificationService = new AlertifyNotificationService(); ns.success("Welcome"); // ns.errorWithDelay("Hmm very long error notif", 10);
|