Browse Source

Support for geochats

master
Global Server 3 years ago
parent
commit
e323d3fb32
  1. 50
      package-lock.json
  2. 7
      src/components/inputField.ts
  3. 49
      src/components/peerProfile.ts
  4. 17
      src/components/sidebarLeft/index.ts
  5. 109
      src/components/sidebarLeft/tabs/newGroup.ts
  6. 4
      src/components/sidebarRight/tabs/chatType.ts
  7. 3
      src/lang.ts
  8. 29
      src/lib/appManagers/appChatsManager.ts
  9. 2
      src/lib/mtproto/schema.ts
  10. 2
      src/lib/mtproto/tl_utils.ts
  11. 3
      src/scripts/out/langPack.strings

50
package-lock.json generated

@ -7540,7 +7540,7 @@
"version": "3.5.1", "version": "3.5.1",
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.1.tgz", "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.1.tgz",
"integrity": "sha512-9+s+Od+W0VJJzawDma/gvBNQqkTiqYTWLuZoyAsivsI4AaWTCzHG06/TMjsf1cYe9Cb97UCEhjz7HvnPk2p/tw==", "integrity": "sha512-9+s+Od+W0VJJzawDma/gvBNQqkTiqYTWLuZoyAsivsI4AaWTCzHG06/TMjsf1cYe9Cb97UCEhjz7HvnPk2p/tw==",
"dev": true, "devOptional": true,
"dependencies": { "dependencies": {
"anymatch": "~3.1.1", "anymatch": "~3.1.1",
"braces": "~3.0.2", "braces": "~3.0.2",
@ -7561,7 +7561,7 @@
"version": "3.1.1", "version": "3.1.1",
"resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.1.tgz", "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.1.tgz",
"integrity": "sha512-mM8522psRCqzV+6LhomX5wgp25YVibjh8Wj23I5RPkPppSVSjyKD2A2mBJmWGa+KN7f2D6LNh9jkBCeyLktzjg==", "integrity": "sha512-mM8522psRCqzV+6LhomX5wgp25YVibjh8Wj23I5RPkPppSVSjyKD2A2mBJmWGa+KN7f2D6LNh9jkBCeyLktzjg==",
"dev": true, "devOptional": true,
"dependencies": { "dependencies": {
"normalize-path": "^3.0.0", "normalize-path": "^3.0.0",
"picomatch": "^2.0.4" "picomatch": "^2.0.4"
@ -7574,7 +7574,7 @@
"version": "2.2.0", "version": "2.2.0",
"resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz",
"integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==",
"dev": true, "devOptional": true,
"engines": { "engines": {
"node": ">=8" "node": ">=8"
} }
@ -7583,7 +7583,7 @@
"version": "3.0.2", "version": "3.0.2",
"resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz",
"integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==",
"dev": true, "devOptional": true,
"dependencies": { "dependencies": {
"fill-range": "^7.0.1" "fill-range": "^7.0.1"
}, },
@ -7595,7 +7595,7 @@
"version": "7.0.1", "version": "7.0.1",
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz",
"integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==",
"dev": true, "devOptional": true,
"dependencies": { "dependencies": {
"to-regex-range": "^5.0.1" "to-regex-range": "^5.0.1"
}, },
@ -7607,7 +7607,6 @@
"version": "2.3.2", "version": "2.3.2",
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz",
"integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==",
"dev": true,
"hasInstallScript": true, "hasInstallScript": true,
"optional": true, "optional": true,
"os": [ "os": [
@ -7621,7 +7620,7 @@
"version": "5.1.1", "version": "5.1.1",
"resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.1.tgz", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.1.tgz",
"integrity": "sha512-FnI+VGOpnlGHWZxthPGR+QhR78fuiK0sNLkHQv+bL9fQi57lNNdquIbna/WrfROrolq8GK5Ek6BiMwqL/voRYQ==", "integrity": "sha512-FnI+VGOpnlGHWZxthPGR+QhR78fuiK0sNLkHQv+bL9fQi57lNNdquIbna/WrfROrolq8GK5Ek6BiMwqL/voRYQ==",
"dev": true, "devOptional": true,
"dependencies": { "dependencies": {
"is-glob": "^4.0.1" "is-glob": "^4.0.1"
}, },
@ -7633,7 +7632,7 @@
"version": "2.1.0", "version": "2.1.0",
"resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz",
"integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==",
"dev": true, "devOptional": true,
"dependencies": { "dependencies": {
"binary-extensions": "^2.0.0" "binary-extensions": "^2.0.0"
}, },
@ -7645,7 +7644,7 @@
"version": "7.0.0", "version": "7.0.0",
"resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz",
"integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",
"dev": true, "devOptional": true,
"engines": { "engines": {
"node": ">=0.12.0" "node": ">=0.12.0"
} }
@ -7654,7 +7653,7 @@
"version": "3.5.0", "version": "3.5.0",
"resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.5.0.tgz", "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.5.0.tgz",
"integrity": "sha512-cMhu7c/8rdhkHXWsY+osBhfSy0JikwpHK/5+imo+LpeasTF8ouErHrlYkwT0++njiyuDvc7OFY5T3ukvZ8qmFQ==", "integrity": "sha512-cMhu7c/8rdhkHXWsY+osBhfSy0JikwpHK/5+imo+LpeasTF8ouErHrlYkwT0++njiyuDvc7OFY5T3ukvZ8qmFQ==",
"dev": true, "devOptional": true,
"dependencies": { "dependencies": {
"picomatch": "^2.2.1" "picomatch": "^2.2.1"
}, },
@ -7666,7 +7665,7 @@
"version": "5.0.1", "version": "5.0.1",
"resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
"integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==",
"dev": true, "devOptional": true,
"dependencies": { "dependencies": {
"is-number": "^7.0.0" "is-number": "^7.0.0"
}, },
@ -19361,7 +19360,7 @@
"version": "2.2.2", "version": "2.2.2",
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.2.tgz", "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.2.tgz",
"integrity": "sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg==", "integrity": "sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg==",
"dev": true, "devOptional": true,
"engines": { "engines": {
"node": ">=8.6" "node": ">=8.6"
}, },
@ -25658,7 +25657,6 @@
"version": "2.0.1", "version": "2.0.1",
"resolved": "https://registry.npmjs.org/watchpack-chokidar2/-/watchpack-chokidar2-2.0.1.tgz", "resolved": "https://registry.npmjs.org/watchpack-chokidar2/-/watchpack-chokidar2-2.0.1.tgz",
"integrity": "sha512-nCFfBIPKr5Sh61s4LPpy1Wtfi0HE8isJ3d2Yb5/Ppw2P2B/3eVSEBjKfN0fmHJSK14+31KwMKmcrzs2GM4P0Ww==", "integrity": "sha512-nCFfBIPKr5Sh61s4LPpy1Wtfi0HE8isJ3d2Yb5/Ppw2P2B/3eVSEBjKfN0fmHJSK14+31KwMKmcrzs2GM4P0Ww==",
"dev": true,
"optional": true, "optional": true,
"dependencies": { "dependencies": {
"chokidar": "^2.1.8" "chokidar": "^2.1.8"
@ -25669,7 +25667,6 @@
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-2.1.8.tgz", "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-2.1.8.tgz",
"integrity": "sha512-ZmZUazfOzf0Nve7duiCKD23PFSCs4JPoYyccjUFF3aQkQadqBhfzhjkwBH2mNOG9cTBwhamM37EIsIkZw3nRgg==", "integrity": "sha512-ZmZUazfOzf0Nve7duiCKD23PFSCs4JPoYyccjUFF3aQkQadqBhfzhjkwBH2mNOG9cTBwhamM37EIsIkZw3nRgg==",
"deprecated": "Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.", "deprecated": "Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.",
"dev": true,
"optional": true, "optional": true,
"dependencies": { "dependencies": {
"anymatch": "^2.0.0", "anymatch": "^2.0.0",
@ -33044,7 +33041,7 @@
"version": "3.5.1", "version": "3.5.1",
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.1.tgz", "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.1.tgz",
"integrity": "sha512-9+s+Od+W0VJJzawDma/gvBNQqkTiqYTWLuZoyAsivsI4AaWTCzHG06/TMjsf1cYe9Cb97UCEhjz7HvnPk2p/tw==", "integrity": "sha512-9+s+Od+W0VJJzawDma/gvBNQqkTiqYTWLuZoyAsivsI4AaWTCzHG06/TMjsf1cYe9Cb97UCEhjz7HvnPk2p/tw==",
"dev": true, "devOptional": true,
"requires": { "requires": {
"anymatch": "~3.1.1", "anymatch": "~3.1.1",
"braces": "~3.0.2", "braces": "~3.0.2",
@ -33060,7 +33057,7 @@
"version": "3.1.1", "version": "3.1.1",
"resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.1.tgz", "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.1.tgz",
"integrity": "sha512-mM8522psRCqzV+6LhomX5wgp25YVibjh8Wj23I5RPkPppSVSjyKD2A2mBJmWGa+KN7f2D6LNh9jkBCeyLktzjg==", "integrity": "sha512-mM8522psRCqzV+6LhomX5wgp25YVibjh8Wj23I5RPkPppSVSjyKD2A2mBJmWGa+KN7f2D6LNh9jkBCeyLktzjg==",
"dev": true, "devOptional": true,
"requires": { "requires": {
"normalize-path": "^3.0.0", "normalize-path": "^3.0.0",
"picomatch": "^2.0.4" "picomatch": "^2.0.4"
@ -33070,13 +33067,13 @@
"version": "2.2.0", "version": "2.2.0",
"resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz",
"integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==",
"dev": true "devOptional": true
}, },
"braces": { "braces": {
"version": "3.0.2", "version": "3.0.2",
"resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz",
"integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==",
"dev": true, "devOptional": true,
"requires": { "requires": {
"fill-range": "^7.0.1" "fill-range": "^7.0.1"
} }
@ -33085,7 +33082,7 @@
"version": "7.0.1", "version": "7.0.1",
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz",
"integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==",
"dev": true, "devOptional": true,
"requires": { "requires": {
"to-regex-range": "^5.0.1" "to-regex-range": "^5.0.1"
} }
@ -33094,14 +33091,13 @@
"version": "2.3.2", "version": "2.3.2",
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz",
"integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==",
"dev": true,
"optional": true "optional": true
}, },
"glob-parent": { "glob-parent": {
"version": "5.1.1", "version": "5.1.1",
"resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.1.tgz", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.1.tgz",
"integrity": "sha512-FnI+VGOpnlGHWZxthPGR+QhR78fuiK0sNLkHQv+bL9fQi57lNNdquIbna/WrfROrolq8GK5Ek6BiMwqL/voRYQ==", "integrity": "sha512-FnI+VGOpnlGHWZxthPGR+QhR78fuiK0sNLkHQv+bL9fQi57lNNdquIbna/WrfROrolq8GK5Ek6BiMwqL/voRYQ==",
"dev": true, "devOptional": true,
"requires": { "requires": {
"is-glob": "^4.0.1" "is-glob": "^4.0.1"
} }
@ -33110,7 +33106,7 @@
"version": "2.1.0", "version": "2.1.0",
"resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz",
"integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==",
"dev": true, "devOptional": true,
"requires": { "requires": {
"binary-extensions": "^2.0.0" "binary-extensions": "^2.0.0"
} }
@ -33119,13 +33115,13 @@
"version": "7.0.0", "version": "7.0.0",
"resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz",
"integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",
"dev": true "devOptional": true
}, },
"readdirp": { "readdirp": {
"version": "3.5.0", "version": "3.5.0",
"resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.5.0.tgz", "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.5.0.tgz",
"integrity": "sha512-cMhu7c/8rdhkHXWsY+osBhfSy0JikwpHK/5+imo+LpeasTF8ouErHrlYkwT0++njiyuDvc7OFY5T3ukvZ8qmFQ==", "integrity": "sha512-cMhu7c/8rdhkHXWsY+osBhfSy0JikwpHK/5+imo+LpeasTF8ouErHrlYkwT0++njiyuDvc7OFY5T3ukvZ8qmFQ==",
"dev": true, "devOptional": true,
"requires": { "requires": {
"picomatch": "^2.2.1" "picomatch": "^2.2.1"
} }
@ -33134,7 +33130,7 @@
"version": "5.0.1", "version": "5.0.1",
"resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
"integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==",
"dev": true, "devOptional": true,
"requires": { "requires": {
"is-number": "^7.0.0" "is-number": "^7.0.0"
} }
@ -42059,7 +42055,7 @@
"version": "2.2.2", "version": "2.2.2",
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.2.tgz", "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.2.tgz",
"integrity": "sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg==", "integrity": "sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg==",
"dev": true "devOptional": true
}, },
"pify": { "pify": {
"version": "4.0.1", "version": "4.0.1",
@ -46911,7 +46907,6 @@
"version": "2.0.1", "version": "2.0.1",
"resolved": "https://registry.npmjs.org/watchpack-chokidar2/-/watchpack-chokidar2-2.0.1.tgz", "resolved": "https://registry.npmjs.org/watchpack-chokidar2/-/watchpack-chokidar2-2.0.1.tgz",
"integrity": "sha512-nCFfBIPKr5Sh61s4LPpy1Wtfi0HE8isJ3d2Yb5/Ppw2P2B/3eVSEBjKfN0fmHJSK14+31KwMKmcrzs2GM4P0Ww==", "integrity": "sha512-nCFfBIPKr5Sh61s4LPpy1Wtfi0HE8isJ3d2Yb5/Ppw2P2B/3eVSEBjKfN0fmHJSK14+31KwMKmcrzs2GM4P0Ww==",
"dev": true,
"optional": true, "optional": true,
"requires": { "requires": {
"chokidar": "^2.1.8" "chokidar": "^2.1.8"
@ -46921,7 +46916,6 @@
"version": "2.1.8", "version": "2.1.8",
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-2.1.8.tgz", "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-2.1.8.tgz",
"integrity": "sha512-ZmZUazfOzf0Nve7duiCKD23PFSCs4JPoYyccjUFF3aQkQadqBhfzhjkwBH2mNOG9cTBwhamM37EIsIkZw3nRgg==", "integrity": "sha512-ZmZUazfOzf0Nve7duiCKD23PFSCs4JPoYyccjUFF3aQkQadqBhfzhjkwBH2mNOG9cTBwhamM37EIsIkZw3nRgg==",
"dev": true,
"optional": true, "optional": true,
"requires": { "requires": {
"anymatch": "^2.0.0", "anymatch": "^2.0.0",

7
src/components/inputField.ts

@ -77,8 +77,9 @@ export type InputFieldOptions = {
maxLength?: number, maxLength?: number,
showLengthOn?: number, showLengthOn?: number,
plainText?: true, plainText?: true,
animate?: true, animate?: boolean,
required?: boolean, required?: boolean,
canBeEdited?: boolean,
validate?: () => boolean validate?: () => boolean
}; };
@ -108,7 +109,7 @@ class InputField {
options.showLengthOn = Math.min(40, Math.round(options.maxLength / 3)); options.showLengthOn = Math.min(40, Math.round(options.maxLength / 3));
} }
const {placeholder, maxLength, showLengthOn, name, plainText} = options; const {placeholder, maxLength, showLengthOn, name, plainText, canBeEdited} = options;
let label = options.label || options.labelText; let label = options.label || options.labelText;
@ -119,7 +120,7 @@ class InputField {
} }
this.container.innerHTML = ` this.container.innerHTML = `
<div contenteditable="true" class="input-field-input"></div> <div contenteditable="${String(!!canBeEdited)}" class="input-field-input"></div>
`; `;
input = this.container.firstElementChild as HTMLElement; input = this.container.firstElementChild as HTMLElement;

49
src/components/peerProfile.ts

@ -47,9 +47,10 @@ export default class PeerProfile {
private username: Row; private username: Row;
private phone: Row; private phone: Row;
private notifications: Row; private notifications: Row;
private location: Row;
private cleaned: boolean; private cleaned: boolean;
private setBioTimeout: number; private setMoreDetailsTimeout: number;
private setPeerStatusInterval: number; private setPeerStatusInterval: number;
private peerId: PeerId; private peerId: PeerId;
@ -64,6 +65,7 @@ export default class PeerProfile {
public init() { public init() {
this.init = null; this.init = null;
this.element = document.createElement('div'); this.element = document.createElement('div');
this.element.classList.add('profile-content'); this.element.classList.add('profile-content');
@ -122,13 +124,25 @@ export default class PeerProfile {
} }
}); });
this.location = new Row({
title: ' ',
subtitleLangKey: 'AttachLocation',
icon: 'location'
});
this.notifications = new Row({ this.notifications = new Row({
checkboxField: new CheckboxField({toggle: true}), checkboxField: new CheckboxField({toggle: true}),
titleLangKey: 'Notifications', titleLangKey: 'Notifications',
icon: 'unmute' icon: 'unmute'
}); });
this.section.content.append(this.phone.container, this.username.container, this.bio.container, this.notifications.container); this.section.content.append(
this.phone.container,
this.username.container,
this.location.container,
this.bio.container,
this.notifications.container
);
this.element.append(this.section.container, generateDelimiter()); this.element.append(this.section.container, generateDelimiter());
@ -156,7 +170,7 @@ export default class PeerProfile {
rootScope.addEventListener('peer_bio_edit', (peerId) => { rootScope.addEventListener('peer_bio_edit', (peerId) => {
if(peerId === this.peerId) { if(peerId === this.peerId) {
this.setBio(true); this.setMoreDetails(true);
} }
}); });
@ -193,11 +207,12 @@ export default class PeerProfile {
this.bio.container.style.display = 'none'; this.bio.container.style.display = 'none';
this.phone.container.style.display = 'none'; this.phone.container.style.display = 'none';
this.username.container.style.display = 'none'; this.username.container.style.display = 'none';
this.location.container.style.display = 'none';
this.notifications.container.style.display = ''; this.notifications.container.style.display = '';
this.notifications.checkboxField.checked = true; this.notifications.checkboxField.checked = true;
if(this.setBioTimeout) { if(this.setMoreDetailsTimeout) {
window.clearTimeout(this.setBioTimeout); window.clearTimeout(this.setMoreDetailsTimeout);
this.setBioTimeout = 0; this.setMoreDetailsTimeout = 0;
} }
} }
@ -275,7 +290,7 @@ export default class PeerProfile {
//membersLi.style.display = appPeersManager.isBroadcast(peerId) ? 'none' : ''; //membersLi.style.display = appPeersManager.isBroadcast(peerId) ? 'none' : '';
} */ } */
this.setBio(); this.setMoreDetails();
replaceContent(this.name, new PeerTitle({ replaceContent(this.name, new PeerTitle({
peerId, peerId,
@ -290,10 +305,10 @@ export default class PeerProfile {
this.setPeerStatus(true); this.setPeerStatus(true);
} }
public setBio(override?: true) { public setMoreDetails(override?: true) {
if(this.setBioTimeout) { if(this.setMoreDetailsTimeout) {
window.clearTimeout(this.setBioTimeout); window.clearTimeout(this.setMoreDetailsTimeout);
this.setBioTimeout = 0; this.setMoreDetailsTimeout = 0;
} }
const peerId = this.peerId; const peerId = this.peerId;
@ -314,6 +329,8 @@ export default class PeerProfile {
if(userFull.rAbout && peerId !== rootScope.myId) { if(userFull.rAbout && peerId !== rootScope.myId) {
setText(userFull.rAbout, this.bio); setText(userFull.rAbout, this.bio);
} }
this.location.container.style.display = 'none';
//this.log('userFull', userFull); //this.log('userFull', userFull);
return true; return true;
@ -331,13 +348,21 @@ export default class PeerProfile {
setText(RichTextProcessor.wrapRichText(chatFull.about), this.bio); setText(RichTextProcessor.wrapRichText(chatFull.about), this.bio);
} }
// @ts-ignore
if(chatFull?.location?._ == 'channelLocation') {
// @ts-ignore
setText(RichTextProcessor.wrapRichText(chatFull.location.address), this.location);
}else{
this.location.container.style.display = 'none';
}
return true; return true;
}); });
} }
promise.then((canSetNext) => { promise.then((canSetNext) => {
if(canSetNext) { if(canSetNext) {
this.setBioTimeout = window.setTimeout(() => this.setBio(true), 60e3); this.setMoreDetailsTimeout = window.setTimeout(() => this.setMoreDetails(true), 60e3);
} }
}); });
} }

17
src/components/sidebarLeft/index.ts

@ -42,6 +42,7 @@ import { closeBtnMenu } from "../misc";
import { indexOfAndSplice } from "../../helpers/array"; import { indexOfAndSplice } from "../../helpers/array";
import ButtonIcon from "../buttonIcon"; import ButtonIcon from "../buttonIcon";
import confirmationPopup from "../confirmationPopup"; import confirmationPopup from "../confirmationPopup";
import { InputFile } from "../../layer";
export const LEFT_COLUMN_ACTIVE_CLASSNAME = 'is-left-column-shown'; export const LEFT_COLUMN_ACTIVE_CLASSNAME = 'is-left-column-shown';
@ -84,6 +85,18 @@ export class AppSidebarLeft extends SidebarSlider {
}); });
}; };
const onNewGeoGroupClick = () => {
new AppAddMembersTab(this).open({
type: 'chat',
skippable: true, // you can create geogroups without members
takeOut: (peerIds) => {
new AppNewGroupTab(this).open(peerIds, true);
},
title: 'GroupAddMembers',
placeholder: 'SendMessageTo'
});
};
const onContactsClick = () => { const onContactsClick = () => {
new AppContactsTab(this).open(); new AppContactsTab(this).open();
}; };
@ -235,6 +248,10 @@ export class AppSidebarLeft extends SidebarSlider {
icon: 'newgroup', icon: 'newgroup',
text: 'NewGroup', text: 'NewGroup',
onClick: onNewGroupClick onClick: onNewGroupClick
},{
icon: 'newgroup',
text: 'NewGeoGroup',
onClick: onNewGeoGroupClick
}, { }, {
icon: 'newprivate', icon: 'newprivate',
text: 'NewPrivateChat', text: 'NewPrivateChat',

109
src/components/sidebarLeft/tabs/newGroup.ts

@ -16,13 +16,29 @@ import AvatarEdit from "../../avatarEdit";
import { i18n } from "../../../lib/langPack"; import { i18n } from "../../../lib/langPack";
import ButtonCorner from "../../buttonCorner"; import ButtonCorner from "../../buttonCorner";
interface OpenStreetMapInterface {
place_id?: number;
license?: string;
osm_type?: string;
osm_id?: number;
lat?: string;
lon?: string;
display_name: string;
address?: object;
boundingbox?: object;
}
export default class AppNewGroupTab extends SliderSuperTab { export default class AppNewGroupTab extends SliderSuperTab {
private searchGroup = new SearchGroup(true, 'contacts', true, 'new-group-members disable-hover', false); private searchGroup = new SearchGroup(true, 'contacts', true, 'new-group-members disable-hover', false);
private avatarEdit: AvatarEdit; private avatarEdit: AvatarEdit;
private uploadAvatar: () => Promise<InputFile> = null; private uploadAvatar: () => Promise<InputFile> = null;
private peerIds: PeerId[]; private peerIds: PeerId[];
private isGeoChat: boolean = false;
private nextBtn: HTMLButtonElement; private nextBtn: HTMLButtonElement;
private groupNameInputField: InputField; private groupNameInputField: InputField;
private groupLocationInputField: InputField;
private userLocationCoords: { lat: number, long: number };
private userLocationAddress: string;
protected init() { protected init() {
this.container.classList.add('new-group-container'); this.container.classList.add('new-group-container');
@ -40,11 +56,22 @@ export default class AppNewGroupTab extends SliderSuperTab {
maxLength: 128 maxLength: 128
}); });
inputWrapper.append(this.groupNameInputField.container); this.groupLocationInputField = new InputField({
label: 'ChannelGeoGroupLocation',
name: 'location',
canBeEdited: false
});
inputWrapper.append(
this.groupNameInputField.container,
this.groupLocationInputField.container
);
this.groupNameInputField.input.addEventListener('input', () => { this.groupNameInputField.input.addEventListener('input', () => {
const value = this.groupNameInputField.value; const value = this.groupNameInputField.value;
this.nextBtn.classList.toggle('is-visible', !!value.length && !this.groupNameInputField.input.classList.contains('error')); let valueCheck = !!value.length && !this.groupNameInputField.input.classList.contains('error');
if(this.isGeoChat) valueCheck = valueCheck && !!this.userLocationCoords && !!this.userLocationAddress;
this.nextBtn.classList.toggle('is-visible', !!valueCheck);
}); });
this.nextBtn = ButtonCorner({icon: 'arrow_next'}); this.nextBtn = ButtonCorner({icon: 'arrow_next'});
@ -52,17 +79,35 @@ export default class AppNewGroupTab extends SliderSuperTab {
this.nextBtn.addEventListener('click', () => { this.nextBtn.addEventListener('click', () => {
const title = this.groupNameInputField.value; const title = this.groupNameInputField.value;
this.nextBtn.disabled = true; if(this.isGeoChat){
appChatsManager.createChat(title, this.peerIds.map(peerId => peerId.toUserId())).then((chatId) => { if(!this.userLocationAddress || !this.userLocationCoords) return;
if(this.uploadAvatar) { appChatsManager.createGeoChat(title, '', this.userLocationCoords, this.userLocationAddress).then((chatId) => {
this.uploadAvatar().then((inputFile) => { if(this.uploadAvatar) {
appChatsManager.editPhoto(chatId, inputFile); this.uploadAvatar().then((inputFile) => {
}); appChatsManager.editPhoto(chatId, inputFile);
} });
}
appSidebarLeft.removeTabFromHistory(this);
appSidebarLeft.selectTab(0); if(this.peerIds.length){
}); appChatsManager.inviteToChannel(chatId, this.peerIds);
}
appSidebarLeft.removeTabFromHistory(this);
appSidebarLeft.selectTab(0);
});
}else{
this.nextBtn.disabled = true;
appChatsManager.createChat(title, this.peerIds.map(peerId => peerId.toUserId())).then((chatId) => {
if(this.uploadAvatar) {
this.uploadAvatar().then((inputFile) => {
appChatsManager.editPhoto(chatId, inputFile);
});
}
appSidebarLeft.removeTabFromHistory(this);
appSidebarLeft.selectTab(0);
});
}
}); });
const chatsContainer = document.createElement('div'); const chatsContainer = document.createElement('div');
@ -78,14 +123,25 @@ export default class AppNewGroupTab extends SliderSuperTab {
this.avatarEdit.clear(); this.avatarEdit.clear();
this.uploadAvatar = null; this.uploadAvatar = null;
this.groupNameInputField.value = ''; this.groupNameInputField.value = '';
this.groupLocationInputField.container.classList.add('hide');
this.nextBtn.disabled = false; this.nextBtn.disabled = false;
} }
public open(peerIds: PeerId[]) { public open(peerIds: PeerId[], isGeoChat: boolean = false) {
const result = super.open(); const result = super.open();
result.then(() => { result.then(() => {
this.isGeoChat = isGeoChat;
this.peerIds = peerIds; this.peerIds = peerIds;
if(isGeoChat){
this.setTitle('NewGeoGroup');
this.groupLocationInputField.container.classList.remove('hide');
this.groupLocationInputField.setValueSilently('Locating...');
this.startLocating();
}else{
this.groupLocationInputField.container.classList.add('hide');
}
this.peerIds.forEach(userId => { this.peerIds.forEach(userId => {
let {dom} = appDialogsManager.addDialogNew({ let {dom} = appDialogsManager.addDialogNew({
dialog: userId, dialog: userId,
@ -105,4 +161,29 @@ export default class AppNewGroupTab extends SliderSuperTab {
return result; return result;
} }
private startLocating(){
navigator.geolocation.getCurrentPosition(location => {
this.userLocationCoords = {
lat: location.coords.latitude,
long: location.coords.longitude
};
let uri = "https://nominatim.openstreetmap.org/reverse";
uri += "?lat="+location.coords.latitude;
uri += "&lon="+location.coords.longitude;
uri += "&format=json";
uri += "&addressdetails=1";
uri += "&accept-language=en";
fetch(uri)
// @ts-ignore
.then((response) => response.json() as OpenStreetMapInterface)
.then(
(response: OpenStreetMapInterface) => {
this.userLocationAddress = response.display_name;
this.groupLocationInputField.setValueSilently(response.display_name);
}
);
});
}
} }

4
src/components/sidebarRight/tabs/chatType.ts

@ -6,7 +6,7 @@
import { copyTextToClipboard } from "../../../helpers/clipboard"; import { copyTextToClipboard } from "../../../helpers/clipboard";
import { randomLong } from "../../../helpers/random"; import { randomLong } from "../../../helpers/random";
import { Chat, ChatFull, ExportedChatInvite } from "../../../layer"; import { Chat, ChatFull, ExportedChatInvite, ChannelLocation } from "../../../layer";
import appChatsManager from "../../../lib/appManagers/appChatsManager"; import appChatsManager from "../../../lib/appManagers/appChatsManager";
import appProfileManager from "../../../lib/appManagers/appProfileManager"; import appProfileManager from "../../../lib/appManagers/appProfileManager";
import Button from "../../button"; import Button from "../../button";
@ -81,6 +81,8 @@ export default class AppChatTypeTab extends SliderSuperTabEventable {
} }
}); });
let uri = '';
const btnRevoke = Button('btn-primary btn-transparent danger', {icon: 'delete', text: 'RevokeLink'}); const btnRevoke = Button('btn-primary btn-transparent danger', {icon: 'delete', text: 'RevokeLink'});
attachClickEvent(btnRevoke, () => { attachClickEvent(btnRevoke, () => {

3
src/lang.ts

@ -1,4 +1,5 @@
const lang = { const lang = {
"GrantPermissions":"Grant me permissions",
"Animations": "Animations", "Animations": "Animations",
"AttachAlbum": "Album", "AttachAlbum": "Album",
"Appearance.Color.Hex": "HEX", "Appearance.Color.Hex": "HEX",
@ -231,6 +232,7 @@ const lang = {
"UsernameHelpLink": "This link opens a chat with you:\n%1$s", "UsernameHelpLink": "This link opens a chat with you:\n%1$s",
"NewChannel": "New Channel", "NewChannel": "New Channel",
"NewGroup": "New Group", "NewGroup": "New Group",
"NewGeoGroup": "New Geo-Group",
"Contacts": "Contacts", "Contacts": "Contacts",
"SavedMessages": "Saved Messages", "SavedMessages": "Saved Messages",
"Settings": "Settings", "Settings": "Settings",
@ -399,6 +401,7 @@ const lang = {
"MegaPrivateInfo": "Private groups can only be joined if you were invited or have an invite link.", "MegaPrivateInfo": "Private groups can only be joined if you were invited or have an invite link.",
"ChannelPrivateLinkHelp": "People can join your channel by following this link. You can revoke the link any time.", "ChannelPrivateLinkHelp": "People can join your channel by following this link. You can revoke the link any time.",
"MegaPrivateLinkHelp": "People can join your group by following this link. You can revoke the link any time.", "MegaPrivateLinkHelp": "People can join your group by following this link. You can revoke the link any time.",
"ChannelGeoGroupLocation":"Group location",
"RevokeButton": "Revoke", "RevokeButton": "Revoke",
"RevokeLink": "Revoke Link", "RevokeLink": "Revoke Link",
"RevokeAlert": "Are you sure you want to revoke this link? Once the link is revoked, no one will be able to join using it.", "RevokeAlert": "Are you sure you want to revoke this link? Once the link is revoked, no one will be able to join using it.",

29
src/lib/appManagers/appChatsManager.ts

@ -11,7 +11,7 @@
import DEBUG, { MOUNT_CLASS_TO } from "../../config/debug"; import DEBUG, { MOUNT_CLASS_TO } from "../../config/debug";
import { isObject, safeReplaceObject, copy, deepEqual } from "../../helpers/object"; import { isObject, safeReplaceObject, copy, deepEqual } from "../../helpers/object";
import { ChannelParticipant, Chat, ChatAdminRights, ChatBannedRights, ChatParticipant, ChatPhoto, InputChannel, InputChatPhoto, InputFile, InputPeer, Update, Updates } from "../../layer"; import { InputGeoPoint, ChannelParticipant, Chat, ChatAdminRights, ChatBannedRights, ChatParticipant, ChatPhoto, InputChannel, InputChatPhoto, InputFile, InputPeer, Update, Updates } from "../../layer";
import apiManagerProxy from "../mtproto/mtprotoworker"; import apiManagerProxy from "../mtproto/mtprotoworker";
import apiManager from '../mtproto/mtprotoworker'; import apiManager from '../mtproto/mtprotoworker';
import { RichTextProcessor } from "../richtextprocessor"; import { RichTextProcessor } from "../richtextprocessor";
@ -498,6 +498,33 @@ export class AppChatsManager {
}); });
} }
public createGeoChat(title: string, about: string, gpoint: {
lat: number,
long: number
}, address: string): Promise<ChatId> {
let geo_point = {
_: 'inputGeoPoint',
lat: gpoint['lat'],
long: gpoint['long']
} as InputGeoPoint;
// NON TOCCARE STO PEZZO MAI PIù NELLA VITA
return apiManager.invokeApi('channels.createChannel', {
megagroup: true,
title,
about,
geo_point,
address
}).then((updates) => {
apiUpdatesManager.processUpdateMessage(updates);
const channelId = (updates as any).chats[0].id;
rootScope.dispatchEvent('history_focus', {peerId: channelId.toPeerId(true)});
return channelId;
});
}
public inviteToChannel(id: ChatId, userIds: UserId[]) { public inviteToChannel(id: ChatId, userIds: UserId[]) {
const input = this.getChannelInput(id); const input = this.getChannelInput(id);
const usersInputs = userIds.map(u => appUsersManager.getUserInput(u)); const usersInputs = userIds.map(u => appUsersManager.getUserInput(u));

2
src/lib/mtproto/schema.ts

@ -36,4 +36,4 @@ export default {"MTProto":{"constructors":[{"id":481674261,"predicate":"vector",
constructorsIndex?: {[id: number]: number} constructorsIndex?: {[id: number]: number}
}, },
layer: number, layer: number,
}; };

2
src/lib/mtproto/tl_utils.ts

@ -829,4 +829,4 @@ class TLDeserialization<FetchLongAs extends Long> {
MOUNT_CLASS_TO.TLDeserialization = TLDeserialization; MOUNT_CLASS_TO.TLDeserialization = TLDeserialization;
MOUNT_CLASS_TO.TLSerialization = TLSerialization; MOUNT_CLASS_TO.TLSerialization = TLSerialization;
export { TLDeserialization, TLSerialization }; export { TLDeserialization, TLSerialization };

3
src/scripts/out/langPack.strings

@ -1,3 +1,6 @@
"GrantPermissions" = "Grant permissions"
"NewGeoGroup" = "New GeoGroup"
"ChannelGeoGroupLocation" = "Group location"
"Animations" = "Animations"; "Animations" = "Animations";
"AttachAlbum" = "Album"; "AttachAlbum" = "Album";
"BlockModal.Search.Placeholder" = "Block user..."; "BlockModal.Search.Placeholder" = "Block user...";

Loading…
Cancel
Save