Removed jsrender from vendor list and importing it as npm module
parent
cc3e9134ef
commit
0aeb64ed15
|
@ -61,13 +61,6 @@ const loader_javascript = {
|
||||||
await loader.scripts.load_multiple(["vendor/jquery/jquery.min.js"], { cache_tag: cache_tag() }, LoaderTaskCallback(taskId));
|
await loader.scripts.load_multiple(["vendor/jquery/jquery.min.js"], { cache_tag: cache_tag() }, LoaderTaskCallback(taskId));
|
||||||
}
|
}
|
||||||
|
|
||||||
await loader.scripts.load_multiple([
|
|
||||||
["vendor/jsrender/jsrender.min.js"],
|
|
||||||
], {
|
|
||||||
cache_tag: cache_tag(),
|
|
||||||
max_parallel_requests: -1
|
|
||||||
}, LoaderTaskCallback(taskId));
|
|
||||||
|
|
||||||
loader.setCurrentTaskName(taskId, "manifest");
|
loader.setCurrentTaskName(taskId, "manifest");
|
||||||
let manifest: Manifest;
|
let manifest: Manifest;
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -1369,6 +1369,14 @@
|
||||||
"integrity": "sha512-7+2BITlgjgDhH0vvwZU/HZJVyk+2XUlvxXe8dFMedNX/aMkaOq++rMAFXc0tM7ij15QaWlbdQASBR9dihi+bDQ==",
|
"integrity": "sha512-7+2BITlgjgDhH0vvwZU/HZJVyk+2XUlvxXe8dFMedNX/aMkaOq++rMAFXc0tM7ij15QaWlbdQASBR9dihi+bDQ==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"@types/jsrender": {
|
||||||
|
"version": "1.0.5",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/jsrender/-/jsrender-1.0.5.tgz",
|
||||||
|
"integrity": "sha512-Fjdp5QACaBMsd5vpx9x27rggFa0nyd8zqWnuTw8Aum4+gM/NiQubb6pweE3sgfHwrjRh7BGjYydpE4WYbsB+Ow==",
|
||||||
|
"requires": {
|
||||||
|
"jsrender": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
"@types/loader-utils": {
|
"@types/loader-utils": {
|
||||||
"version": "1.1.3",
|
"version": "1.1.3",
|
||||||
"resolved": "https://registry.npmjs.org/@types/loader-utils/-/loader-utils-1.1.3.tgz",
|
"resolved": "https://registry.npmjs.org/@types/loader-utils/-/loader-utils-1.1.3.tgz",
|
||||||
|
@ -3464,8 +3472,7 @@
|
||||||
"core-util-is": {
|
"core-util-is": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz",
|
||||||
"integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=",
|
"integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac="
|
||||||
"dev": true
|
|
||||||
},
|
},
|
||||||
"create-ecdh": {
|
"create-ecdh": {
|
||||||
"version": "4.0.3",
|
"version": "4.0.3",
|
||||||
|
@ -7189,8 +7196,7 @@
|
||||||
"inherits": {
|
"inherits": {
|
||||||
"version": "2.0.4",
|
"version": "2.0.4",
|
||||||
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
|
||||||
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
|
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
|
||||||
"dev": true
|
|
||||||
},
|
},
|
||||||
"ini": {
|
"ini": {
|
||||||
"version": "1.3.5",
|
"version": "1.3.5",
|
||||||
|
@ -7547,8 +7553,7 @@
|
||||||
"isarray": {
|
"isarray": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
|
||||||
"integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=",
|
"integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE="
|
||||||
"dev": true
|
|
||||||
},
|
},
|
||||||
"isexe": {
|
"isexe": {
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
|
@ -7694,6 +7699,25 @@
|
||||||
"verror": "1.10.0"
|
"verror": "1.10.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"jsrender": {
|
||||||
|
"version": "1.0.7",
|
||||||
|
"resolved": "https://registry.npmjs.org/jsrender/-/jsrender-1.0.7.tgz",
|
||||||
|
"integrity": "sha512-+zFdpE2/yy076rbnfGKVTom+qY3McZ6IeWK/8WAB/3O4SMel3Ad4DrW6KeNApPhRyIeH83oEl8vH8RxsrpoapA==",
|
||||||
|
"requires": {
|
||||||
|
"through2": "^3.0.1"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"through2": {
|
||||||
|
"version": "3.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/through2/-/through2-3.0.2.tgz",
|
||||||
|
"integrity": "sha512-enaDQ4MUyP2W6ZyT6EsMzqBPZaM/avg8iuo+l2d3QCs0J+6RaqkHV/2/lOwDTueBHeJ/2LG9lrLW3d5rWPucuQ==",
|
||||||
|
"requires": {
|
||||||
|
"inherits": "^2.0.4",
|
||||||
|
"readable-stream": "2 || 3"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"just-debounce": {
|
"just-debounce": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/just-debounce/-/just-debounce-1.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/just-debounce/-/just-debounce-1.0.0.tgz",
|
||||||
|
@ -9738,8 +9762,7 @@
|
||||||
"process-nextick-args": {
|
"process-nextick-args": {
|
||||||
"version": "2.0.1",
|
"version": "2.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz",
|
||||||
"integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==",
|
"integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag=="
|
||||||
"dev": true
|
|
||||||
},
|
},
|
||||||
"promise-inflight": {
|
"promise-inflight": {
|
||||||
"version": "1.0.1",
|
"version": "1.0.1",
|
||||||
|
@ -10008,7 +10031,6 @@
|
||||||
"version": "2.3.7",
|
"version": "2.3.7",
|
||||||
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz",
|
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz",
|
||||||
"integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==",
|
"integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==",
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
"requires": {
|
||||||
"core-util-is": "~1.0.0",
|
"core-util-is": "~1.0.0",
|
||||||
"inherits": "~2.0.3",
|
"inherits": "~2.0.3",
|
||||||
|
@ -10766,8 +10788,7 @@
|
||||||
"safe-buffer": {
|
"safe-buffer": {
|
||||||
"version": "5.1.2",
|
"version": "5.1.2",
|
||||||
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
|
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
|
||||||
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==",
|
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
|
||||||
"dev": true
|
|
||||||
},
|
},
|
||||||
"safe-regex": {
|
"safe-regex": {
|
||||||
"version": "1.1.0",
|
"version": "1.1.0",
|
||||||
|
@ -11747,7 +11768,6 @@
|
||||||
"version": "1.1.1",
|
"version": "1.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
|
||||||
"integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",
|
"integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
"requires": {
|
||||||
"safe-buffer": "~5.1.0"
|
"safe-buffer": "~5.1.0"
|
||||||
}
|
}
|
||||||
|
@ -12841,8 +12861,7 @@
|
||||||
"util-deprecate": {
|
"util-deprecate": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
|
||||||
"integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=",
|
"integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8="
|
||||||
"dev": true
|
|
||||||
},
|
},
|
||||||
"util.promisify": {
|
"util.promisify": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
|
|
|
@ -88,11 +88,13 @@
|
||||||
},
|
},
|
||||||
"homepage": "https://www.teaspeak.de",
|
"homepage": "https://www.teaspeak.de",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@types/jsrender": "^1.0.5",
|
||||||
"detect-browser": "^5.1.1",
|
"detect-browser": "^5.1.1",
|
||||||
"dompurify": "^2.0.8",
|
"dompurify": "^2.0.8",
|
||||||
"emoji-mart": "git+https://github.com/WolverinDEV/emoji-mart.git",
|
"emoji-mart": "git+https://github.com/WolverinDEV/emoji-mart.git",
|
||||||
"emoji-regex": "^9.0.0",
|
"emoji-regex": "^9.0.0",
|
||||||
"highlight.js": "^10.1.1",
|
"highlight.js": "^10.1.1",
|
||||||
|
"jsrender": "^1.0.7",
|
||||||
"moment": "^2.24.0",
|
"moment": "^2.24.0",
|
||||||
"react": "^16.13.1",
|
"react": "^16.13.1",
|
||||||
"react-dom": "^16.13.1",
|
"react-dom": "^16.13.1",
|
||||||
|
|
|
@ -88,14 +88,14 @@ const group_mode: GroupMode = GroupMode.PREFIX;
|
||||||
//Level Example A: <url>?log.level.trace.enabled=0
|
//Level Example A: <url>?log.level.trace.enabled=0
|
||||||
//Level Example B: <url>?log.level=0
|
//Level Example B: <url>?log.level=0
|
||||||
export function initialize(default_level: LogType) {
|
export function initialize(default_level: LogType) {
|
||||||
for(const category of Object.keys(LogCategory).map(parseInt).filter(e => !isNaN(e))) {
|
for(const category of Object.keys(LogCategory).map(e => parseInt(e)).filter(e => !isNaN(e))) {
|
||||||
const categoryName = LogCategory[category].toLowerCase();
|
const categoryName = LogCategory[category].toLowerCase();
|
||||||
enabled_mapping.set(category, settings.static_global(Settings.FN_LOG_ENABLED(categoryName), enabled_mapping.get(category)));
|
enabled_mapping.set(category, settings.static_global(Settings.FN_LOG_ENABLED(categoryName), enabled_mapping.get(category)));
|
||||||
}
|
}
|
||||||
|
|
||||||
const base_level = settings.static_global(Settings.KEY_LOG_LEVEL, default_level);
|
const base_level = settings.static_global(Settings.KEY_LOG_LEVEL, default_level);
|
||||||
|
|
||||||
for(const level of Object.keys(LogType).map(parseInt).filter(e => !isNaN(e))) {
|
for(const level of Object.keys(LogType).map(e => parseInt(e)).filter(e => !isNaN(e))) {
|
||||||
const levelName = LogType[level].toLowerCase();
|
const levelName = LogType[level].toLowerCase();
|
||||||
level_mapping.set(level, settings.static_global(Settings.FN_LOG_LEVEL_ENABLED(levelName), level >= base_level));
|
level_mapping.set(level, settings.static_global(Settings.FN_LOG_LEVEL_ENABLED(levelName), level >= base_level));
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,8 +41,6 @@ import "./ui/elements/ContextDivider";
|
||||||
import "./ui/elements/Tab";
|
import "./ui/elements/Tab";
|
||||||
import "./connection/CommandHandler"; /* else it might not get bundled because only the backends are accessing it */
|
import "./connection/CommandHandler"; /* else it might not get bundled because only the backends are accessing it */
|
||||||
|
|
||||||
const js_render = window.jsrender || $;
|
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
interface Window {
|
interface Window {
|
||||||
open_connected_question: () => Promise<boolean>;
|
open_connected_question: () => Promise<boolean>;
|
||||||
|
@ -102,32 +100,28 @@ function setup_close() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function setup_jsrender() : boolean {
|
function setup_jsrender() : boolean {
|
||||||
if(!js_render) {
|
if(!$.views) {
|
||||||
loader.critical_error("Missing jsrender extension!");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if(!js_render.views) {
|
|
||||||
loader.critical_error("Missing jsrender viewer extension!");
|
loader.critical_error("Missing jsrender viewer extension!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
js_render.views.settings.allowCode(true);
|
$.views.settings.allowCode(true);
|
||||||
js_render.views.tags("rnd", (argument) => {
|
$.views.tags("rnd", (argument) => {
|
||||||
let min = parseInt(argument.substr(0, argument.indexOf('~')));
|
let min = parseInt(argument.substr(0, argument.indexOf('~')));
|
||||||
let max = parseInt(argument.substr(argument.indexOf('~') + 1));
|
let max = parseInt(argument.substr(argument.indexOf('~') + 1));
|
||||||
|
|
||||||
return (Math.round(Math.random() * (min + max + 1) - min)).toString();
|
return (Math.round(Math.random() * (min + max + 1) - min)).toString();
|
||||||
});
|
});
|
||||||
|
|
||||||
js_render.views.tags("fmt_date", (...args) => {
|
$.views.tags("fmt_date", (...args) => {
|
||||||
return moment(args[0]).format(args[1]);
|
return moment(args[0]).format(args[1]);
|
||||||
});
|
});
|
||||||
|
|
||||||
js_render.views.tags("tr", (...args) => {
|
$.views.tags("tr", (...args) => {
|
||||||
return /* @tr-ignore */ tr(args[0]);
|
return /* @tr-ignore */ tr(args[0]);
|
||||||
});
|
});
|
||||||
|
|
||||||
$(".jsrender-template").each((idx, _entry) => {
|
$(".jsrender-template").each((idx, _entry) => {
|
||||||
if(!js_render.templates(_entry.id, _entry.innerHTML)) {
|
if(!$.templates(_entry.id, _entry.innerHTML)) {
|
||||||
log.error(LogCategory.GENERAL, tr("Failed to setup cache for js renderer template %s!"), _entry.id);
|
log.error(LogCategory.GENERAL, tr("Failed to setup cache for js renderer template %s!"), _entry.id);
|
||||||
} else
|
} else
|
||||||
log.info(LogCategory.GENERAL, tr("Successfully loaded jsrender template %s"), _entry.id);
|
log.info(LogCategory.GENERAL, tr("Successfully loaded jsrender template %s"), _entry.id);
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
//Used by CertAccept popup
|
//Used by CertAccept popup
|
||||||
|
|
||||||
|
/* setup jsrenderer */
|
||||||
|
import * as jsrenderInit from "jsrender";
|
||||||
|
const jsrender = jsrenderInit($);
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
function setInterval(handler: TimerHandler, timeout?: number, ...arguments: any[]): number;
|
function setInterval(handler: TimerHandler, timeout?: number, ...arguments: any[]): number;
|
||||||
function setTimeout(handler: TimerHandler, timeout?: number, ...arguments: any[]): number;
|
function setTimeout(handler: TimerHandler, timeout?: number, ...arguments: any[]): number;
|
||||||
|
@ -19,7 +23,6 @@ declare global {
|
||||||
|
|
||||||
type JQueryScrollType = "height" | "width";
|
type JQueryScrollType = "height" | "width";
|
||||||
interface JQuery<TElement = HTMLElement> {
|
interface JQuery<TElement = HTMLElement> {
|
||||||
render(values?: any) : string;
|
|
||||||
renderTag(values?: any) : JQuery<TElement>;
|
renderTag(values?: any) : JQuery<TElement>;
|
||||||
hasScrollBar(direction?: JQueryScrollType) : boolean;
|
hasScrollBar(direction?: JQueryScrollType) : boolean;
|
||||||
|
|
||||||
|
@ -33,7 +36,6 @@ declare global {
|
||||||
|
|
||||||
interface JQueryStatic<TElement extends Node = HTMLElement> {
|
interface JQueryStatic<TElement extends Node = HTMLElement> {
|
||||||
spawn<K extends keyof HTMLElementTagNameMap>(tagName: K): JQuery<HTMLElementTagNameMap[K]>;
|
spawn<K extends keyof HTMLElementTagNameMap>(tagName: K): JQuery<HTMLElementTagNameMap[K]>;
|
||||||
views: any;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Window {
|
interface Window {
|
||||||
|
@ -43,7 +45,6 @@ declare global {
|
||||||
readonly webkitOfflineAudioContext: typeof OfflineAudioContext;
|
readonly webkitOfflineAudioContext: typeof OfflineAudioContext;
|
||||||
readonly RTCPeerConnection: typeof RTCPeerConnection;
|
readonly RTCPeerConnection: typeof RTCPeerConnection;
|
||||||
readonly Pointer_stringify: any;
|
readonly Pointer_stringify: any;
|
||||||
readonly jsrender: any;
|
|
||||||
|
|
||||||
readonly require: typeof require;
|
readonly require: typeof require;
|
||||||
}
|
}
|
||||||
|
@ -170,7 +171,7 @@ if(typeof ($) !== "undefined") {
|
||||||
if(this.render) {
|
if(this.render) {
|
||||||
result = $(this.render(values));
|
result = $(this.render(values));
|
||||||
} else {
|
} else {
|
||||||
const template = window.jsrender.render[this.attr("id")];
|
const template = jsrender.render[this.attr("id")];
|
||||||
if(!template) {
|
if(!template) {
|
||||||
console.error("Tried to render template %o, but template is not available!", this.attr("id"));
|
console.error("Tried to render template %o, but template is not available!", this.attr("id"));
|
||||||
throw "missing template " + this.attr("id");
|
throw "missing template " + this.attr("id");
|
||||||
|
|
|
@ -6,7 +6,6 @@ import {spawnYesNo} from "tc-shared/ui/modal/ModalYesNo";
|
||||||
import {ClientEntry} from "tc-shared/ui/client";
|
import {ClientEntry} from "tc-shared/ui/client";
|
||||||
import * as log from "tc-shared/log";
|
import * as log from "tc-shared/log";
|
||||||
import * as moment from "moment";
|
import * as moment from "moment";
|
||||||
import {media_image_type} from "tc-shared/file/ImageCache";
|
|
||||||
|
|
||||||
const avatar_to_uid = (id: string) => {
|
const avatar_to_uid = (id: string) => {
|
||||||
const buffer = new Uint8Array(id.length / 2);
|
const buffer = new Uint8Array(id.length / 2);
|
||||||
|
|
|
@ -1,7 +1,3 @@
|
||||||
/// <reference path="../../ui/elements/modal.ts" />
|
|
||||||
/// <reference path="../../ConnectionHandler.ts" />
|
|
||||||
/// <reference path="../../proto.ts" />
|
|
||||||
|
|
||||||
import PermissionType from "tc-shared/permission/PermissionType";
|
import PermissionType from "tc-shared/permission/PermissionType";
|
||||||
import {ConnectionHandler} from "tc-shared/ConnectionHandler";
|
import {ConnectionHandler} from "tc-shared/ConnectionHandler";
|
||||||
import {createModal} from "tc-shared/ui/elements/Modal";
|
import {createModal} from "tc-shared/ui/elements/Modal";
|
||||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue