From 21c51548eb6f573e51c3240eaaef6dad2b5807c2 Mon Sep 17 00:00:00 2001 From: WolverinDEV Date: Wed, 5 Aug 2020 16:34:39 +0200 Subject: [PATCH] Merged all scss files directly into the app and do not load them separately --- client/css/static/main.scss | 29 ---- client/js/index.scss | 31 ++++ client/js/index.ts | 3 + file.ts | 164 +----------------- loader/app/targets/app.ts | 76 -------- package.json | 11 +- scripts/build.sh | 29 ---- shared/css/load-css.tsx | 43 +++++ shared/js/main.tsx | 1 + shared/popup/certaccept/css/static/main.scss | 66 ------- shared/popup/certaccept/html/index.php | 112 ------------ shared/popup/certaccept/js/main.ts | 68 -------- tsconfig.json | 2 +- web/.gitignore | 4 +- web/{js => app}/FileTransfer.ts | 0 web/{js => app}/audio/player.ts | 0 web/{js => app}/audio/recorder.ts | 0 web/{js => app}/audio/sounds.ts | 0 web/{js => app}/codec/BasicCodec.ts | 0 web/{js => app}/codec/Codec.ts | 0 web/{js => app}/codec/CodecRaw.ts | 0 web/{js => app}/codec/CodecWorkerMessages.ts | 0 web/{js => app}/codec/CodecWrapperWorker.ts | 0 web/{js => app}/connection.ts | 0 web/{js => app}/connection/CommandParser.ts | 0 .../connection/ServerConnection.ts | 0 .../connection/WrappedWebSocket.ts | 0 web/{js => app}/dns.ts | 0 web/app/index.scss | 39 +++++ web/app/index.ts | 5 + web/{js => app}/ppt.ts | 0 web/{js => app}/voice/AudioResampler.ts | 0 web/{js => app}/voice/VoiceClient.ts | 0 web/{js => app}/voice/VoiceHandler.ts | 0 web/{js => app}/workers/codec/CodecWorker.ts | 0 web/{js => app}/workers/codec/OpusCodec.ts | 0 web/{js => app}/workers/codec/index.ts | 0 web/css/static/main.scss | 37 ---- web/generate_packed.sh | 37 ---- web/html/.keep-alive | 0 web/js/index.ts | 6 - web/tsconfig/dtsconfig.json | 2 +- web/tsconfig/tsconfig.json | 2 +- web/tsconfig/tsconfig_packed.json | 17 -- webpack-web.config.ts | 6 +- 45 files changed, 133 insertions(+), 657 deletions(-) delete mode 100644 client/css/static/main.scss create mode 100644 client/js/index.scss create mode 100644 shared/css/load-css.tsx delete mode 100644 shared/popup/certaccept/css/static/main.scss delete mode 100644 shared/popup/certaccept/html/index.php delete mode 100644 shared/popup/certaccept/js/main.ts rename web/{js => app}/FileTransfer.ts (100%) rename web/{js => app}/audio/player.ts (100%) rename web/{js => app}/audio/recorder.ts (100%) rename web/{js => app}/audio/sounds.ts (100%) rename web/{js => app}/codec/BasicCodec.ts (100%) rename web/{js => app}/codec/Codec.ts (100%) rename web/{js => app}/codec/CodecRaw.ts (100%) rename web/{js => app}/codec/CodecWorkerMessages.ts (100%) rename web/{js => app}/codec/CodecWrapperWorker.ts (100%) rename web/{js => app}/connection.ts (100%) rename web/{js => app}/connection/CommandParser.ts (100%) rename web/{js => app}/connection/ServerConnection.ts (100%) rename web/{js => app}/connection/WrappedWebSocket.ts (100%) rename web/{js => app}/dns.ts (100%) create mode 100644 web/app/index.scss create mode 100644 web/app/index.ts rename web/{js => app}/ppt.ts (100%) rename web/{js => app}/voice/AudioResampler.ts (100%) rename web/{js => app}/voice/VoiceClient.ts (100%) rename web/{js => app}/voice/VoiceHandler.ts (100%) rename web/{js => app}/workers/codec/CodecWorker.ts (100%) rename web/{js => app}/workers/codec/OpusCodec.ts (100%) rename web/{js => app}/workers/codec/index.ts (100%) delete mode 100644 web/css/static/main.scss delete mode 100644 web/generate_packed.sh delete mode 100644 web/html/.keep-alive delete mode 100644 web/js/index.ts delete mode 100644 web/tsconfig/tsconfig_packed.json diff --git a/client/css/static/main.scss b/client/css/static/main.scss deleted file mode 100644 index 47f6a545..00000000 --- a/client/css/static/main.scss +++ /dev/null @@ -1,29 +0,0 @@ -html, body { - border: 0; - margin: 0; -} - -.app-container { - right: 0; - left: 0; - top: 0; - bottom: 0; - - width: 100%; - height: 100%; - position: absolute; - display: flex; - justify-content: stretch; - - .app { - width: 100%; - height: 100%; - margin: 0; - - display: flex; flex-direction: column; resize: both; - } -} - -footer { - display: none!important; -} \ No newline at end of file diff --git a/client/js/index.scss b/client/js/index.scss new file mode 100644 index 00000000..83105f86 --- /dev/null +++ b/client/js/index.scss @@ -0,0 +1,31 @@ +:global { + html, body { + border: 0; + margin: 0; + } + + .app-container { + right: 0; + left: 0; + top: 0; + bottom: 0; + + width: 100%; + height: 100%; + position: absolute; + display: flex; + justify-content: stretch; + + .app { + width: 100%; + height: 100%; + margin: 0; + + display: flex; flex-direction: column; resize: both; + } + } + + footer { + display: none!important; + } +} \ No newline at end of file diff --git a/client/js/index.ts b/client/js/index.ts index 6805f46c..ffc8c0c6 100644 --- a/client/js/index.ts +++ b/client/js/index.ts @@ -1,4 +1,7 @@ declare const __webpack_require__; window["shared-require"] = __webpack_require__; + +import "./index.scss"; + /* firstly assign the shared-require */ setTimeout(() => require("tc-shared/main"), 0); \ No newline at end of file diff --git a/file.ts b/file.ts index 8a9db215..e0404159 100644 --- a/file.ts +++ b/file.ts @@ -62,47 +62,6 @@ const APP_FILE_LIST_SHARED_SOURCE: ProjectResource[] = [ "path": "css/", "local-path": "./loader/css/" }, - { /* shared developer single css files */ - "type": "css", - "search-pattern": /.*\.css$/, - "build-target": "dev", - - "path": "css/", - "local-path": "./shared/css/" - }, - { /* shared css mapping files (development mode only) */ - "type": "css", - "search-pattern": /.*\.(css.map|scss)$/, - "build-target": "dev", - - "path": "css/", - "local-path": "./shared/css/", - "req-parm": ["--mappings"] - }, - { /* shared release css files */ - "type": "css", - "search-pattern": /.*\.css$/, - "build-target": "rel", - - "path": "css/", - "local-path": "./shared/generated/" - }, - { /* shared release css files */ - "type": "css", - "search-pattern": /.*\.css$/, - "build-target": "rel", - - "path": "css/loader/", - "local-path": "./shared/css/loader/" - }, - { /* shared release css files */ - "type": "css", - "search-pattern": /.*\.css$/, - "build-target": "dev|rel", - - "path": "css/theme/", - "local-path": "./shared/css/theme/" - }, { /* shared sound files */ "type": "wav", "search-pattern": /.*\.wav$/, @@ -129,17 +88,7 @@ const APP_FILE_LIST_SHARED_SOURCE: ProjectResource[] = [ } ]; -const APP_FILE_LIST_SHARED_VENDORS: ProjectResource[] = [ - { - "type": "js", - "search-pattern": /.*(\.min)?\.js$/, - "build-target": "dev|rel", - "search-exclude": /.*xbbcode.*/g, - - "path": "vendor/", - "local-path": "./vendor/" - } -]; +const APP_FILE_LIST_SHARED_VENDORS: ProjectResource[] = []; const APP_FILE_LIST_CLIENT_SOURCE: ProjectResource[] = [ { /* client css files */ @@ -172,24 +121,6 @@ const APP_FILE_LIST_WEB_SOURCE: ProjectResource[] = [ "path": "wasm/", "local-path": "./web/native-codec/generated/" }, - { /* web css files */ - "web-only": true, - "type": "css", - "search-pattern": /.*\.css$/, - "build-target": "dev|rel", - - "path": "css/", - "local-path": "./web/css/" - }, - { /* web html files */ - "web-only": true, - "type": "html", - "search-pattern": /.*\.(html)/, - "build-target": "dev|rel", - - "path": "./", - "local-path": "./web/html/" - }, { /* translations */ "web-only": true, /* Only required for the web client */ "type": "i18n", @@ -201,98 +132,6 @@ const APP_FILE_LIST_WEB_SOURCE: ProjectResource[] = [ } ]; -//FIXME: This isn't working right now -const CERTACCEPT_FILE_LIST: ProjectResource[] = [ - { /* html files */ - "type": "html", - "search-pattern": /^([a-zA-Z]+)\.(html|json)$/, - "build-target": "dev|rel", - - "path": "./popup/certaccept/", - "local-path": "./shared/popup/certaccept/html/" - }, - - { /* javascript loader (debug) */ - "type": "js", - "search-pattern": /(loader|certaccept)\.js$/, - "build-target": "dev", - - "path": "./popup/certaccept/loader/", - "local-path": "./shared/loader/" - }, - { /* javascript loader (releases) */ - "type": "js", - "search-pattern": /.*loader_certaccept.min.js$/, - "build-target": "rel", - - "path": "./popup/certaccept/loader/", - "local-path": "./shared/generated/" - }, - - { /* javascript imported from shared for debug */ - "type": "js", - "search-pattern": /^(BrowserIPC|log|proto|settings)\.js$/, - "build-target": "dev", - - "path": "./popup/certaccept/js/", - "local-path": "./shared/js/" - }, - - { /* javascript for debug */ - "type": "js", - "search-pattern": /^certaccept\.min\.js$/, - "build-target": "rel", - - "path": "./popup/certaccept/js/", - "local-path": "./shared/generated/" - }, - - { /* javascript for release */ - "type": "js", - "search-pattern": /^.*\.js$/, - "build-target": "dev", - - "path": "./popup/certaccept/js/", - "local-path": "./shared/popup/certaccept/js/" - }, - - { /* shared css files */ - "type": "css", - "search-pattern": /.*\.css$/, - "build-target": "dev|rel", - - "path": "./popup/certaccept/css/loader/", - "local-path": "./shared/css/loader/" - }, - - { /* shared css files */ - "type": "css", - "search-pattern": /.*\.css$/, - "build-target": "dev|rel", - - "path": "./popup/certaccept/css/static/", - "local-path": "./shared/popup/certaccept/css/static/" - }, - - { /* img files */ - "type": "img", - "search-pattern": /^(loading_error.*)\.(svg)$/, - "build-target": "dev|rel", - - "path": "./popup/certaccept/img/", - "local-path": "./shared/img/" - }, - - { /* jquery vendor */ - "type": "js", - "search-pattern": /^jquery\/.*\.js$/, - "build-target": "dev|rel", - - "path": "./popup/certaccept/vendor/", - "local-path": "./vendor/" - }, -]; - const CLIENT_APP_FILE_LIST = [ ...APP_FILE_LIST_SHARED_SOURCE, ...APP_FILE_LIST_SHARED_VENDORS, @@ -303,7 +142,6 @@ const WEB_APP_FILE_LIST = [ ...APP_FILE_LIST_SHARED_SOURCE, ...APP_FILE_LIST_SHARED_VENDORS, ...APP_FILE_LIST_WEB_SOURCE, - ...CERTACCEPT_FILE_LIST, ]; //@ts-ignore diff --git a/loader/app/targets/app.ts b/loader/app/targets/app.ts index 60fcbb6b..a3957961 100644 --- a/loader/app/targets/app.ts +++ b/loader/app/targets/app.ts @@ -68,76 +68,6 @@ const loader_webassembly = { } }; -const loader_style = { - load_style: async taskId => { - if(__build.mode === "debug") { - await loader_style.load_style_debug(taskId); - } else { - await loader_style.load_style_release(taskId); - } - }, - - load_style_debug: async taskId => { - await loader.style.load_multiple([ - "css/static/main.css", - "css/static/main-layout.css", - "css/static/scroll.css", - "css/static/channel-tree.css", - "css/static/ts/tab.css", - "css/static/ts/icons.css", - "css/static/ts/icons_em.css", - "css/static/ts/country.css", - "css/static/general.css", - "css/static/modal.css", - "css/static/modals.css", - "css/static/modal-about.css", - "css/static/modal-avatar.css", - "css/static/modal-icons.css", - "css/static/modal-bookmarks.css", - "css/static/modal-connect.css", - "css/static/modal-channel.css", - "css/static/modal-query.css", - "css/static/modal-latency.css", - "css/static/modal-invite.css", - "css/static/modal-banlist.css", - "css/static/modal-banclient.css", - "css/static/modal-channelinfo.css", - "css/static/modal-clientinfo.css", - "css/static/modal-serverinfo.css", - "css/static/modal-musicmanage.css", - "css/static/modal-serverinfobandwidth.css", - "css/static/modal-identity.css", - "css/static/modal-newcomer.css", - "css/static/modal-settings.css", - "css/static/modal-poke.css", - "css/static/modal-server.css", - "css/static/modal-keyselect.css", - "css/static/modal-group-assignment.css", - "css/static/overlay-image-preview.css", - "css/static/context_menu.css", - "css/static/frame-chat.css", - "css/static/connection_handlers.css", - "css/static/server-log.css", - "css/static/htmltags.css", - "css/static/hostbanner.css", - "css/static/menu-bar.css" - ], { - cache_tag: cache_tag(), - max_parallel_requests: -1 - }, LoaderTaskCallback(taskId)); - }, - - load_style_release: async taskId => { - await loader.style.load_multiple([ - "css/static/base.css", - "css/static/main.css", - ], { - cache_tag: cache_tag(), - max_parallel_requests: -1 - }, LoaderTaskCallback(taskId)); - } -}; - loader.register_task(loader.Stage.INITIALIZING, { name: "secure tester", function: async () => { @@ -165,12 +95,6 @@ loader.register_task(loader.Stage.JAVASCRIPT, { priority: 10 }); -loader.register_task(loader.Stage.STYLE, { - name: "style", - function: loader_style.load_style, - priority: 10 -}); - loader.register_task(loader.Stage.TEMPLATES, { name: "templates", function: async taskId => { diff --git a/package.json b/package.json index 745e63f8..21bd18ea 100644 --- a/package.json +++ b/package.json @@ -1,22 +1,15 @@ { - "name": "client", + "name": "teaspeak-web", "version": "1.2.0", "description": "Welcome here! This repository is created with two reasons:\n 1. People can bring their own ideas and follow their implementation\n 2. People can see TeaSpeak Web client progress and avoid creating repetitive issues all the time.", - "main": "main.js", - "directories": {}, "scripts": { - "compile-sass": "sass --update shared/css/:shared/css/ loader/css/:loader/css/ web/css/:web/css/ client/css/:client/css/ vendor/:vendor/", "compile-project-base": "tsc -p tsbaseconfig.json", "dtsgen": "node tools/dtsgen/index.js", "trgen": "node tools/trgen/index.js", - "sass": "sass", - "csso": "csso", "tsc": "tsc", "start": "npm run compile-project-base && node file.js ndevelop", "build-web": "webpack --config webpack-web.config.js", - "develop-web": "npm run compile-project-base && node file.js develop web", "build-client": "webpack --config webpack-client.config.js", - "develop-client": "npm run compile-project-base && node file.js develop client", "webpack-web": "webpack --config webpack-web.config.js", "webpack-client": "webpack --config webpack-client.config.js", "generate-i18n-gtranslate": "node shared/generate_i18n_gtranslate.js" @@ -24,6 +17,7 @@ "author": "TeaSpeak (WolverinDEV)", "license": "ISC", "devDependencies": { + "@types/jsrender": "^1.0.5", "@babel/core": "^7.10.4", "@babel/plugin-transform-runtime": "^7.10.4", "@babel/preset-env": "^7.10.4", @@ -89,7 +83,6 @@ }, "homepage": "https://www.teaspeak.de", "dependencies": { - "@types/jsrender": "^1.0.5", "detect-browser": "^5.1.1", "dompurify": "^2.0.8", "emoji-mart": "git+https://github.com/WolverinDEV/emoji-mart.git", diff --git a/scripts/build.sh b/scripts/build.sh index d3e472e7..cc4e3aec 100644 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -49,36 +49,7 @@ if [[ $_exit_code -ne 0 ]]; then exit 1 fi -echo "Generating style files" -npm run compile-sass; _exit_code=$? -if [[ $_exit_code -ne 0 ]]; then - echo "Failed to generate style files" - exit 1 -fi - -echo "Compile vendor XBBCode" -execute_tsc -p ./vendor/xbbcode/tsconfig.json; _exit_code=$? -if [[ $_exit_code -ne 0 ]]; then - echo "Failed to build the XBBCode vendor" - exit 1 -fi - -echo "Compile vendor emoji-picker" -execute_tsc ./vendor/emoji-picker/src/jquery.lsxemojipicker.ts -if [[ $_exit_code -ne 0 ]]; then - echo "Failed to build the emoji-picker vendor" - exit 1 -fi - if [[ "$build_type" == "release" ]]; then # Compile everything for release mode - echo "Packing generated css files" - chmod +x ./shared/css/generate_packed.sh - ./shared/css/generate_packed.sh; _exit_code=$? - if [[ $_exit_code -ne 0 ]]; then - echo "Failed to package generated css files" - exit 1 - fi - NODE_ENV=production npm run build-$build_target; _exit_code=$? if [[ $_exit_code -ne 0 ]]; then echo "Failed to build the $build_target applcation" diff --git a/shared/css/load-css.tsx b/shared/css/load-css.tsx new file mode 100644 index 00000000..d2fdc61b --- /dev/null +++ b/shared/css/load-css.tsx @@ -0,0 +1,43 @@ +import "!style-loader!css-loader?url=false!sass-loader?sourceMap=true!./static/properties.scss" +import "!style-loader!css-loader?url=false!sass-loader?sourceMap=true!./static/main-layout.scss" +import "!style-loader!css-loader?url=false!sass-loader?sourceMap=true!./static/general.scss" +import "!style-loader!css-loader?url=false!sass-loader?sourceMap=true!./static/channel-tree.scss" +import "!style-loader!css-loader?url=false!sass-loader?sourceMap=true!./static/connection_handlers.scss" +import "!style-loader!css-loader?url=false!sass-loader?sourceMap=true!./static/context_menu.scss" +import "!style-loader!css-loader?url=false!sass-loader?sourceMap=true!./static/frame-chat.scss" +import "!style-loader!css-loader?url=false!sass-loader?sourceMap=true!./static/server-log.scss" +import "!style-loader!css-loader?url=false!sass-loader?sourceMap=true!./static/scroll.scss" +import "!style-loader!css-loader?url=false!sass-loader?sourceMap=true!./static/hostbanner.scss" +import "!style-loader!css-loader?url=false!sass-loader?sourceMap=true!./static/htmltags.scss" +import "!style-loader!css-loader?url=false!sass-loader?sourceMap=true!./static/menu-bar.scss" +import "!style-loader!css-loader?url=false!sass-loader?sourceMap=true!./static/mixin.scss" +import "!style-loader!css-loader?url=false!sass-loader?sourceMap=true!./static/modal.scss" +import "!style-loader!css-loader?url=false!sass-loader?sourceMap=true!./static/modals.scss" +import "!style-loader!css-loader?url=false!sass-loader?sourceMap=true!./static/modal-about.scss" +import "!style-loader!css-loader?url=false!sass-loader?sourceMap=true!./static/modal-avatar.scss" +import "!style-loader!css-loader?url=false!sass-loader?sourceMap=true!./static/modal-banclient.scss" +import "!style-loader!css-loader?url=false!sass-loader?sourceMap=true!./static/modal-banlist.scss" +import "!style-loader!css-loader?url=false!sass-loader?sourceMap=true!./static/modal-bookmarks.scss" +import "!style-loader!css-loader?url=false!sass-loader?sourceMap=true!./static/modal-channel.scss" +import "!style-loader!css-loader?url=false!sass-loader?sourceMap=true!./static/modal-channelinfo.scss" +import "!style-loader!css-loader?url=false!sass-loader?sourceMap=true!./static/modal-clientinfo.scss" +import "!style-loader!css-loader?url=false!sass-loader?sourceMap=true!./static/modal-connect.scss" +import "!style-loader!css-loader?url=false!sass-loader?sourceMap=true!./static/modal-group-assignment.scss" +import "!style-loader!css-loader?url=false!sass-loader?sourceMap=true!./static/modal-icons.scss" +import "!style-loader!css-loader?url=false!sass-loader?sourceMap=true!./static/modal-identity.scss" +import "!style-loader!css-loader?url=false!sass-loader?sourceMap=true!./static/modal-newcomer.scss" +import "!style-loader!css-loader?url=false!sass-loader?sourceMap=true!./static/modal-invite.scss" +import "!style-loader!css-loader?url=false!sass-loader?sourceMap=true!./static/modal-keyselect.scss" +import "!style-loader!css-loader?url=false!sass-loader?sourceMap=true!./static/modal-poke.scss" +import "!style-loader!css-loader?url=false!sass-loader?sourceMap=true!./static/modal-query.scss" +import "!style-loader!css-loader?url=false!sass-loader?sourceMap=true!./static/modal-server.scss" +import "!style-loader!css-loader?url=false!sass-loader?sourceMap=true!./static/modal-musicmanage.scss" +import "!style-loader!css-loader?url=false!sass-loader?sourceMap=true!./static/modal-serverinfobandwidth.scss" +import "!style-loader!css-loader?url=false!sass-loader?sourceMap=true!./static/modal-serverinfo.scss" +import "!style-loader!css-loader?url=false!sass-loader?sourceMap=true!./static/modal-settings.scss" +import "!style-loader!css-loader?url=false!sass-loader?sourceMap=true!./static/overlay-image-preview.scss" + +import "!style-loader!css-loader?url=false!sass-loader?sourceMap=true!./static/ts/tab.scss" +import "!style-loader!css-loader?url=false!sass-loader?sourceMap=true!./static/ts/icons.scss" +import "!style-loader!css-loader?url=false!sass-loader?sourceMap=true!./static/ts/icons_em.scss" +import "!style-loader!css-loader?url=false!sass-loader?sourceMap=true!./static/ts/country.scss" \ No newline at end of file diff --git a/shared/js/main.tsx b/shared/js/main.tsx index 8c41ecf9..f4da9344 100644 --- a/shared/js/main.tsx +++ b/shared/js/main.tsx @@ -35,6 +35,7 @@ import {copy_to_clipboard} from "tc-shared/utils/helpers"; import ContextMenuEvent = JQuery.ContextMenuEvent; /* required import for init */ +import "../css/load-css" import "./proto"; import "./ui/elements/ContextDivider"; import "./ui/elements/Tab"; diff --git a/shared/popup/certaccept/css/static/main.scss b/shared/popup/certaccept/css/static/main.scss deleted file mode 100644 index b8c20d13..00000000 --- a/shared/popup/certaccept/css/static/main.scss +++ /dev/null @@ -1,66 +0,0 @@ -body { - position: fixed; - - top: 0; - bottom: 0; - left: 0; - right: 0; - - margin: 0; - padding: 0; - - background-color: #212529; -} - -#container-success { - height: 100%; - - display: flex; - flex-direction: column; - justify-content: stretch; - - .container { - flex-grow: 0; - flex-shrink: 0; - - align-self: center; - - color: #999999; - background-color: #19191b; - - border-radius: 5px; - overflow: hidden; - - margin: 1em; - - max-width: 80%; - width: 40em; - - .content { - padding: 1em; - - border-left: 2px solid #00d400; - - a { - display: block; - font-size: 1.2em; - } - } - } - - .spacer-top { - flex-shrink: 1; - flex-grow: 1; - - height: 10%; - min-height: 0; - } - - .spacer-bottom { - flex-shrink: 1; - flex-grow: 4; - - height: 10%; - min-height: 0; - } -} \ No newline at end of file diff --git a/shared/popup/certaccept/html/index.php b/shared/popup/certaccept/html/index.php deleted file mode 100644 index 812cda5a..00000000 --- a/shared/popup/certaccept/html/index.php +++ /dev/null @@ -1,112 +0,0 @@ - - - - - - Certificate callback - - - - - - - - - -
- -
- -
- - - -
- - -
-
-
-
-
    -
  • -
  • -
  • -
  • -
  • -
  • -
-
-
-
- - -
-
- -

-

-
-
- - -
-
- -
-
- - \ No newline at end of file diff --git a/shared/popup/certaccept/js/main.ts b/shared/popup/certaccept/js/main.ts deleted file mode 100644 index 26722822..00000000 --- a/shared/popup/certaccept/js/main.ts +++ /dev/null @@ -1,68 +0,0 @@ -import {settings, Settings} from "tc-shared/settings"; -import * as loader from "tc-loader"; -import * as log from "tc-shared/log"; -import {LogCategory} from "tc-shared/log"; -import * as bipc from "tc-shared/ipc/BrowserIPC"; - -const is_debug = false; //TODO: Sync with loader! -function tr(text: string) { return text; } - -loader.register_task(loader.Stage.JAVASCRIPT_INITIALIZING, { - name: "certificate accept tester", - function: async () => { - const certificate_accept = settings.static_global(Settings.KEY_CERTIFICATE_CALLBACK, undefined); - const container_success = $("#container-success").hide(); - - if(!certificate_accept) { - loader.critical_error(tr("Missing certificate callback data"), tr("Please reconnect manually.")); - throw "missing data"; - } - - log.info(LogCategory.IPC, tr("Using this instance as certificate callback. ID: %s"), certificate_accept); - try { - await bipc.getInstance().post_certificate_accpected(certificate_accept); - log.info(LogCategory.IPC, tr("Other instance has acknowledged out work. Closing this window.")); - - let seconds = 5; - let interval_id; - interval_id = setInterval(() => { - seconds--; - $("#time-left").text(seconds.toString()); - - if(seconds <= 0) { - clearTimeout(interval_id); - log.info(LogCategory.GENERAL, tr("Closing window")); - window.close(); - return; - } - }, 1000); - - container_success.show(); - } catch(error) { - log.warn(LogCategory.IPC, tr("Failed to successfully post certificate accept status: %o"), error); - loader.critical_error(tr("Failed to emit success!"), tr("Please reconnect manually.")); - } - }, - priority: 10 -}); - - - -loader.register_task(loader.Stage.JAVASCRIPT_INITIALIZING, { - name: "settings initialisation", - function: async () => Settings.initialize(), - priority: 200 -}); - -loader.register_task(loader.Stage.JAVASCRIPT_INITIALIZING, { - name: "bipc initialisation", - function: async () => bipc.setup(), - priority: 100 -}); - - -loader.register_task(loader.Stage.JAVASCRIPT_INITIALIZING, { - name: "log enabled initialisation", - function: async () => log.initialize(is_debug ? log.LogType.TRACE : log.LogType.INFO), - priority: 150 -}); \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json index 158df466..1919ddd8 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -12,7 +12,7 @@ "paths": { "*": ["shared/declarations/*"], "tc-shared/*": ["shared/js/*"], - "tc-backend/web/*": ["web/js/*"], /* specific web part */ + "tc-backend/web/*": ["web/app/*"], /* specific web part */ "tc-backend/*": ["shared/backend.d/*"], "tc-loader": ["loader/exports/loader.d.ts"], diff --git a/web/.gitignore b/web/.gitignore index fba37e00..dc58eb8d 100644 --- a/web/.gitignore +++ b/web/.gitignore @@ -2,8 +2,8 @@ environment/ generated/ declarations/ -css/**/*.css -css/**/*.css.map +js/**/*.css +js/**/*.css.map js/**/*.js js/**/*.js.map \ No newline at end of file diff --git a/web/js/FileTransfer.ts b/web/app/FileTransfer.ts similarity index 100% rename from web/js/FileTransfer.ts rename to web/app/FileTransfer.ts diff --git a/web/js/audio/player.ts b/web/app/audio/player.ts similarity index 100% rename from web/js/audio/player.ts rename to web/app/audio/player.ts diff --git a/web/js/audio/recorder.ts b/web/app/audio/recorder.ts similarity index 100% rename from web/js/audio/recorder.ts rename to web/app/audio/recorder.ts diff --git a/web/js/audio/sounds.ts b/web/app/audio/sounds.ts similarity index 100% rename from web/js/audio/sounds.ts rename to web/app/audio/sounds.ts diff --git a/web/js/codec/BasicCodec.ts b/web/app/codec/BasicCodec.ts similarity index 100% rename from web/js/codec/BasicCodec.ts rename to web/app/codec/BasicCodec.ts diff --git a/web/js/codec/Codec.ts b/web/app/codec/Codec.ts similarity index 100% rename from web/js/codec/Codec.ts rename to web/app/codec/Codec.ts diff --git a/web/js/codec/CodecRaw.ts b/web/app/codec/CodecRaw.ts similarity index 100% rename from web/js/codec/CodecRaw.ts rename to web/app/codec/CodecRaw.ts diff --git a/web/js/codec/CodecWorkerMessages.ts b/web/app/codec/CodecWorkerMessages.ts similarity index 100% rename from web/js/codec/CodecWorkerMessages.ts rename to web/app/codec/CodecWorkerMessages.ts diff --git a/web/js/codec/CodecWrapperWorker.ts b/web/app/codec/CodecWrapperWorker.ts similarity index 100% rename from web/js/codec/CodecWrapperWorker.ts rename to web/app/codec/CodecWrapperWorker.ts diff --git a/web/js/connection.ts b/web/app/connection.ts similarity index 100% rename from web/js/connection.ts rename to web/app/connection.ts diff --git a/web/js/connection/CommandParser.ts b/web/app/connection/CommandParser.ts similarity index 100% rename from web/js/connection/CommandParser.ts rename to web/app/connection/CommandParser.ts diff --git a/web/js/connection/ServerConnection.ts b/web/app/connection/ServerConnection.ts similarity index 100% rename from web/js/connection/ServerConnection.ts rename to web/app/connection/ServerConnection.ts diff --git a/web/js/connection/WrappedWebSocket.ts b/web/app/connection/WrappedWebSocket.ts similarity index 100% rename from web/js/connection/WrappedWebSocket.ts rename to web/app/connection/WrappedWebSocket.ts diff --git a/web/js/dns.ts b/web/app/dns.ts similarity index 100% rename from web/js/dns.ts rename to web/app/dns.ts diff --git a/web/app/index.scss b/web/app/index.scss new file mode 100644 index 00000000..496735f4 --- /dev/null +++ b/web/app/index.scss @@ -0,0 +1,39 @@ +:global { + html, body { + overflow-y: hidden; + + height: 100%; + width: 100%; + position: fixed; + } + + .app-container { + display: flex; + justify-content: stretch; + position: absolute; + + top: 1.5em!important; + bottom: 0; + + transition: all .5s linear; + + .app { + width: 100%; + height: 100%; + margin: 0; + + display: flex; flex-direction: column; resize: both; + } + } + + $small_device: 650px; + @media only screen and (max-width: $small_device) { + html, body { + padding: 0!important; + } + + .app-container { + bottom: 0; + } + } +} \ No newline at end of file diff --git a/web/app/index.ts b/web/app/index.ts new file mode 100644 index 00000000..bcd2e814 --- /dev/null +++ b/web/app/index.ts @@ -0,0 +1,5 @@ +import "webrtc-adapter"; +import "./index.scss"; +import "./FileTransfer"; + +export = require("tc-shared/main"); \ No newline at end of file diff --git a/web/js/ppt.ts b/web/app/ppt.ts similarity index 100% rename from web/js/ppt.ts rename to web/app/ppt.ts diff --git a/web/js/voice/AudioResampler.ts b/web/app/voice/AudioResampler.ts similarity index 100% rename from web/js/voice/AudioResampler.ts rename to web/app/voice/AudioResampler.ts diff --git a/web/js/voice/VoiceClient.ts b/web/app/voice/VoiceClient.ts similarity index 100% rename from web/js/voice/VoiceClient.ts rename to web/app/voice/VoiceClient.ts diff --git a/web/js/voice/VoiceHandler.ts b/web/app/voice/VoiceHandler.ts similarity index 100% rename from web/js/voice/VoiceHandler.ts rename to web/app/voice/VoiceHandler.ts diff --git a/web/js/workers/codec/CodecWorker.ts b/web/app/workers/codec/CodecWorker.ts similarity index 100% rename from web/js/workers/codec/CodecWorker.ts rename to web/app/workers/codec/CodecWorker.ts diff --git a/web/js/workers/codec/OpusCodec.ts b/web/app/workers/codec/OpusCodec.ts similarity index 100% rename from web/js/workers/codec/OpusCodec.ts rename to web/app/workers/codec/OpusCodec.ts diff --git a/web/js/workers/codec/index.ts b/web/app/workers/codec/index.ts similarity index 100% rename from web/js/workers/codec/index.ts rename to web/app/workers/codec/index.ts diff --git a/web/css/static/main.scss b/web/css/static/main.scss deleted file mode 100644 index 607c96c8..00000000 --- a/web/css/static/main.scss +++ /dev/null @@ -1,37 +0,0 @@ -html, body { - overflow-y: hidden; - - height: 100%; - width: 100%; - position: fixed; -} - -.app-container { - display: flex; - justify-content: stretch; - position: absolute; - - top: 1.5em!important; - bottom: 0; - - transition: all .5s linear; - - .app { - width: 100%; - height: 100%; - margin: 0; - - display: flex; flex-direction: column; resize: both; - } -} - -$small_device: 650px; -@media only screen and (max-width: $small_device) { - html, body { - padding: 0!important; - } - - .app-container { - bottom: 0; - } -} \ No newline at end of file diff --git a/web/generate_packed.sh b/web/generate_packed.sh deleted file mode 100644 index 03f929c1..00000000 --- a/web/generate_packed.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/usr/bin/env bash - -BASEDIR=$(dirname "$0") -cd "$BASEDIR" -source ../scripts/resolve_commands.sh - -if [[ ! -e declarations/imports_shared.d.ts ]]; then - echo "generate the declarations first!" - echo "Execute: /scripts/build_declarations.sh" - exit 1 -fi - -if [[ ! -e ../shared/generated/shared.js ]]; then - echo "generate the shared packed file first!" - echo "Execute: /shared/generate_packed.sh" - exit 1 -fi - -execute_tsc -p tsconfig/tsconfig_packed.json -if [[ $? -ne 0 ]]; then - echo "Failed to build file" - exit 1 -fi - -echo "Merging files" - -if [[ -e generated/client.js ]]; then - rm generated/client.js -fi -cat ../shared/generated/shared.js > generated/client.js -cat generated/web.js >> generated/client.js - -if [[ -e generated/client.min.js ]]; then - rm generated/client.min.js -fi - -npm run minify-web-rel-file `pwd`/generated/client.min.js `pwd`/generated/client.js \ No newline at end of file diff --git a/web/html/.keep-alive b/web/html/.keep-alive deleted file mode 100644 index e69de29b..00000000 diff --git a/web/js/index.ts b/web/js/index.ts deleted file mode 100644 index e9df636f..00000000 --- a/web/js/index.ts +++ /dev/null @@ -1,6 +0,0 @@ -const webrtc_adapter = require("webrtc-adapter"); -/* typescript keep alive */ let _x = (webrtc_adapter || "").toString(); -const tc = require("tc-shared/main"); -export = tc; - -require("./FileTransfer"); \ No newline at end of file diff --git a/web/tsconfig/dtsconfig.json b/web/tsconfig/dtsconfig.json index 638d0b08..46868df8 100644 --- a/web/tsconfig/dtsconfig.json +++ b/web/tsconfig/dtsconfig.json @@ -1,6 +1,6 @@ { "source_files": [ - "../js/**/*.ts" + "../app/**/*.ts" ], "target_file": "../declarations/exports.d.ts" } \ No newline at end of file diff --git a/web/tsconfig/tsconfig.json b/web/tsconfig/tsconfig.json index 5b5976fb..22ac81e5 100644 --- a/web/tsconfig/tsconfig.json +++ b/web/tsconfig/tsconfig.json @@ -8,6 +8,6 @@ "include": [ "../types", "../declarations/imports_*.d.ts", - "../js/**/*.ts" + "../app/**/*.ts" ] } \ No newline at end of file diff --git a/web/tsconfig/tsconfig_packed.json b/web/tsconfig/tsconfig_packed.json deleted file mode 100644 index c888a536..00000000 --- a/web/tsconfig/tsconfig_packed.json +++ /dev/null @@ -1,17 +0,0 @@ -/* packed web project config */ -{ - "extends": "./tsconfig.json", - "compilerOptions": { - "module": "none", - "outFile": "../generated/web.js", - "allowJs": true - }, - "exclude": [ - "../js/workers" - ], - "include": [ - "../types", - "../declarations/imports_*.d.ts", - "../js/**/*.ts" - ] -} \ No newline at end of file diff --git a/webpack-web.config.ts b/webpack-web.config.ts index acc024a4..0b5d5aff 100644 --- a/webpack-web.config.ts +++ b/webpack-web.config.ts @@ -3,13 +3,13 @@ import * as config_base from "./webpack.config"; export = () => config_base.config("web").then(config => { Object.assign(config.entry, { - "shared-app": "./web/js/index.ts" + "shared-app": "./web/app/index.ts" }); Object.assign(config.resolve.alias, { "tc-shared": path.resolve(__dirname, "shared/js"), - "tc-backend/web": path.resolve(__dirname, "web/js"), - "tc-backend": path.resolve(__dirname, "web/js"), + "tc-backend/web": path.resolve(__dirname, "web/app"), + "tc-backend": path.resolve(__dirname, "web/app"), "tc-generated/codec/opus": path.resolve(__dirname, "web/native-codec/generated/TeaWeb-Worker-Codec-Opus.js"), });