Browse Source

Fix pinned messages

Fix appMessagesManager import
master
morethanwords 5 years ago
parent
commit
7ee8e4b832
  1. 2
      src/components/appSelectPeers.ts
  2. 4
      src/components/chatInput.ts
  3. 3
      src/components/emoticonsDropdown.ts
  4. 47
      src/components/wrappers.ts
  5. 2
      src/lib/appManagers/AppInlineBotsManager.ts
  6. 2
      src/lib/appManagers/appDialogsManager.ts
  7. 2
      src/lib/appManagers/appDocsManager.ts
  8. 33
      src/lib/appManagers/appImManager.ts
  9. 34
      src/lib/appManagers/appMessagesManager.ts
  10. 2
      src/lib/appManagers/appPhotosManager.ts
  11. 2
      src/lib/appManagers/appSidebarLeft.ts
  12. 5
      src/lib/appManagers/appSidebarRight.ts
  13. 2
      src/lib/appManagers/appStickersManager.ts
  14. 31
      src/lib/services.ts
  15. 6
      src/pages/pageSignUp.ts
  16. 4
      src/scss/partials/_chat.scss
  17. 294
      src/types.d.ts
  18. 10
      webpack.common.js

2
src/components/appSelectPeers.ts

@ -4,7 +4,7 @@ import { $rootScope, cancelEvent, findUpTag, findUpClassName } from "../lib/util
import appDialogsManager from "../lib/appManagers/appDialogsManager"; import appDialogsManager from "../lib/appManagers/appDialogsManager";
import appChatsManager from "../lib/appManagers/appChatsManager"; import appChatsManager from "../lib/appManagers/appChatsManager";
import appUsersManager from "../lib/appManagers/appUsersManager"; import appUsersManager from "../lib/appManagers/appUsersManager";
import { appPeersManager } from "../lib/services"; import appPeersManager from "../lib/appManagers/appPeersManager";
import appPhotosManager from "../lib/appManagers/appPhotosManager"; import appPhotosManager from "../lib/appManagers/appPhotosManager";
export class AppSelectPeers { export class AppSelectPeers {

4
src/components/chatInput.ts

@ -147,7 +147,7 @@ export class ChatInput {
this.btnSend.classList.remove('tgico-send'); this.btnSend.classList.remove('tgico-send');
this.btnSend.classList.add('tgico-microphone2'); this.btnSend.classList.add('tgico-microphone2');
appImManager.setTyping('sendMessageCancelAction'); appMessagesManager.setTyping('sendMessageCancelAction');
} else if(!this.btnSend.classList.contains('tgico-send')) { } else if(!this.btnSend.classList.contains('tgico-send')) {
this.btnSend.classList.add('tgico-send'); this.btnSend.classList.add('tgico-send');
this.btnSend.classList.remove('tgico-microphone2'); this.btnSend.classList.remove('tgico-microphone2');
@ -155,7 +155,7 @@ export class ChatInput {
let time = Date.now(); let time = Date.now();
if(time - this.lastTimeType >= 6000) { if(time - this.lastTimeType >= 6000) {
this.lastTimeType = time; this.lastTimeType = time;
appImManager.setTyping('sendMessageTypingAction'); appMessagesManager.setTyping('sendMessageTypingAction');
} }
} }
}); });

3
src/components/emoticonsDropdown.ts

@ -11,10 +11,11 @@ import appStickersManager, { MTStickerSet } from "../lib/appManagers/appStickers
import apiManager from '../lib/mtproto/mtprotoworker'; import apiManager from '../lib/mtproto/mtprotoworker';
//import CryptoWorker from '../lib/crypto/cryptoworker'; //import CryptoWorker from '../lib/crypto/cryptoworker';
import LazyLoadQueue from "./lazyLoadQueue"; import LazyLoadQueue from "./lazyLoadQueue";
import { MTDocument, wrapSticker } from "./wrappers"; import { wrapSticker } from "./wrappers";
import appDocsManager from "../lib/appManagers/appDocsManager"; import appDocsManager from "../lib/appManagers/appDocsManager";
import ProgressivePreloader from "./preloader"; import ProgressivePreloader from "./preloader";
import Config from "../lib/config"; import Config from "../lib/config";
import { MTDocument } from "../types";
export const EMOTICONSSTICKERGROUP = 'emoticons-dropdown'; export const EMOTICONSSTICKERGROUP = 'emoticons-dropdown';

47
src/components/wrappers.ts

@ -17,52 +17,7 @@ import { Layouter, RectPart } from './groupedLayout';
import PollElement from './poll'; import PollElement from './poll';
import appWebpManager from '../lib/appManagers/appWebpManager'; import appWebpManager from '../lib/appManagers/appWebpManager';
import { mediaSizes } from '../lib/config'; import { mediaSizes } from '../lib/config';
import { MTDocument, MTPhotoSize } from '../types';
export type MTDocument = {
_: 'document' | 'documentEmpty',
pFlags: any,
flags: number,
id: string,
access_hash: string,
file_reference: Uint8Array | number[],
date: number,
mime_type: string,
size: number,
thumbs: MTPhotoSize[],
dc_id: number,
attributes: any[],
thumb?: MTPhotoSize,
type?: string,
h?: number,
w?: number,
file_name?: string,
file?: File,
duration?: number,
downloaded?: boolean,
url?: string,
audioTitle?: string,
audioPerformer?: string,
sticker?: number,
stickerEmoji?: string,
stickerEmojiRaw?: string,
stickerSetInput?: any,
stickerThumbConverted?: true,
animated?: boolean
};
export type MTPhotoSize = {
_: string,
w?: number,
h?: number,
size?: number,
type?: string, // i, m, x, y, w by asc
location?: any,
bytes?: Uint8Array // if type == 'i'
};
export function wrapVideo({doc, container, message, boxWidth, boxHeight, withTail, isOut, middleware, lazyLoadQueue}: { export function wrapVideo({doc, container, message, boxWidth, boxHeight, withTail, isOut, middleware, lazyLoadQueue}: {
doc: MTDocument, doc: MTDocument,

2
src/lib/appManagers/AppInlineBotsManager.ts

@ -1,6 +1,6 @@
import appMessagesManager from "./appMessagesManager"; import appMessagesManager from "./appMessagesManager";
import apiManagerProxy from "../mtproto/mtprotoworker"; import apiManagerProxy from "../mtproto/mtprotoworker";
import { appPeersManager } from "../services"; import appPeersManager from "../appManagers/appPeersManager";
import appMessagesIDsManager from "./appMessagesIDsManager"; import appMessagesIDsManager from "./appMessagesIDsManager";
import { toast } from "../../components/misc"; import { toast } from "../../components/misc";
import { RichTextProcessor } from "../richtextprocessor"; import { RichTextProcessor } from "../richtextprocessor";

2
src/lib/appManagers/appDialogsManager.ts

@ -442,7 +442,7 @@ export class AppDialogsManager {
} }
}); });
/* false && */appMessagesManager.loaded.then(() => { /* false && */appMessagesManager.loadSavedState().then(() => {
this.loadDialogs().then(result => { this.loadDialogs().then(result => {
this.setPinnedDelimiter(); this.setPinnedDelimiter();
//appSidebarLeft.onChatsScroll(); //appSidebarLeft.onChatsScroll();

2
src/lib/appManagers/appDocsManager.ts

@ -2,9 +2,9 @@ import apiFileManager from '../mtproto/apiFileManager';
import FileManager from '../filemanager'; import FileManager from '../filemanager';
import {RichTextProcessor} from '../richtextprocessor'; import {RichTextProcessor} from '../richtextprocessor';
import { CancellablePromise, deferredPromise } from '../polyfill'; import { CancellablePromise, deferredPromise } from '../polyfill';
import { MTDocument } from '../../components/wrappers';
import { isObject } from '../utils'; import { isObject } from '../utils';
import opusDecodeController from '../opusDecodeController'; import opusDecodeController from '../opusDecodeController';
import { MTDocument } from '../../types';
class AppDocsManager { class AppDocsManager {
private docs: {[docID: string]: MTDocument} = {}; private docs: {[docID: string]: MTDocument} = {};

33
src/lib/appManagers/appImManager.ts

@ -455,10 +455,9 @@ export class AppImManager {
const pinnedMessage = appMessagesManager.getPinnedMessage(this.peerID); const pinnedMessage = appMessagesManager.getPinnedMessage(this.peerID);
mids.forEach(mid => { mids.forEach(mid => {
if(pinnedMessage.mid == mid) { if(pinnedMessage.mid == mid) {
/////this.log('setting pinned message', message); (this.messagesQueuePromise || Promise.resolve()).then(() => {
this.pinnedMessageContainer.dataset.mid = '' + mid; this.setPinnedMessage(pinnedMessage);
this.topbar.classList.add('is-pinned-shown'); });
this.pinnedMessageContent.innerHTML = pinnedMessage.rReply;
} }
this.needUpdate.forEachReverse((obj, idx) => { this.needUpdate.forEachReverse((obj, idx) => {
@ -763,6 +762,13 @@ export class AppImManager {
} }
}); });
} }
public setPinnedMessage(message: any) {
/////this.log('setting pinned message', message);
this.pinnedMessageContainer.dataset.mid = '' + message.mid;
this.topbar.classList.add('is-pinned-shown');
this.pinnedMessageContent.innerHTML = message.rReply;
}
public updateStatus() { public updateStatus() {
if(!this.myID) return Promise.resolve(); if(!this.myID) return Promise.resolve();
@ -1072,6 +1078,11 @@ export class AppImManager {
this.scrollable.container.innerHTML = ''; this.scrollable.container.innerHTML = '';
//oldChatInner.remove(); //oldChatInner.remove();
!samePeer && this.finishPeerChange(); !samePeer && this.finishPeerChange();
const pinned = appMessagesManager.getPinnedMessage(peerID);
if(pinned && !pinned.deleted) {
this.setPinnedMessage(pinned);
}
} else { } else {
this.preloader.detach(); this.preloader.detach();
} }
@ -1191,20 +1202,6 @@ export class AppImManager {
$rootScope.$broadcast('peer_changed', this.peerID); $rootScope.$broadcast('peer_changed', this.peerID);
} }
public setTyping(action: any): Promise<boolean> {
if(!this.peerID) return Promise.resolve(false);
if(typeof(action) == 'string') {
action = {_: action};
}
let input = appPeersManager.getInputPeerByID(this.peerID);
return apiManager.invokeApi('messages.setTyping', {
peer: input,
action: action
}) as Promise<boolean>;
}
public updateUnreadByDialog(dialog: Dialog) { public updateUnreadByDialog(dialog: Dialog) {
let maxID = this.peerID == this.myID ? dialog.read_inbox_max_id : dialog.read_outbox_max_id; let maxID = this.peerID == this.myID ? dialog.read_inbox_max_id : dialog.read_outbox_max_id;

34
src/lib/appManagers/appMessagesManager.ts

@ -13,8 +13,6 @@ import appPeersManager from "./appPeersManager";
import ServerTimeManager from "../mtproto/serverTimeManager"; import ServerTimeManager from "../mtproto/serverTimeManager";
import apiFileManager from "../mtproto/apiFileManager"; import apiFileManager from "../mtproto/apiFileManager";
import appDocsManager from "./appDocsManager"; import appDocsManager from "./appDocsManager";
import appImManager from "./appImManager";
import { MTDocument, MTPhotoSize } from "../../components/wrappers";
import ProgressivePreloader from "../../components/preloader"; import ProgressivePreloader from "../../components/preloader";
import serverTimeManager from "../mtproto/serverTimeManager"; import serverTimeManager from "../mtproto/serverTimeManager";
//import apiManager from '../mtproto/apiManager'; //import apiManager from '../mtproto/apiManager';
@ -23,6 +21,9 @@ import appWebPagesManager from "./appWebPagesManager";
import { CancellablePromise, deferredPromise } from "../polyfill"; import { CancellablePromise, deferredPromise } from "../polyfill";
import appPollsManager from "./appPollsManager"; import appPollsManager from "./appPollsManager";
import searchIndexManager from '../searchIndexManager'; import searchIndexManager from '../searchIndexManager';
import { MTDocument, MTPhotoSize } from "../../types";
console.trace('include');
const APITIMEOUT = 0; const APITIMEOUT = 0;
@ -178,7 +179,10 @@ export class AppMessagesManager {
}); });
} }
}); });
}
public loadSavedState() {
if(this.loaded) return this.loaded;
this.loaded = new Promise((resolve, reject) => { this.loaded = new Promise((resolve, reject) => {
AppStorage.get<{ AppStorage.get<{
dialogs: Dialog[], dialogs: Dialog[],
@ -781,7 +785,7 @@ export class AppMessagesManager {
preloader.preloader.onclick = () => { preloader.preloader.onclick = () => {
console.log('cancelling upload', media); console.log('cancelling upload', media);
appImManager.setTyping('sendMessageCancelAction'); this.setTyping('sendMessageCancelAction');
media.progress.cancel(); media.progress.cancel();
}; };
@ -820,7 +824,7 @@ export class AppMessagesManager {
uploadPromise: ReturnType<typeof apiFileManager.uploadFile> = null; uploadPromise: ReturnType<typeof apiFileManager.uploadFile> = null;
let invoke = (flags: number, inputMedia: any) => { let invoke = (flags: number, inputMedia: any) => {
appImManager.setTyping('sendMessageCancelAction'); this.setTyping('sendMessageCancelAction');
return apiManager.invokeApi('messages.sendMedia', { return apiManager.invokeApi('messages.sendMedia', {
flags: flags, flags: flags,
@ -915,7 +919,7 @@ export class AppMessagesManager {
console.log('upload progress', progress); console.log('upload progress', progress);
media.progress.done = progress.done; media.progress.done = progress.done;
media.progress.percent = Math.max(1, Math.floor(100 * progress.done / progress.total)); media.progress.percent = Math.max(1, Math.floor(100 * progress.done / progress.total));
appImManager.setTyping({_: actionName, progress: media.progress.percent | 0}); this.setTyping({_: actionName, progress: media.progress.percent | 0});
preloader.setProgress(media.progress.percent); // lol, nice preloader.setProgress(media.progress.percent); // lol, nice
$rootScope.$broadcast('history_update', {peerID: peerID}); $rootScope.$broadcast('history_update', {peerID: peerID});
}; };
@ -1078,7 +1082,7 @@ export class AppMessagesManager {
preloader.preloader.onclick = () => { preloader.preloader.onclick = () => {
console.log('cancelling upload', media); console.log('cancelling upload', media);
appImManager.setTyping('sendMessageCancelAction'); this.setTyping('sendMessageCancelAction');
media.progress.cancel(); media.progress.cancel();
}; };
@ -1127,7 +1131,7 @@ export class AppMessagesManager {
let inputPeer = appPeersManager.getInputPeerByID(peerID); let inputPeer = appPeersManager.getInputPeerByID(peerID);
let invoke = (multiMedia: any[]) => { let invoke = (multiMedia: any[]) => {
appImManager.setTyping('sendMessageCancelAction'); this.setTyping('sendMessageCancelAction');
return apiManager.invokeApi('messages.sendMultiMedia', { return apiManager.invokeApi('messages.sendMultiMedia', {
flags: flags, flags: flags,
@ -1161,7 +1165,7 @@ export class AppMessagesManager {
uploadPromise.notify = (progress: {done: number, total: number}) => { uploadPromise.notify = (progress: {done: number, total: number}) => {
console.log('upload progress', progress); console.log('upload progress', progress);
media.progress.percent = Math.max(1, Math.floor(100 * progress.done / progress.total)); media.progress.percent = Math.max(1, Math.floor(100 * progress.done / progress.total));
appImManager.setTyping({_: actionName, progress: media.progress.percent | 0}); this.setTyping({_: actionName, progress: media.progress.percent | 0});
preloader.setProgress(media.progress.percent); // lol, nice preloader.setProgress(media.progress.percent); // lol, nice
$rootScope.$broadcast('history_update', {peerID: peerID}); $rootScope.$broadcast('history_update', {peerID: peerID});
}; };
@ -3843,6 +3847,20 @@ export class AppMessagesManager {
} }
} }
} }
public setTyping(action: any): Promise<boolean> {
if(!$rootScope.myID) return Promise.resolve(false);
if(typeof(action) == 'string') {
action = {_: action};
}
let input = appPeersManager.getInputPeerByID($rootScope.myID);
return apiManager.invokeApi('messages.setTyping', {
peer: input,
action: action
}) as Promise<boolean>;
}
} }
export default new AppMessagesManager(); export default new AppMessagesManager();

2
src/lib/appManagers/appPhotosManager.ts

@ -2,10 +2,10 @@ import appUsersManager from "./appUsersManager";
import { calcImageInBox, isObject } from "../utils"; import { calcImageInBox, isObject } from "../utils";
import fileManager from '../filemanager'; import fileManager from '../filemanager';
import { bytesFromHex } from "../bin_utils"; import { bytesFromHex } from "../bin_utils";
import { MTPhotoSize } from "../../components/wrappers";
import apiFileManager from "../mtproto/apiFileManager"; import apiFileManager from "../mtproto/apiFileManager";
//import apiManager from '../mtproto/apiManager'; //import apiManager from '../mtproto/apiManager';
import apiManager from '../mtproto/mtprotoworker'; import apiManager from '../mtproto/mtprotoworker';
import { MTPhotoSize } from "../../types";
export type MTPhoto = { export type MTPhoto = {
_: 'photo' | 'photoEmpty' | string, _: 'photo' | 'photoEmpty' | string,

2
src/lib/appManagers/appSidebarLeft.ts

@ -9,7 +9,7 @@ import { horizontalMenu, putPreloader, parseMenuButtonsTo } from "../../componen
import appUsersManager from "./appUsersManager"; import appUsersManager from "./appUsersManager";
import Scrollable from "../../components/scrollable_new"; import Scrollable from "../../components/scrollable_new";
import appPhotosManager from "./appPhotosManager"; import appPhotosManager from "./appPhotosManager";
import { appPeersManager } from "../services"; import appPeersManager from "../appManagers/appPeersManager";
import popupAvatar from "../../components/popupAvatar"; import popupAvatar from "../../components/popupAvatar";
import appChatsManager from "./appChatsManager"; import appChatsManager from "./appChatsManager";
import { AppSelectPeers } from "../../components/appSelectPeers"; import { AppSelectPeers } from "../../components/appSelectPeers";

5
src/lib/appManagers/appSidebarRight.ts

@ -756,11 +756,6 @@ class AppSidebarRight {
} }
//this.log('userFull', userFull); //this.log('userFull', userFull);
if(userFull.pinned_msg_id) { // request pinned message
appImManager.pinnedMsgID = userFull.pinned_msg_id;
appMessagesManager.wrapSingleMessage(userFull.pinned_msg_id);
}
}); });
} else { } else {
membersLi.style.display = appPeersManager.isBroadcast(peerID) ? 'none' : ''; membersLi.style.display = appPeersManager.isBroadcast(peerID) ? 'none' : '';

2
src/lib/appManagers/appStickersManager.ts

@ -1,9 +1,9 @@
import AppStorage from '../storage'; import AppStorage from '../storage';
import { MTDocument } from '../../components/wrappers';
//import apiManager from '../mtproto/apiManager'; //import apiManager from '../mtproto/apiManager';
import apiManager from '../mtproto/mtprotoworker'; import apiManager from '../mtproto/mtprotoworker';
import apiFileManager from '../mtproto/apiFileManager'; import apiFileManager from '../mtproto/apiFileManager';
import appDocsManager from './appDocsManager'; import appDocsManager from './appDocsManager';
import { MTDocument } from '../../types';
export type MTStickerSet = { export type MTStickerSet = {
_: 'stickerSet', _: 'stickerSet',

31
src/lib/services.ts

@ -17,28 +17,29 @@ import AppSidebarLeft from './appManagers/appSidebarLeft';
import AppMediaViewer from './appManagers/appMediaViewer'; import AppMediaViewer from './appManagers/appMediaViewer';
//import AppSharedMediaManager from './appManagers/appSharedMediaManager'; //import AppSharedMediaManager from './appManagers/appSharedMediaManager';
export const appUsersManager = AppUsersManager; const appUsersManager = AppUsersManager;
export const appChatsManager = AppChatsManager; const appChatsManager = AppChatsManager;
export const appMessagesIDsManager = AppMessagesIDsManager; const appMessagesIDsManager = AppMessagesIDsManager;
export const apiUpdatesManager = ApiUpdatesManager; const apiUpdatesManager = ApiUpdatesManager;
export const appPhotosManager = AppPhotosManager; const appPhotosManager = AppPhotosManager;
export const appMessagesManager = AppMessagesManager; const appMessagesManager = AppMessagesManager;
export const appProfileManager = AppProfileManager; const appProfileManager = AppProfileManager;
export const appImManager = AppImManager; const appImManager = AppImManager;
export const appPeersManager = AppPeersManager; const appPeersManager = AppPeersManager;
export const appStickersManager = AppStickersManager; const appStickersManager = AppStickersManager;
export const appDocsManager = AppDocsManager; const appDocsManager = AppDocsManager;
//export const appSharedMediaManager = AppSharedMediaManager; //export const appSharedMediaManager = AppSharedMediaManager;
export const appSidebarRight = AppSidebarRight; const appSidebarRight = AppSidebarRight;
export const appSidebarLeft = AppSidebarLeft; const appSidebarLeft = AppSidebarLeft;
export const appMediaViewer = AppMediaViewer; const appMediaViewer = AppMediaViewer;
export const appDialogsManager = AppDialogsManager; const appDialogsManager = AppDialogsManager;
(window as any).Services = { (window as any).Services = {
appUsersManager, appUsersManager,
appChatsManager, appChatsManager,
apiUpdatesManager, apiUpdatesManager,
appMessagesManager, appMessagesManager,
appMessagesIDsManager,
appPeersManager, appPeersManager,
appProfileManager, appProfileManager,
appPhotosManager, appPhotosManager,

6
src/pages/pageSignUp.ts

@ -4,16 +4,16 @@ import pageIm from './pageIm';
import apiManager from '../lib/mtproto/mtprotoworker'; import apiManager from '../lib/mtproto/mtprotoworker';
import Page from './page'; import Page from './page';
import popupAvatar from '../components/popupAvatar'; import popupAvatar from '../components/popupAvatar';
import appProfileManager from '../lib/appManagers/appProfileManager';
let authCode: { let authCode: {
'phone_number': string, 'phone_number': string,
'phone_code_hash': string 'phone_code_hash': string
} = null; } = null;
let onFirstMount = () => { let onFirstMount = () => import('../lib/appManagers/appProfileManager').then(imported => {
const pageElement = page.pageEl; const pageElement = page.pageEl;
const avatarPreview = pageElement.querySelector('#canvas-avatar') as HTMLCanvasElement; const avatarPreview = pageElement.querySelector('#canvas-avatar') as HTMLCanvasElement;
const appProfileManager = imported.default;
let uploadAvatar: () => Promise<any>; let uploadAvatar: () => Promise<any>;
pageElement.querySelector('.auth-image').addEventListener('click', () => { pageElement.querySelector('.auth-image').addEventListener('click', () => {
@ -114,7 +114,7 @@ let onFirstMount = () => {
} }
}); });
}); });
}; });
const page = new Page('page-signUp', true, onFirstMount, (_authCode: typeof authCode) => { const page = new Page('page-signUp', true, onFirstMount, (_authCode: typeof authCode) => {
authCode = _authCode; authCode = _authCode;

4
src/scss/partials/_chat.scss

@ -20,7 +20,9 @@ $time-background: rgba(0, 0, 0, .35);
} }
@include respond-to(handhelds) { @include respond-to(handhelds) {
margin-bottom: 60px; & + #bubbles {
margin-top: 60px;
}
} }
} }

294
src/types.d.ts vendored

@ -1,249 +1,45 @@
// Type definitions for jsbn v1.2.29 export type MTDocument = {
// Project: http://www-cs-students.stanford.edu/%7Etjw/jsbn/ _: 'document' | 'documentEmpty',
// Definitions by: Eugene Chernyshov <https://github.com/Evgenus>, Al Tabayoyon <https://github.com/al2xed> pFlags: any,
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped flags: number,
id: string,
export class SecureRandom { access_hash: string,
nextBytes(bytes: number[]): void; file_reference: Uint8Array | number[],
} date: number,
mime_type: string,
export class BigInteger { size: number,
constructor(a: number, c: SecureRandom); thumbs: MTPhotoSize[],
constructor(a: number, b: number, c: SecureRandom); dc_id: number,
constructor(a: string, b?: number); attributes: any[],
constructor(a: number[], b?: number);
constructor(a: BigInteger); thumb?: MTPhotoSize,
type?: string,
s: number; h?: number,
t: number; w?: number,
data: number[]; // forge specific file_name?: string,
file?: File,
DB: number; duration?: number,
DM: number; downloaded?: boolean,
DV: number; url?: string,
FV: number; audioTitle?: string,
F1: number; audioPerformer?: string,
F2: number;
sticker?: number,
// am: Compute w_j += (x*this_i), propagate carries, stickerEmoji?: string,
am(i: number, x: number, w: BigInteger, j: number, c: number, n: number): number; stickerEmojiRaw?: string,
stickerSetInput?: any,
// (protected) copy this to r stickerThumbConverted?: true,
copyTo(r: BigInteger): void;
animated?: boolean
// (protected) set from integer value x, -DV <= x < DV };
fromInt(x: number): void;
export type MTPhotoSize = {
// (protected) set from string and radix _: string,
fromString(x: string, b: number): void; w?: number,
h?: number,
// (protected) clamp off excess high words size?: number,
clamp(): void; type?: string, // i, m, x, y, w by asc
location?: any,
// (public) return string representation in given radix bytes?: Uint8Array // if type == 'i'
toString(b?: number): string; };
// (public) -this
negate(): BigInteger;
// (public) |this|
abs(): BigInteger;
// (public) return + if this > a, - if this < a, 0 if equal
compareTo(a: BigInteger): number;
// (public) return the number of bits in "this"
bitLength(): number;
// (protected) r = this << n*DB
dlShiftTo(n: number, r: BigInteger): void;
// (protected) r = this >> n*DB
drShiftTo(n: number, r: BigInteger): void;
// (protected) r = this << n
lShiftTo(n: number, r: BigInteger): void;
// (protected) r = this >> n
rShiftTo(n: number, r: BigInteger): void;
// (protected) r = this - a
subTo(a: BigInteger, r: BigInteger): void;
// (protected) r = this * a, r != this,a (HAC 14.12)
multiplyTo(a: BigInteger, r: BigInteger): void;
// (protected) r = this^2, r != this (HAC 14.16)
squareTo(r: BigInteger): void;
// (protected) divide this by m, quotient and remainder to q, r (HAC 14.20)
// r != q, this != m. q or r may be null.
divRemTo(m: BigInteger, q: BigInteger, r: BigInteger): void;
// (public) this mod a
mod(a: BigInteger): BigInteger;
// (protected) return "-1/this % 2^DB"; useful for Mont. reduction
invDigit(): number;
// (protected) true iff this is even
isEven(): boolean;
// (protected) this^e, e < 2^32, doing sqr and mul with "r" (HAC 14.79)
exp(e: number, z: Reduction): BigInteger;
// (public) this^e % m, 0 <= e < 2^32
modPowInt(e: number, m: BigInteger): BigInteger;
// (public)
clone(): BigInteger;
// (public) return value as integer
intValue(): number;
// (public) return value as byte
byteValue(): number;
// (public) return value as short (assumes DB>=16)
shortValue(): number;
// (protected) return x s.t. r^x < DV
chunkSize(r: number): number;
// (public) 0 if this == 0, 1 if this > 0
signum(): number;
// (protected) convert to radix string
toRadix(b: number): string;
// (protected) convert from radix string
fromRadix(s: string, b: number): void;
// (protected) alternate constructor
fromNumber(a: number, b?: number, c?: number): void;
// (public) convert to bigendian byte array
toByteArray(): number[];
equals(a: BigInteger): boolean;
min(a: BigInteger): BigInteger;
max(a: BigInteger): BigInteger;
// (protected) r = this op a (bitwise)
bitwiseTo(a: BigInteger, op: (x: number, y: number) => number, r: BigInteger): void;
// (public) this & a
and(a: BigInteger): BigInteger;
// (public) this | a
or(a: BigInteger): BigInteger;
// (public) this ^ a
xor(a: BigInteger): BigInteger;
// (public) this & ~a
andNot(a: BigInteger): BigInteger;
// (public) ~this
not(): BigInteger;
// (public) this << n
shiftLeft(n: number): BigInteger;
// (public) this >> n
shiftRight(n: number): BigInteger;
// (public) returns index of lowest 1-bit (or -1 if none)
getLowestSetBit(): number;
// (public) return number of set bits
bitCount(): number;
// (public) true iff nth bit is set
testBit(n: number): boolean;
// (protected) this op (1<<n)
changeBit(n: number, op: (x: number, y: number) => number): BigInteger;
// (protected) this op (1<<n)
setBit(n: number): BigInteger;
// (public) this & ~(1<<n)
clearBit(n: number): BigInteger
// (public) this ^ (1<<n)
flipBit(n: number): BigInteger
// (protected) r = this + a
addTo(a: BigInteger, r: BigInteger): void;
// (public) this + a
add(a: BigInteger): BigInteger;
// (public) this - a
subtract(a: BigInteger): BigInteger;
// (public) this * a
multiply(a: BigInteger): BigInteger;
// (public) this^2
square(): BigInteger;
// (public) this / a
divide(a: BigInteger): BigInteger;
// (public) this % a
remainder(a: BigInteger): BigInteger;
// (public) [this/a,this%a]
divideAndRemainder(a: BigInteger): BigInteger[]; // Array of 2 items
// (protected) this *= n, this >= 0, 1 < n < DV
dMultiply(n: number): void;
// (protected) this += n << w words, this >= 0
dAddOffset(n: number, w: number): void;
// (public) this^e
pow(e: number): BigInteger;
// (protected) r = lower n words of "this * a", a.t <= n
multiplyLowerTo(a: BigInteger, n: number, r: BigInteger): void;
// (protected) r = "this * a" without lower n words, n > 0
multiplyUpperTo(a: BigInteger, n: number, r: BigInteger): void;
// (public) this^e % m (HAC 14.85)
modPow(e: BigInteger, m: BigInteger): BigInteger;
// (public) gcd(this,a) (HAC 14.54)
gcd(a: BigInteger): BigInteger;
// (protected) this % n, n < 2^26
modInt(n: number): number;
// (public) 1/this % m (HAC 14.61)
modInverse(m: BigInteger): BigInteger;
// (public) test primality with certainty >= 1-.5^t
isProbablePrime(t: number): boolean;
// (protected) true if probably prime (HAC 4.24, Miller-Rabin)
millerRabin(t: number): boolean;
static ZERO: BigInteger;
static ONE: BigInteger;
}
export interface Reduction {
convert(x: BigInteger): BigInteger;
revert(x: BigInteger): BigInteger;
reduce(x: BigInteger): void;
mulTo(x: BigInteger, y: BigInteger, r: BigInteger): void;
sqrTo(x: BigInteger, r: BigInteger): void;
}
export as namespace jsbn;

10
webpack.common.js

@ -6,8 +6,8 @@ const postcssPresetEnv = require('postcss-preset-env');
const fs = require('fs'); const fs = require('fs');
const allowedIPs = ['195.66.140.39', '192.168.31.144', '127.0.0.1', '192.168.31.1', '192.168.31.192']; const allowedIPs = ['195.66.140.39', '192.168.31.144', '127.0.0.1', '192.168.31.1', '192.168.31.192'];
const devMode = process.env.NODE_ENV !== 'production'; const devMode = process.env.NODE_ENV !== 'production';
const useLocal = false;
console.log('DEVMODE:', devMode); console.log('DEVMODE:', devMode);
@ -130,15 +130,15 @@ module.exports = {
watchContentBase: true, watchContentBase: true,
compress: true, compress: true,
http2: true, http2: true,
https: { https: useLocal ? undefined : {
key: fs.readFileSync(__dirname + '/certs/server-key.pem', 'utf8'), key: fs.readFileSync(__dirname + '/certs/server-key.pem', 'utf8'),
cert: fs.readFileSync(__dirname + '/certs/server-cert.pem', 'utf8') cert: fs.readFileSync(__dirname + '/certs/server-cert.pem', 'utf8')
}, },
allowedHosts: [ allowedHosts: useLocal ? undefined : [
'tweb.enko.club' 'tweb.enko.club'
], ],
host: '0.0.0.0', host: '0.0.0.0',
public: 'tweb.enko.club', public: useLocal ? undefined : 'tweb.enko.club',
//host: '192.168.0.105', // '0.0.0.0' //host: '192.168.0.105', // '0.0.0.0'
//host: 'tweb.enko.club', // '0.0.0.0' //host: 'tweb.enko.club', // '0.0.0.0'
port: 443, port: 443,
@ -161,7 +161,7 @@ module.exports = {
} }
}); });
}, },
sockHost: 'tweb.enko.club', sockHost: useLocal ? undefined : 'tweb.enko.club',
}, },
plugins: [ plugins: [
new HtmlWebpackPlugin({ new HtmlWebpackPlugin({

Loading…
Cancel
Save