Browse Source

6 Tour end

master
Eduard Kuzmenko 3 years ago
parent
commit
3394b3eff5
  1. 46
      babel.config.js
  2. 4492
      package-lock.json
  3. 16
      package.json
  4. 10
      src/components/appSearchSuper..ts
  5. 2
      src/components/chat/chat.ts
  6. 2
      src/components/chat/input.ts
  7. 5
      src/lib/appManagers/appImManager.ts
  8. 20
      src/lib/appManagers/appMessagesManager.ts
  9. 2
      src/lib/mtproto/mtproto_config.ts
  10. 11
      src/scss/partials/_audio.scss
  11. 5
      src/scss/partials/_chatBubble.scss
  12. 38
      src/scss/partials/_chatlist.scss
  13. 2
      src/scss/partials/_document.scss
  14. 28
      src/scss/partials/_leftSidebar.scss
  15. 101
      src/scss/partials/_rightSidebar.scss
  16. 4
      src/scss/style.scss
  17. 44163
      stats.json
  18. 4
      tsconfig.json
  19. 11
      webpack.common.js
  20. BIN
      whybundled.txt

46
babel.config.js

@ -1,7 +1,41 @@ @@ -1,7 +1,41 @@
module.exports = {
presets: [
['@babel/preset-env', {targets: {node: 'current'}}],
'@babel/preset-typescript',
]/* ,
plugins: ["@babel/plugin-syntax-dynamic-import"] */
const config2 = {
"presets": [
"@babel/preset-typescript",
[
"@babel/preset-env",
{
"modules": false,
"corejs": 3,
"useBuiltIns": "usage",
//"include": ["es.promise.finally"],
"targets": {
"chrome": "56"
}
}
],
//"@babel/preset-2015"
],
"plugins": [
["@babel/plugin-proposal-class-properties", { "loose": true }],
["@babel/plugin-transform-typescript", {
"allowNamespaces": true
}]
]
};
const config3 = {
"presets": [
"@babel/preset-env",
"@babel/preset-typescript"
],
"plugins": [
"@babel/plugin-proposal-class-properties",
["@babel/plugin-transform-typescript", {
"allowNamespaces": true
}]
]
};
module.exports = config2;

4492
package-lock.json generated

File diff suppressed because it is too large Load Diff

16
package.json

@ -22,9 +22,14 @@ @@ -22,9 +22,14 @@
"webpack-dev-server": "^3.11.0"
},
"devDependencies": {
"@babel/core": "^7.10.2",
"@babel/preset-env": "^7.10.2",
"@babel/preset-typescript": "^7.10.1",
"@babel/cli": "^7.12.1",
"@babel/core": "^7.12.3",
"@babel/plugin-proposal-class-properties": "^7.12.1",
"@babel/plugin-transform-typescript": "^7.12.1",
"@babel/polyfill": "^7.12.1",
"@babel/preset-env": "^7.12.1",
"@babel/preset-es2015": "^7.0.0-beta.53",
"@babel/preset-typescript": "^7.12.1",
"@cryptography/aes": "^0.1.1",
"@cryptography/sha1": "^0.1.0",
"@cryptography/sha256": "^0.2.0",
@ -36,8 +41,11 @@ @@ -36,8 +41,11 @@
"aes-js": "^3.1.2",
"autoprefixer": "^9.8.0",
"babel-jest": "^24.9.0",
"babel-loader": "^8.1.0",
"babel-preset-es2015": "^6.24.1",
"compression": "^1.7.4",
"compression-webpack-plugin": "^3.1.0",
"core-js": "^3.6.5",
"css-loader": "^3.5.3",
"express": "^4.17.1",
"fast-png": "^5.0.2",
@ -65,7 +73,7 @@ @@ -65,7 +73,7 @@
"terser-webpack-plugin": "^3.0.2",
"ts-jest": "^24.3.0",
"ts-loader": "^6.2.2",
"typescript": "^3.9.3",
"typescript": "^3.9.7",
"url-loader": "^2.3.0",
"webpack": "^4.43.0",
"webpack-cli": "^3.3.11",

10
src/components/appSearchSuper..ts

@ -337,7 +337,9 @@ export default class AppSearchSuper { @@ -337,7 +337,9 @@ export default class AppSearchSuper {
appDialogsManager.setLastMessage(dialog, message, dom, this.searchContext.query);
}
searchGroup.setActive();
if(searchGroup.list.childElementCount) {
searchGroup.setActive();
}
break;
}
@ -608,9 +610,9 @@ export default class AppSearchSuper { @@ -608,9 +610,9 @@ export default class AppSearchSuper {
});
}
if(type !== 'inputMessagesFilterEmpty') {
this.afterPerforming(messages.length, sharedMediaDiv);
}
//if(type !== 'inputMessagesFilterEmpty') {
this.afterPerforming(type === 'inputMessagesFilterEmpty' ? 1 : messages.length, sharedMediaDiv);
//}
}
private afterPerforming(length: number, tab: HTMLElement) {

2
src/components/chat/chat.ts

@ -72,7 +72,7 @@ export default class Chat extends EventListenerBase<{ @@ -72,7 +72,7 @@ export default class Chat extends EventListenerBase<{
}
}
private init() {
public init() {
this.topbar = new ChatTopbar(this, appSidebarRight, this.appMessagesManager, this.appPeersManager, this.appChatsManager);
this.bubbles = new ChatBubbles(this, this.appMessagesManager, this.appStickersManager, this.appUsersManager, this.appInlineBotsManager, this.appPhotosManager, this.appDocsManager, this.appPeersManager, this.appChatsManager);
this.input = new ChatInput(this, this.appMessagesManager, this.appDocsManager, this.appChatsManager, this.appPeersManager, this.appWebPagesManager, this.appImManager);

2
src/components/chat/input.ts

@ -811,7 +811,7 @@ export default class ChatInput { @@ -811,7 +811,7 @@ export default class ChatInput {
//this.chat.log('messageInput entities', richValue, value, markdownEntities);
if(this.stickersHelper) {
if(this.stickersHelper && (this.chat.peerId > 0 || this.appChatsManager.hasRights(this.chat.peerId, 'send', 'send_stickers'))) {
let emoticon = '';
if(entities.length && entities[0]._ == 'messageEntityEmoji') {
const entity = entities[0];

5
src/lib/appManagers/appImManager.ts

@ -543,7 +543,10 @@ export class AppImManager { @@ -543,7 +543,10 @@ export class AppImManager {
return this.setPeer(peerId, lastMsgId);
}
this.createNewChat();
const chat = this.chat;
if(!chat.init) { // * use first not inited chat
this.createNewChat();
}
if(type) {
this.chat.setType(type);

20
src/lib/appManagers/appMessagesManager.ts

@ -602,7 +602,7 @@ export class AppMessagesManager { @@ -602,7 +602,7 @@ export class AppMessagesManager {
this.pendingAfterMsgs[peerId] = sentRequestOptions;
}
this.beforeMessageSending(message, {isScheduled: !!options.scheduleDate || undefined});
this.beforeMessageSending(message, {isScheduled: !!options.scheduleDate || undefined, threadId: options.threadId});
}
public sendFile(peerId: number, file: File | Blob | MyDocument, options: Partial<{
@ -952,7 +952,7 @@ export class AppMessagesManager { @@ -952,7 +952,7 @@ export class AppMessagesManager {
return sentDeferred;
};
this.beforeMessageSending(message, {isGroupedItem: options.isGroupedItem, isScheduled: !!options.scheduleDate || undefined});
this.beforeMessageSending(message, {isGroupedItem: options.isGroupedItem, isScheduled: !!options.scheduleDate || undefined, threadId: options.threadId});
if(!options.isGroupedItem) {
sentDeferred.then(inputMedia => {
@ -1327,7 +1327,7 @@ export class AppMessagesManager { @@ -1327,7 +1327,7 @@ export class AppMessagesManager {
this.pendingAfterMsgs[peerId] = sentRequestOptions;
}
this.beforeMessageSending(message, {isScheduled: !!options.scheduleDate || undefined});
this.beforeMessageSending(message, {isScheduled: !!options.scheduleDate || undefined, threadId: options.threadId});
}
/* private checkSendOptions(options: Partial<{
@ -1341,7 +1341,7 @@ export class AppMessagesManager { @@ -1341,7 +1341,7 @@ export class AppMessagesManager {
}
} */
private beforeMessageSending(message: any, options: Partial<{isGroupedItem: true, isScheduled: true}> = {}) {
private beforeMessageSending(message: any, options: Partial<{isGroupedItem: true, isScheduled: true, threadId: number}> = {}) {
const messageId = message.id;
const peerId = this.getMessagePeer(message);
const storage = options.isScheduled ? this.getScheduledMessagesStorage(peerId) : this.getMessagesStorage(peerId);
@ -1352,8 +1352,16 @@ export class AppMessagesManager { @@ -1352,8 +1352,16 @@ export class AppMessagesManager {
rootScope.broadcast('scheduled_new', {peerId, mid: messageId});
}
} else {
const historyStorage = this.getHistoryStorage(peerId);
historyStorage.history.unshift(messageId);
if(options.threadId && this.threadsStorage[peerId]) {
delete this.threadsStorage[peerId][options.threadId];
}
//if(options.threadId) {
const historyStorage = this.getHistoryStorage(peerId/* , options.threadId */);
historyStorage.history.unshift(messageId);
//}
/* const historyStorage = this.getHistoryStorage(peerId);
historyStorage.history.unshift(messageId); */
if(!options.isGroupedItem) {
this.saveMessages([message], {storage, isOutgoing: true});

2
src/lib/mtproto/mtproto_config.ts

@ -5,7 +5,7 @@ export const REPLIES_PEER_ID = 1271266957; @@ -5,7 +5,7 @@ export const REPLIES_PEER_ID = 1271266957;
export const App = {
id: 1025907,
hash: '452b0359b988148995f22ff0f4229750',
version: '0.3.2',
version: '0.4.0',
domains: [] as string[],
baseDcId: 2
};

11
src/scss/partials/_audio.scss

@ -341,7 +341,11 @@ @@ -341,7 +341,11 @@
&-waveform {
height: 23px;
margin-top: -4px;
margin-top: -3px;
@include respond-to(handhelds) {
margin-top: -4px;
}
//overflow: visible!important;
@ -418,7 +422,10 @@ @@ -418,7 +422,10 @@
.audio-time {
line-height: 1;
margin-left: -1px;
margin-top: 2px;
margin-top: 7px;
@include respond-to(handhelds) {
margin-top: 2px;
}
}
&.is-unread {

5
src/scss/partials/_chatBubble.scss

@ -416,6 +416,10 @@ $bubble-margin: .25rem; @@ -416,6 +416,10 @@ $bubble-margin: .25rem;
.document {
height: 3.375rem;
@include respond-to(handhelds) {
padding-left: 44px;
}
}
}
@ -938,6 +942,7 @@ $bubble-margin: .25rem; @@ -938,6 +942,7 @@ $bubble-margin: .25rem;
.message.audio-message, .message.voice-message {
padding: 8px !important;
//padding: 4px 6px 4px 8px !important;
}
.message.contact-message {

38
src/scss/partials/_chatlist.scss

@ -284,7 +284,7 @@ @@ -284,7 +284,7 @@
width: 100%;
//border-bottom: 1px solid #DADCE0;
padding: 1rem 0 .5rem;
margin-bottom: .5rem;
margin-bottom: 17px;
@include respond-to(handhelds) {
margin-bottom: 0;
@ -298,31 +298,49 @@ @@ -298,31 +298,49 @@
user-select: none;
@include respond-to(handhelds) {
padding: 0 9px 0 16px;
padding: 5px 9px 0 16px;
font-size: 15px;
}
}
&-contacts {
padding: 16px 0 7px;
border-bottom: 1px solid #dadce0;
@include respond-to(handhelds) {
padding: 7px 0 0px;
padding: 0px 0 2px;
}
.search-group__name {
padding-bottom: 17px;
// .search-group__name {
// padding-bottom: 17px;
@include respond-to(handhelds) {
padding-bottom: 0;
}
}
// @include respond-to(handhelds) {
// padding-bottom: 0;
// }
// }
}
&-people.search-group-contacts {
padding: 5px 0 5px !important;
}
&:last-child {
border-bottom: none;
}
}
.search-super {
.search-group {
margin-bottom: 0px;
padding: 4px 0 0;
&__name {
padding-top: 1rem;
display: flex;
justify-content: space-between;
}
}
}
}
// use together like class="chatlist-container contacts-container"

2
src/scss/partials/_document.scss

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
.document {
padding-left: 4.5rem;
padding-left: 4.25rem;
height: 70px;
&-ico {

28
src/scss/partials/_leftSidebar.scss

@ -142,6 +142,34 @@ @@ -142,6 +142,34 @@
.search-helper {
display: flex;
margin-left: 28px;
@include respond-to(handhelds) {
margin-left: 20px;
}
.selector-user {
margin-top: 7px;
font-size: 14px;
&:hover {
background-color: rgba(80, 162, 233, .2);
}
&-avatar:after {
display: none !important;
}
}
}
.search-super-tabs-scrollable {
position: sticky;
top: 0;
z-index: 2;
.menu-horizontal ul {
justify-content: space-around;
}
}
}

101
src/scss/partials/_rightSidebar.scss

@ -249,6 +249,23 @@ @@ -249,6 +249,23 @@
display: flex;
flex-direction: column;
.search-group__show-more {
color: $color-blue;
cursor: pointer;
font-weight: 400;
}
.search-super-month-name {
border-top: 1px solid #dadce0;
padding: 24px 0px 0px 24px;
font-weight: 500;
color: #707579;
@include respond-to(handhelds) {
padding: 18px 0px 0px 16px;
}
}
&.sliding {
max-height: 100%;
}
@ -268,6 +285,8 @@ @@ -268,6 +285,8 @@
}
&-tabs-scrollable {
box-shadow: none !important;
.scrollable {
position: relative;
}
@ -322,6 +341,11 @@ @@ -322,6 +341,11 @@
}
&-content-media {
.search-super-month-name {
border: none;
padding: 9px 0px 7px 24px;
}
.video-time {
position: absolute;
left: 5px;
@ -333,6 +357,7 @@ @@ -333,6 +357,7 @@
z-index: 1;
font-size: 12px;
color: white;
line-height: 18px;
}
.grid-item {
@ -375,17 +400,25 @@ @@ -375,17 +400,25 @@
}
&-content-files {
padding: 7px 20px;
// padding: 8px 20px;
.search-super-month-items {
padding: 8px 24px 16px 20px;
@include respond-to(handhelds) {
padding: 8px 16px 8px 12px;
}
}
.document {
padding-left: 4rem;
padding-right: 1rem;
padding-left: 60px;
// padding-right: 1rem;
//height: 54px;
height: calc(50px + 1.5rem);
height: calc(48px + 1.5rem);
&-ico, &-download {
width: 48px;
height: 48px;
border-radius: 5px !important;
}
/* & + .document {
@ -404,7 +437,7 @@ @@ -404,7 +437,7 @@
}
&-content-links {
padding: 0 30px 15px 15px;
// padding: 0 24px 15px 15px;
.search-super-item {
display: flex;
@ -446,46 +479,65 @@ @@ -446,46 +479,65 @@
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
font-size: 14px;
margin-top: -1px;
}
}
.title {
font-size: 16px;
margin-top: 3px;
margin-top: 2px;
}
.subtitle {
font-size: 14px;
max-width: 310px;
&.sender {
margin-top: 2px;
}
}
&-content-music, &-content-voice {
padding: 20px 15px 15px 20px;
.search-super-month-items {
padding: 0 24px 15px 15px;
@include respond-to(handhelds) {
padding: 0 16px 15px 7px;
}
}
}
&-content-music, &-content-voice {
.search-super-month-items {
padding: 20px 15px 0px 20px;
@include respond-to(handhelds) {
padding: 20px 15px 0px 12px;
}
}
.preloader-container {
.preloader-circular {
background-color: rgba(0, 0, 0, .35);
}
@include respond-to(handhelds) {
width: 36px;
height: 36px;
}
@include respond-to(not-handhelds) {
width: 38px;
height: 38px;
}
width: 36px !important;
height: 36px !important;
}
.audio {
padding-left: 61px;
/* min-height: 58px; */
max-width: 368px;
justify-content: unset;
height: 48px;
margin-bottom: 1.5rem;
@include respond-to(not-handhelds) {
max-width: 377px;
}
&.audio-show-progress .audio-subtitle {
overflow: visible;
}
@ -500,14 +552,14 @@ @@ -500,14 +552,14 @@
}
.part {
height: 112px;
width: 112px;
height: 112px !important;
width: 112px !important;
position: absolute;
background-color: white;
@include respond-to(handhelds) {
width: 100px;
height: 100px;
width: 100px !important;
height: 100px !important;
}
}
}
@ -528,7 +580,10 @@ @@ -528,7 +580,10 @@
.sent-time {
flex: 0 0 auto;
margin-left: .5rem;
margin-left: 8px;
margin-top: 3px;
font-size: 12px;
color: #707579;
}
.search-group.is-short {

4
src/scss/style.scss

@ -1078,6 +1078,10 @@ middle-ellipsis-element { @@ -1078,6 +1078,10 @@ middle-ellipsis-element {
min-width: 1.25rem;
line-height: 1.25rem !important;
padding: 0 5.75px;
html.is-safari & {
line-height: 22px !important;
}
}
&-24 {

44163
stats.json

File diff suppressed because one or more lines are too long

4
tsconfig.json

@ -3,9 +3,9 @@ @@ -3,9 +3,9 @@
/* Basic Options */
// "incremental": true, /* Enable incremental compilation */
//"target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */
"target": "es2016", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */
"target": "es2015", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
"lib": ["es2016", "dom", "ES2018.Promise", "webworker"], /* Specify library files to be included in the compilation. */
"lib": ["es2015", "dom", "webworker"], /* Specify library files to be included in the compilation. */
"allowJs": true, /* Allow javascript files to be compiled. */
// "checkJs": true, /* Report errors in .js files. */
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */

11
webpack.common.js

@ -6,7 +6,7 @@ const postcssPresetEnv = require('postcss-preset-env'); @@ -6,7 +6,7 @@ const postcssPresetEnv = require('postcss-preset-env');
const ServiceWorkerWebpackPlugin = require('serviceworker-webpack-plugin');
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', '176.100.18.181', '46.219.250.22', '193.42.119.184', '46.133.168.67', '78.26.144.197', '46.133.225.88', '128.124.170.79'];
const allowedIPs = ['194.58.97.147', '195.66.140.39', '192.168.31.144', '127.0.0.1', '192.168.31.1', '192.168.31.192', '176.100.8.202', '46.219.250.22', '193.42.119.184', '46.133.168.67', '78.26.144.197', '46.133.225.88', '128.124.170.79'];
const devMode = process.env.NODE_ENV !== 'production';
const useLocal = false;
@ -59,6 +59,7 @@ module.exports = { @@ -59,6 +59,7 @@ module.exports = {
{
test: /\.ts?$/,
use: [
//{ loader: 'babel-loader', options: require('./babel.config') },
'ts-loader',
{ loader: "ifdef-loader", options: opts }
],
@ -93,7 +94,7 @@ module.exports = { @@ -93,7 +94,7 @@ module.exports = {
contentBase: path.join(__dirname, 'public'),
watchContentBase: true,
compress: true,
http2: true,
http2: useLocal ? undefined : true,
https: useLocal ? undefined : {
key: fs.readFileSync(__dirname + '/certs/server-key.pem', 'utf8'),
cert: fs.readFileSync(__dirname + '/certs/server-cert.pem', 'utf8')
@ -101,13 +102,13 @@ module.exports = { @@ -101,13 +102,13 @@ module.exports = {
allowedHosts: useLocal ? undefined : [
'tweb.enko.club'
],
host: '0.0.0.0',
host: useLocal ? undefined : '0.0.0.0',
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,
port: useLocal ? undefined : 443,
overlay: true,
before: function(app, server, compiler) {
before: useLocal ? undefined : function(app, server, compiler) {
app.use((req, res, next) => {
let IP = '';
if(req.headers['cf-connecting-ip']) {

BIN
whybundled.txt

Binary file not shown.
Loading…
Cancel
Save