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

4
src/components/chatInput.ts

@ -147,7 +147,7 @@ export class ChatInput { @@ -147,7 +147,7 @@ export class ChatInput {
this.btnSend.classList.remove('tgico-send');
this.btnSend.classList.add('tgico-microphone2');
appImManager.setTyping('sendMessageCancelAction');
appMessagesManager.setTyping('sendMessageCancelAction');
} else if(!this.btnSend.classList.contains('tgico-send')) {
this.btnSend.classList.add('tgico-send');
this.btnSend.classList.remove('tgico-microphone2');
@ -155,7 +155,7 @@ export class ChatInput { @@ -155,7 +155,7 @@ export class ChatInput {
let time = Date.now();
if(time - this.lastTimeType >= 6000) {
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 @@ -11,10 +11,11 @@ import appStickersManager, { MTStickerSet } from "../lib/appManagers/appStickers
import apiManager from '../lib/mtproto/mtprotoworker';
//import CryptoWorker from '../lib/crypto/cryptoworker';
import LazyLoadQueue from "./lazyLoadQueue";
import { MTDocument, wrapSticker } from "./wrappers";
import { wrapSticker } from "./wrappers";
import appDocsManager from "../lib/appManagers/appDocsManager";
import ProgressivePreloader from "./preloader";
import Config from "../lib/config";
import { MTDocument } from "../types";
export const EMOTICONSSTICKERGROUP = 'emoticons-dropdown';

47
src/components/wrappers.ts

@ -17,52 +17,7 @@ import { Layouter, RectPart } from './groupedLayout'; @@ -17,52 +17,7 @@ import { Layouter, RectPart } from './groupedLayout';
import PollElement from './poll';
import appWebpManager from '../lib/appManagers/appWebpManager';
import { mediaSizes } from '../lib/config';
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'
};
import { MTDocument, MTPhotoSize } from '../types';
export function wrapVideo({doc, container, message, boxWidth, boxHeight, withTail, isOut, middleware, lazyLoadQueue}: {
doc: MTDocument,

2
src/lib/appManagers/AppInlineBotsManager.ts

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

2
src/lib/appManagers/appDialogsManager.ts

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

2
src/lib/appManagers/appDocsManager.ts

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

33
src/lib/appManagers/appImManager.ts

@ -455,10 +455,9 @@ export class AppImManager { @@ -455,10 +455,9 @@ export class AppImManager {
const pinnedMessage = appMessagesManager.getPinnedMessage(this.peerID);
mids.forEach(mid => {
if(pinnedMessage.mid == mid) {
/////this.log('setting pinned message', message);
this.pinnedMessageContainer.dataset.mid = '' + mid;
this.topbar.classList.add('is-pinned-shown');
this.pinnedMessageContent.innerHTML = pinnedMessage.rReply;
(this.messagesQueuePromise || Promise.resolve()).then(() => {
this.setPinnedMessage(pinnedMessage);
});
}
this.needUpdate.forEachReverse((obj, idx) => {
@ -764,6 +763,13 @@ export class AppImManager { @@ -764,6 +763,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() {
if(!this.myID) return Promise.resolve();
@ -1072,6 +1078,11 @@ export class AppImManager { @@ -1072,6 +1078,11 @@ export class AppImManager {
this.scrollable.container.innerHTML = '';
//oldChatInner.remove();
!samePeer && this.finishPeerChange();
const pinned = appMessagesManager.getPinnedMessage(peerID);
if(pinned && !pinned.deleted) {
this.setPinnedMessage(pinned);
}
} else {
this.preloader.detach();
}
@ -1191,20 +1202,6 @@ export class AppImManager { @@ -1191,20 +1202,6 @@ export class AppImManager {
$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) {
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"; @@ -13,8 +13,6 @@ import appPeersManager from "./appPeersManager";
import ServerTimeManager from "../mtproto/serverTimeManager";
import apiFileManager from "../mtproto/apiFileManager";
import appDocsManager from "./appDocsManager";
import appImManager from "./appImManager";
import { MTDocument, MTPhotoSize } from "../../components/wrappers";
import ProgressivePreloader from "../../components/preloader";
import serverTimeManager from "../mtproto/serverTimeManager";
//import apiManager from '../mtproto/apiManager';
@ -23,6 +21,9 @@ import appWebPagesManager from "./appWebPagesManager"; @@ -23,6 +21,9 @@ import appWebPagesManager from "./appWebPagesManager";
import { CancellablePromise, deferredPromise } from "../polyfill";
import appPollsManager from "./appPollsManager";
import searchIndexManager from '../searchIndexManager';
import { MTDocument, MTPhotoSize } from "../../types";
console.trace('include');
const APITIMEOUT = 0;
@ -178,7 +179,10 @@ export class AppMessagesManager { @@ -178,7 +179,10 @@ export class AppMessagesManager {
});
}
});
}
public loadSavedState() {
if(this.loaded) return this.loaded;
this.loaded = new Promise((resolve, reject) => {
AppStorage.get<{
dialogs: Dialog[],
@ -781,7 +785,7 @@ export class AppMessagesManager { @@ -781,7 +785,7 @@ export class AppMessagesManager {
preloader.preloader.onclick = () => {
console.log('cancelling upload', media);
appImManager.setTyping('sendMessageCancelAction');
this.setTyping('sendMessageCancelAction');
media.progress.cancel();
};
@ -820,7 +824,7 @@ export class AppMessagesManager { @@ -820,7 +824,7 @@ export class AppMessagesManager {
uploadPromise: ReturnType<typeof apiFileManager.uploadFile> = null;
let invoke = (flags: number, inputMedia: any) => {
appImManager.setTyping('sendMessageCancelAction');
this.setTyping('sendMessageCancelAction');
return apiManager.invokeApi('messages.sendMedia', {
flags: flags,
@ -915,7 +919,7 @@ export class AppMessagesManager { @@ -915,7 +919,7 @@ export class AppMessagesManager {
console.log('upload progress', progress);
media.progress.done = progress.done;
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
$rootScope.$broadcast('history_update', {peerID: peerID});
};
@ -1078,7 +1082,7 @@ export class AppMessagesManager { @@ -1078,7 +1082,7 @@ export class AppMessagesManager {
preloader.preloader.onclick = () => {
console.log('cancelling upload', media);
appImManager.setTyping('sendMessageCancelAction');
this.setTyping('sendMessageCancelAction');
media.progress.cancel();
};
@ -1127,7 +1131,7 @@ export class AppMessagesManager { @@ -1127,7 +1131,7 @@ export class AppMessagesManager {
let inputPeer = appPeersManager.getInputPeerByID(peerID);
let invoke = (multiMedia: any[]) => {
appImManager.setTyping('sendMessageCancelAction');
this.setTyping('sendMessageCancelAction');
return apiManager.invokeApi('messages.sendMultiMedia', {
flags: flags,
@ -1161,7 +1165,7 @@ export class AppMessagesManager { @@ -1161,7 +1165,7 @@ export class AppMessagesManager {
uploadPromise.notify = (progress: {done: number, total: number}) => {
console.log('upload progress', progress);
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
$rootScope.$broadcast('history_update', {peerID: peerID});
};
@ -3843,6 +3847,20 @@ export class AppMessagesManager { @@ -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();

2
src/lib/appManagers/appPhotosManager.ts

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

2
src/lib/appManagers/appSidebarLeft.ts

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

5
src/lib/appManagers/appSidebarRight.ts

@ -756,11 +756,6 @@ class AppSidebarRight { @@ -756,11 +756,6 @@ class AppSidebarRight {
}
//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 {
membersLi.style.display = appPeersManager.isBroadcast(peerID) ? 'none' : '';

2
src/lib/appManagers/appStickersManager.ts

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

31
src/lib/services.ts

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

6
src/pages/pageSignUp.ts

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

4
src/scss/partials/_chat.scss

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

294
src/types.d.ts vendored

@ -1,249 +1,45 @@ @@ -1,249 +1,45 @@
// Type definitions for jsbn v1.2.29
// Project: http://www-cs-students.stanford.edu/%7Etjw/jsbn/
// Definitions by: Eugene Chernyshov <https://github.com/Evgenus>, Al Tabayoyon <https://github.com/al2xed>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export class SecureRandom {
nextBytes(bytes: number[]): void;
}
export class BigInteger {
constructor(a: number, c: SecureRandom);
constructor(a: number, b: number, c: SecureRandom);
constructor(a: string, b?: number);
constructor(a: number[], b?: number);
constructor(a: BigInteger);
s: number;
t: number;
data: number[]; // forge specific
DB: number;
DM: number;
DV: number;
FV: number;
F1: number;
F2: number;
// am: Compute w_j += (x*this_i), propagate carries,
am(i: number, x: number, w: BigInteger, j: number, c: number, n: number): number;
// (protected) copy this to r
copyTo(r: BigInteger): void;
// (protected) set from integer value x, -DV <= x < DV
fromInt(x: number): void;
// (protected) set from string and radix
fromString(x: string, b: number): void;
// (protected) clamp off excess high words
clamp(): void;
// (public) return string representation in given radix
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;
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'
};

10
webpack.common.js

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

Loading…
Cancel
Save