├── .dockerignore ├── .github └── workflows │ └── image.yml ├── .gitignore ├── CONTRIBUTING.md ├── Dockerfile ├── LICENSE ├── README.md ├── build.sh ├── codec3-arch.drawio ├── codeccli ├── cron ├── task.sh ├── update.sh └── update.sh.save ├── docs └── img │ ├── Success-Kid.png │ ├── cat1.png │ ├── cat2.png │ ├── challenge-accepted-meme.png │ ├── codec-image-preview.png │ ├── codec-markdown-preview.png │ ├── codec-wasm-preview.png │ ├── login-hover.png │ ├── login.png │ ├── one-does-not-simply.png │ └── what-if-i-told.png ├── fetch-code-server-version.js ├── package-lock.json ├── package.json ├── proxy.sh ├── scripts ├── attach.sh ├── build.sh ├── clean-pkg-mgmt-deps.sh ├── close.sh ├── cron.sh ├── defaultpass.sh ├── delete.sh ├── dev.sh ├── disable.sh ├── dockerd-process.sh ├── dockerd-stop.sh ├── dockerd.sh ├── enable.sh ├── exist.sh ├── help.sh ├── install.sh ├── logs.sh ├── pass.sh ├── passhash.sh ├── randompass.sh ├── reright.sh ├── reset.sh ├── resethash.sh ├── restartall.sh ├── setpass.sh ├── start.sh ├── stopall.sh ├── test.sh ├── uncron.sh ├── uninstall.sh ├── updateall.sh ├── users.sh └── vars.sh ├── start.sh └── system ├── bash.sh ├── bin ├── code ├── codec ├── codei ├── codepr ├── codeu ├── screen-alive ├── screenit └── sha256sum2 ├── boot.sh ├── cache.sh ├── codec.service ├── deamon.json ├── extensions.sh ├── health.sh ├── login ├── bg.jpg ├── error.css ├── error.html ├── global.css ├── login.css └── login.html ├── mods.sh ├── mods_async.sh ├── mounts.js ├── reboot.sh ├── shutdown.sh ├── skel ├── bin │ ├── allow │ ├── aptup │ ├── dockerstat │ ├── dockertop │ ├── eclean │ ├── gin │ ├── gtree │ ├── gundo │ ├── killport │ ├── latexi │ ├── map │ ├── myip │ ├── ports │ ├── sbash │ └── wttr ├── default.code-workspace ├── keybindings.json ├── mounts.json ├── settings.json └── vscode-server.yaml ├── vscode-server.yaml ├── vscode.service ├── vscode_gallery.js └── vscode_telemetry.js /.dockerignore: -------------------------------------------------------------------------------- 1 | * 2 | !system -------------------------------------------------------------------------------- /.github/workflows/image.yml: -------------------------------------------------------------------------------- 1 | name: Image 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | schedule: 8 | - cron: 10 14 * * 6 9 | 10 | jobs: 11 | test: 12 | name: Test docker image 13 | runs-on: ubuntu-20.04 14 | steps: 15 | - uses: actions/checkout@v2 16 | - name: Build docker image 17 | run: ./build.sh 18 | - name: Run built image 19 | run: ./start.sh 20 | - name: Check (max 5 times) if docker images is running 21 | run: for i in {1..10}; do docker exec --tty codec_tester env TERM=xterm docker info && break || sleep 3; done 22 | 23 | release: 24 | name: Release docker image 25 | runs-on: ubuntu-20.04 26 | needs: test 27 | steps: 28 | - name: Set up QEMU 29 | uses: docker/setup-qemu-action@v1 30 | 31 | - name: Set up docker buildx 32 | uses: docker/setup-buildx-action@v1 33 | 34 | - name: Login to docker hub 35 | uses: docker/login-action@v1 36 | with: 37 | username: ${{ secrets.DOCKER_HUB_USERNAME }} 38 | password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} 39 | 40 | - name: Build and push (latest|docker-hub) 41 | uses: docker/build-push-action@v2 42 | with: 43 | push: true 44 | tags: ${{ github.repository }}:latest 45 | 46 | - name: Build and push (commit-hash|docker-hub) 47 | uses: docker/build-push-action@v2 48 | with: 49 | push: true 50 | tags: ${{ github.repository }}:${{ github.sha }} 51 | 52 | - run: docker logout 53 | 54 | - name: Login to DockerHub 55 | uses: docker/login-action@v1 56 | with: 57 | registry: docker.pkg.github.com 58 | username: ${{ GITHUB.ACTOR }} 59 | password: ${{ GITHUB.TOKEN }} 60 | 61 | - name: Build and push (latest|docker-hub) 62 | uses: docker/build-push-action@v2 63 | with: 64 | tags: ${{ GITHUB.REPOSITORY }}:latest 65 | 66 | - name: Build and push (commit-hash|docker-hub) 67 | uses: docker/build-push-action@v2 68 | with: 69 | tags: ${{ GITHUB.REPOSITORY }}:${{ GITHUB.SHA }} 70 | 71 | - run: docker logout 72 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .store 2 | codec-data 3 | 4 | node_modules 5 | !.keep 6 | !.gitkeep 7 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | We welcome contributions from the community to help improve this project. 4 | Your input is valuable to us. 5 | 6 | You can contribute to the project in the following ways: 7 | 8 | ### **Create Issues** 9 | Feel free to create issues for: 10 | - feature requests, 11 | - bug fixes, 12 | - documentation improvements, 13 | - test cases, 14 | - general questions, 15 | - or any recommendations you may have. 16 | ### **Merge Requests** 17 | Please avoid multiple different changes in one merge request. 18 | 1. **Fork** the repository, 19 | 2. **commit and push** your changes, 20 | 3. and submit your **merge request**: 21 | - with a clear explanation of the changes you've made, 22 | - and a note with your thoughts about your tests. 23 | 24 | There are many reasons for submitting a merge request: 25 | - Fixing bugs, 26 | - implement new features, 27 | - improve documentation, 28 | - and adding tests. 29 | 30 | ## Rules for Contributions 31 | 32 | To ensure a smooth contribution process, please follow the rules below: 33 | 34 | - **License Awareness**: Be aware of and check the LICENSE file before contributing to understand the project's licence terms. 35 | - **Respect the Licence Terms**: Ensure that your contributions comply with the project's license terms. 36 | - **Avoid Plagiarism**: Do not plagiarise code or content from other sources. All contributions should be original work or properly attributed. 37 | - **Platform Rules** Also be sure to follow the rules of the provider and the platform. 38 | 39 | ## Thank you 40 | A big thank you, for considering a contribution. 41 | If anything is unclear, please contact us via a issue with your question. 42 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:24.04 2 | 3 | LABEL version="2.9" maintainer="NobleMajo (Majo Richter) " 4 | 5 | EXPOSE 8080/tcp 6 | 7 | ENV NVM_VERSION "0.40.1" 8 | ENV NVM_URL "https://raw.githubusercontent.com/nvm-sh/nvm/v$NVM_VERSION/install.sh" 9 | ENV NODE_VERSION "22" 10 | ENV NPM_VERSION "10" 11 | ENV NODEMON_VERSION "3" 12 | ENV VSCODE_VERSION "4.97.2" 13 | ENV VSCODE_URL "https://code-server.dev/install.sh" 14 | 15 | ENV VSCODE_GALLERY "os" 16 | ENV NVM_DIR "/root/.nvm" 17 | ENV DEBIAN_FRONTEND noninteractive 18 | ENV LANG "en_US.UTF-8" 19 | ENV LANGUAGE "en" 20 | ENV LC_CTYPE "en_US.UTF-8" 21 | ENV LC_NUMERIC "en_US.UTF-8" 22 | ENV LC_TIME "en_US.UTF-8" 23 | ENV LC_COLLATE "en_US.UTF-8" 24 | ENV LC_MONETARY "en_US.UTF-8" 25 | ENV LC_MESSAGES "en_US.UTF-8" 26 | ENV LC_PAPER "en_US.UTF-8" 27 | ENV LC_NAME "en_US.UTF-8" 28 | ENV LC_ADDRESS "en_US.UTF-8" 29 | ENV LC_TELEPHONE "en_US.UTF-8" 30 | ENV LC_MEASUREMENT "en_US.UTF-8" 31 | ENV LC_IDENTIFICATION "en_US.UTF-8" 32 | ENV LC_ALL "en_US.UTF-8" 33 | ENV L "us" 34 | 35 | RUN sed -i "s/# deb-src/deb-src/g" /etc/apt/sources.list \ 36 | && apt-get update \ 37 | && echo 'tzdata tzdata/Areas select Etc' | debconf-set-selections \ 38 | && echo 'tzdata tzdata/Zones/Etc select UTC' | debconf-set-selections \ 39 | && apt-get install -yq --no-install-recommends \ 40 | apt-utils dbus locales tzdata libtimedate-perl ca-certificates \ 41 | && sed -i "s/# en_US.UTF-8/en_US.UTF-8/" /etc/locale.gen \ 42 | && locale-gen \ 43 | && apt-get full-upgrade -y \ 44 | \ 45 | && apt-get install -y --no-install-recommends \ 46 | sudo bash adduser systemctl lbzip2 locales lsof \ 47 | && apt-get install -y --no-install-recommends \ 48 | curl wget tar git nano vim git-lfs \ 49 | && apt-get install -y --no-install-recommends \ 50 | screen systemd systemd-cron rsyslog dnsutils \ 51 | && git lfs install \ 52 | && cd /lib/systemd/system/sysinit.target.wants/ \ 53 | && ls | grep -v systemd-tmpfiles-setup | xargs rm -f $1 \ 54 | && rm -f \ 55 | /lib/systemd/system/multi-user.target.wants/* \ 56 | /etc/systemd/system/*.wants/* \ 57 | /lib/systemd/system/local-fs.target.wants/* \ 58 | /lib/systemd/system/sockets.target.wants/*udev* \ 59 | /lib/systemd/system/sockets.target.wants/*initctl* \ 60 | /lib/systemd/system/basic.target.wants/* \ 61 | /lib/systemd/system/anaconda.target.wants/* \ 62 | /lib/systemd/system/plymouth* \ 63 | /lib/systemd/system/systemd-update-utmp* \ 64 | /lib/systemd/system/systemd*udev* \ 65 | /lib/systemd/system/getty.target \ 66 | && apt-get autoremove -y \ 67 | && apt-get clean \ 68 | && apt-get autoclean \ 69 | && rm -rf \ 70 | /var/lib/apt/lists/* \ 71 | /var/cache/apk/* \ 72 | /tmp/* 73 | 74 | COPY system /etc/codec 75 | 76 | RUN curl -o- $NVM_URL |bash \ 77 | && [ -s "$NVM_DIR/nvm.sh" ] \ 78 | && . "$NVM_DIR/nvm.sh" \ 79 | && . "$NVM_DIR/bash_completion" \ 80 | && npm i -g npm@$NPM_VERSION \ 81 | && npm i -g nodemon@$NODEMON_VERSION \ 82 | && chmod 775 /etc/environment \ 83 | && echo -n "PATH=\"/codec/.codec/bin:$PATH\"" > /etc/environment \ 84 | \ 85 | && curl -fsSL $VSCODE_URL | sh -s -- --version=$VSCODE_VERSION \ 86 | && systemctl disable code-server@root \ 87 | \ 88 | && cp /etc/codec/bin/* /usr/local/bin/ \ 89 | && mkdir -p /etc/docker \ 90 | && cp /etc/codec/deamon.json /etc/docker/daemon.json \ 91 | && mkdir -p /usr/lib/systemd/system/ \ 92 | && cp /etc/codec/codec.service /usr/lib/systemd/system/ \ 93 | && cp /etc/codec/vscode.service /usr/lib/systemd/system/ \ 94 | && systemctl enable codec.service \ 95 | && . /etc/environment \ 96 | && VSCODE_GALLERY="$VSCODE_GALLERY" /etc/codec/vscode_gallery.js \ 97 | && codei emmanuelbeziat.vscode-great-icons \ 98 | \ 99 | && /etc/codec/health.sh \ 100 | \ 101 | && echo "source /etc/codec/bash.sh" >> /root/.bashrc \ 102 | && usermod --shell /bin/bash root \ 103 | && echo fs.inotify.max_user_watches=262144 | tee -a /etc/sysctl.conf \ 104 | && sysctl -p \ 105 | \ 106 | && npm cache clean --force \ 107 | && apt-get autoremove -y \ 108 | && apt-get clean \ 109 | && apt-get autoclean \ 110 | && rm -rf \ 111 | /var/lib/apt/lists/* \ 112 | /var/cache/apk/* \ 113 | /tmp/* 114 | 115 | CMD ["/lib/systemd/systemd"] 116 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 NobleMajo 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | # codec ( [deprecated](#deprecated) ) 3 | ![MIT](https://img.shields.io/badge/license-MIT-blue.svg) 4 | ![](https://img.shields.io/badge/dynamic/json?color=green&label=watchers&query=watchers&suffix=x&url=https%3A%2F%2Fapi.github.com%2Frepos%2Fnoblemajo%2Fcodec) 5 | ![](https://img.shields.io/badge/dynamic/json?color=yellow&label=stars&query=stargazers_count&suffix=x&url=https%3A%2F%2Fapi.github.com%2Frepos%2Fnoblemajo%2Fcodec) 6 | ![](https://img.shields.io/badge/dynamic/json?color=orange&label=subscribers&query=subscribers_count&suffix=x&url=https%3A%2F%2Fapi.github.com%2Frepos%2Fnoblemajo%2Fcodec) 7 | ![](https://img.shields.io/badge/dynamic/json?color=navy&label=forks&query=forks&suffix=x&url=https%3A%2F%2Fapi.github.com%2Frepos%2Fnoblemajo%2Fcodec) 8 | ![](https://img.shields.io/badge/dynamic/json?color=darkred&label=open%20issues&query=open_issues&suffix=x&url=https%3A%2F%2Fapi.github.com%2Frepos%2Fnoblemajo%2Fcodec) 9 | 10 | # table of contents 11 | - [codec](#codec) 12 | - [table of contents](#table-of-contents) 13 | - [about](#about) 14 | - [deprecated](#deprecated) 15 | - [base](#base) 16 | - [Installation](#installation) 17 | - [Requirements](#requirements) 18 | - [Clone](#clone) 19 | - [Provider CLI](#provider-cli) 20 | - [Proxy setup](#proxy-setup) 21 | - [Startup](#startup) 22 | - [Components](#components) 23 | - [CLI](#cli) 24 | - [Proxy](#proxy) 25 | - [Image](#image) 26 | - [Mods](#mods) 27 | - [Mounts](#mounts) 28 | - [folder structure](#folder-structure) 29 | - [User FS](#user-fs) 30 | - [System FS](#system-fs) 31 | - [Preview](#preview) 32 | - [Codec v1](#codec-v1) 33 | - [v1 Software](#v1-software) 34 | - [v1 folder structure](#v1-folder-structure) 35 | - [v1 Problems](#v1-problems) 36 | - [v2.0.0 changes](#v200-changes) 37 | - [contribution](#contribution) 38 | 39 | # about 40 | CodeC is a containerized web-based Multi-User VS-Code like development environment based on coder/code-server, Docker, Ubuntu and a lot of CLI, Control and Setup Bash Scripts. 41 | 42 | The CodeC environment consists of several software components, all of which work together to create a complete environment for the users. 43 | 44 | This `README.md` that you read right now is written in a CodeC environment: 45 | ![Makrdown](./docs/img/codec-markdown-preview.png) 46 | 47 | # deprecated 48 | New features for this software will not be developed and support will be discontinued. 49 | Today, the developer of this software would choose a completely different conceptual approach for the software. 50 | 51 | # base 52 | 53 | CodeC is based on the following Software: 54 | | Software | Description | 55 | | ------------ | -------------------------------------------------------------------------------- | 56 | | Code-Server | VS-Code in web by [Coder](https://github.com/coder/code-server) | 57 | | Ubuntu | The Ubuntu Docker Image on [hub.docker.com](https://hub.docker.com/_/ubuntu) | 58 | | Docker | The Image is based on and tested with [Docker](https://www.docker.com) | 59 | | Bash scripts | The own CodeC Provider and User CLI Tools and the Setup Scripts are Bash scripts | 60 | | More... | Take a look at the `Dockerfile` | 61 | 62 | # Installation 63 | If you want to use CodeC here is the installation guide. 64 | Please note that the CodeC is under development, may have some security issues and the CodeC provider (the person who installs and/or hosts the codec) is responsible for bugs, risks and problems. 65 | 66 | ## Requirements 67 | 68 | ![One does not simply do that job](./docs/img/one-does-not-simply.png) 69 | 70 | | Required | Explanation | 71 | | --------- | ----------------------------------------------------------------------------------------------------------- | 72 | | ubuntu os | Tested with `20.04`. Should also work with `16.04` and newer. | 73 | | docker | Working Docker CLI Tools. | 74 | | sudo | Root privileges and `sudo installed`. For Docker and changes to user data managed by CodeC user containers. | 75 | | git | To clone and update the repository. | 76 | 77 | 78 | ## Clone 79 | 80 | 81 | ```bash 82 | git clone git@github.com:NobleMajo/codec.git codec 83 | ``` 84 | 85 | ## Provider CLI 86 | ```bash 87 | cd codec 88 | ./codeccli install # installs the CodeC CLI tool 89 | codeccli help # check the CLI installation 90 | codeccli build # triggers the build of the CodeC container image 91 | ``` 92 | 93 | ## Proxy setup 94 | Use the following commands to start a simple `CProX` proxy server for the wildcard domain `*.codec.example.com`. 95 | 96 | ### Secure 97 | ```bash 98 | docker run \ 99 | -v /path/to/certs:/app/certs \ 100 | -e CERT_PATH="/app/certs" \ 101 | -e CERT_NAME="cert1.pem" \ 102 | -e KEY_NAME="privkey1.pem" \ 103 | -e CA_NAME="fullchain1.pem" \ 104 | -e VERBOSE="true" \ 105 | --network="codec_net" \ 106 | -p 80:80 \ 107 | -p 443:443 \ 108 | noblemajo/cprox \ 109 | *.codec.example.com=PROXY:http://codec_{-4}:8080 110 | ``` 111 | ### Unsecure 112 | For an HTTP-only proxy, use the following command instead: 113 | ```bash 114 | docker run \ 115 | -e HTTP_PORT="80" \ 116 | -e VERBOSE="true" \ 117 | --network="codec_net" \ 118 | -p 80:80 \ 119 | noblemajo/cprox \ 120 | *.codec.example.com=PROXY:http://codec_{-4}:8080 121 | ``` 122 | 123 | ### Proxy Configuration 124 | Here is the `CProx` Proxy Dokumentation: 125 | [https://github.com/noblemajo/cprox](https://github.com/noblemajo/cprox) 126 | 127 | In the above commands, the `{-4}` is the wildcard index and defines the names of the user containers in the subdomains. 128 | Some examples: 129 | - `*.codec.example.com` = `PROXY:http://codec_{-4}:8080` 130 | - `*.codec.test.example.com` = `PROXY:http://codec_{-5}:8080` 131 | - `*.example.com` = `PROXY:http://codec_{-3}:8080` 132 | - `*.codec.test.intern.example.com` = `PROXY:http://codec_{-6}:8080` 133 | 134 | ## Startup 135 | Now you are ready to start a CodeC container! 136 | 137 | ![CodeC works](./docs/img/Success-Kid.png) 138 | 139 | Here is a explaination how to use the `codeccli start` to start a CodeC user container: 140 | [codeccli start](#start) 141 | 142 | 143 | 144 | # Components 145 | CodeC is a containerized development environment that is built using different software components to create a unified environment. 146 | 147 | ## CLI 148 | The CodeC CLI, also known as `codeccli`, is a provider CLI that allows a CodeC provider to control CodeC user containers on a host by starting or stopping them, modifying passwords, building or updating, and more. 149 | 150 | ### start 151 | 152 | ![One does not simply do that job](./docs/img/cat1.png) 153 | 154 | To start or restart a CodeC user container, use the following command: 155 | 156 | ```bash 157 | codeccli start 158 | ``` 159 | 160 | Additional options for the start command include: 161 | - `--not-privileged/-n`: Disables privileged mode for the user CodeC Docker container for `more security` and does not allow the user to use Docker in Docker. To use docker in a CodeC instance also read about the CodeC [docker mod](#mod-docker). 162 | - `--mount-sock/-s`: Mounts the Docker socket to the starting container to `allow access to the host Docker containers`, system, and ports. 163 | - `--read-only/-r`: Starts the container in read-only mode. CodeC is `not built to run in read-only mode`, but the option is available anyways. 164 | - `--force/-f`: Dont ask the user if the container really should be started. 165 | 166 | *The flags and arguments that are used will be stored for the next startup of the user except `-f` and the user name.* 167 | 168 | After the start the container opens the code-server on port 8080. 169 | You can access the code-server just with a configured proxy server. 170 | 171 | Login using the given password of the `codeccli` command or change it: 172 | ![Login Hover](./docs/img/login-hover.png) 173 | 174 | ### pass 175 | Change the password of an existing users: 176 | ```bash 177 | codeccli pass 178 | ``` 179 | 180 | ### build 181 | The following command builds the CodeC docker image. Since the build script is executed when the start command is used, the command usually does not need to be used. 182 | ```bash 183 | codeccli build 184 | ``` 185 | 186 | Additional options for the start command include: 187 | - `--scratch/-s`: Build the image from scratch. That can take a few minutes. 188 | 189 | ### list 190 | Show a list of all existing container users: 191 | ```bash 192 | codeccli list 193 | ``` 194 | 195 | ### logs 196 | Show the systemd and CodeC service logs of an existing and running user container: 197 | ```bash 198 | codeccli logs 199 | ``` 200 | 201 | ### close 202 | Stop and remove an existing container: 203 | ```bash 204 | codeccli close 205 | ``` 206 | 207 | ### reset 208 | (This command will not delete the persisted user data except the user CodeC configuration in the listed folders below)* 209 | 210 | Reset all files in /codec/mounts and /codec/.codec of an existing container: 211 | ```bash 212 | codeccli reset 213 | ``` 214 | 215 | ### delete 216 | Delete all peristend CodeC user files and configurations: 217 | ```bash 218 | codeccli delete 219 | ``` 220 | 221 | ## Proxy 222 | As CodeC Proxy you can use any proxy that can proxy the requests to the user container the right way. 223 | 224 | ![One does not simply do that job](./docs/img/what-if-i-told.png) 225 | 226 | We recommend to use [CProX](https://github.com/noblemajo/cprox), because it provides a working and easy to use/setup proxy functionality. 227 | In the [installation guide](#proxy-setup), you can view how to use CProX as CodeC Proxy server. 228 | 229 | A CodeC Proxy provides users the access to their own container via their own hostname (`sub domain`). 230 | For example, if the CodeC is running under the wildcard subdomain `*.codec.example.com`, the user `foobar` gets access their oen CodeC instance vie the hostname `foobar.codec.example.com`. 231 | The proxy server determines which container to proxy the incoming HTTP requests to based on the host. 232 | For that, the proxy server needs to be in the same docker network as the CodeC container instances. 233 | 234 | A proxy server is necessary to publish all CodeC containers http web server ports via the same tcp port (80/443). 235 | 236 | ## Image 237 | In the context of CodeC, the image refers to the Docker image from which all CodeC user containers are started. The image is based on one of the newest Ubuntu versions (often LTS) and includes various development tools like: `NPM`, `Node.js`, `Git`, the `code-server` (vs-code web abstraction built by [Coder](https://github.com/coder/code-server)). 238 | 239 | Additionally, it contains some persistent scripts that adapt all files to the CodeC persistence behavior. 240 | Each user gets one running CodeC container instance based on the CodeC Docker image. 241 | 242 | The blueprint for the image is in the `Dockerfile` and can be built by the `codeccli` [build](#build) command. 243 | 244 | ### Persistence 245 | 246 | Instead of storing all the data on disk, which would take up a lot of storage space for each Codec user, Codec just stores one folder (`/codec`) that persists across container restarts. 247 | 248 | This way the codec provider dont needs to store a huge amount of data, but the user needs to organize their persistent data. 249 | 250 | To manage the persistent data accross the maschine the user can use [Mods](#mods) and [Mounts](#mounts). 251 | 252 | ### Instance 253 | In the CodeC environment, a CodeC container instance refers to a running Docker container based on the CodeC Docker image and started by the CodeC CLI-Tool. 254 | Each instance is running for one or more users that share one password to access the instance. 255 | The user can customize the instance with CodeC [Mods](#mods), CodeC [Mounts](#mounts) and build in configuration files. 256 | 257 | ### User CLI 258 | The `codec` command is the CodeC-User-CLI Tools that users can use in the CodeC instance in their terminal. 259 | They can use the tool to restart their own container, change passwords, and make other settings, such as enabling and disabling Mods. 260 | 261 | #### restart 262 | Restart the current user instance: 263 | ``` 264 | codec -r 265 | ``` 266 | 267 | The command above will restart the whole instance. 268 | If `just the code server` makes trouble, the user can alse perform a fast restart: 269 | ``` 270 | codec -fd 271 | ``` 272 | 273 | #### password 274 | Change the user's password of the login of the current instance: 275 | ``` 276 | codec -i 277 | ``` 278 | 279 | #### help 280 | ``` 281 | codec -h 282 | ``` 283 | 284 | #### mod cli 285 | Enable CodeC Mods: 286 | ``` 287 | codec modon 288 | ``` 289 | Disable CodeC Mods: 290 | ``` 291 | codec modon 292 | ``` 293 | 294 | After the state of a Mod has changed you can perform a container restart to make the change take effect. 295 | By disabling a Mod, the apt/npm/package-manager dependencies, configurations and changes will not immediately take effect. 296 | 297 | ![One does not simply do that job](./docs/img/cat2.png) 298 | Also take a look how to code [own Mods](#custom-mod). 299 | 300 | #### clear cache 301 | Clears some cache files in the codec instance: 302 | ``` 303 | codec -cc 304 | ``` 305 | 306 | #### free disk space 307 | Frees up some disk space in emergency situations if the disk runs out of space: 308 | ``` 309 | codec -fd 310 | ``` 311 | 312 | ## Mods 313 | CodeC provides users with the ability to customize their experience with the use of `Mods`. 314 | Mods are custom Bash scripts that can be created and `adjusted by users` to alter their CodeC experience. 315 | Mods can be used to make changes that range from minor modifications to full-scale adjustments. 316 | They are intended to provide flexibility and allow users to customize their environment to their liking. 317 | 318 | #### Mod Folders 319 | The CodeC Mods are located in the `/codec/.codec/mods` directory inside the user's codec container. 320 | CodeC already provides a set of predefined Mods, 321 | where some of them are ready to be used and some of them are just examples that need to be adjusted in order to be used. 322 | 323 | ##### Mod Status 324 | Enabled Mods are in the `/codec/.codec/enabled-mods` folder inside the user's persistent codec folder. 325 | 326 | If you use the `codeccli` to enable a Mod the Mod Bash scripts get symlinked from the `mods` folder into the `enabled-mods` folder. 327 | 328 | If you disable the Mod all scripts/symlinks of the Mod in the `/codec/.codec/enabled-mods` folder get deleted. 329 | 330 | You can find the mod commands in the [mod cli](#mod-cli) part. 331 | 332 | #### Custom Mod 333 | 334 | ![One does not simply do that job](./docs/img/challenge-accepted-meme.png) 335 | 336 | The Mods can be created by writing minimum one Bash script that follows a specific naming convention and placing it in the appropriate directory. 337 | There are four types of Mod scripts available: 338 | - `.env.sh`, 339 | - `.boot.sh`, 340 | - `.async.sh` and 341 | - `.bash.sh`. 342 | 343 | All Bash scripts with the same `` are automatically count as one CodeC Mod. 344 | 345 | Here is an table that explains the Mod script types: 346 | | Type | Processing | Delay container startup | Delay bash startup | Script Name | 347 | | ----- | ---------- | ----------------------- | ------------------ | -------------------- | 348 | | ENV | `sync` | `yes` | `no` | `.env.sh` | 349 | | BOOT | `sync` | `yes` | `no` | `.boot.sh` | 350 | | ASYNC | `async` | `no` | `no` | `.async.sh` | 351 | | BASH | `semi` | `no` | `yes` | `.bash.sh` | 352 | 353 | #### Environment Mod Script 354 | Environment scripts in CodeC are bash scripts that are executed at the boot of the container after each other. These scripts are located in the `/codec/.codec/mods` directory and `.env.sh` is the mandatory defined naming that must be used. 355 | The purpose of these scripts is to install apt and npm packages and to change the configuration of tools that are used in the following boot scripts. 356 | The environment scripts delay the start of the CodeC web server until they finish executing. 357 | In the environment script, you can define apt and npm packages that should be installed using the following syntax: 358 | ```bash 359 | export CODEC_NPM_PACKAGES="typescript" 360 | export CODEC_APT_PACKAGES="nano" 361 | ``` 362 | All defined apt and npm packages will be collected and installed after all environment scripts are finished. In addition to installing packages, environment scripts can be used to add apt repositories or configure npm and apt, among other things. 363 | Overall, environment scripts provide a way to customize and prepare the environment before the container and the boot scrips starts up. 364 | 365 | #### Boot Mod Script 366 | The CodeC Boot scripts are executed at the boot of the container after each other. These scripts are used to perform tasks that cannot be run in parallel with other tasks, such as preparing some applications. 367 | `.boot.sh` is the mandatory defined naming that must be used. 368 | 369 | During the Boot-script phase, the environment scripts have already been run, and any apt and npm packages defined there have already been installed. Therefore, the Boot-scripts can assume that these packages are available for use. 370 | 371 | One important aspect of the Boot-scripts is that they delay the start of the CodeC webserver until the scripts have finished executing. This ensures that any necessary preparations have been completed before the webserver starts serving requests. 372 | 373 | Overall, Boot-scripts are an important part of the CodeC container environment, allowing for synchronization tasks and other necessary preparations to be performed before the webserver starts serving requests. 374 | 375 | #### Async Mod Script 376 | Async scripts are scripts that are executed after the boot scripts of the CodeC container and after the code-server webserver is available. 377 | `.async.sh` is the mandatory defined naming that must be used. 378 | 379 | These scripts can be used to execute tasks that can run in parallel, such as installing additional packages, running tests, or performing other initialization tasks. 380 | The Async-scripts do not delay the start of the CodeC webserver because they are executed after the webserver has already started. 381 | 382 | If there are tasks in the Boot scripts that can run in parallel with other tasks, they should be moved to the Async-scripts to decrease the container startup time and install all apps faster. 383 | This can help speed up the initialization process and reduce the overall time it takes for the container to become fully operational. 384 | 385 | #### Bash Mod Script 386 | Bash scripts are executed when a bash shell is initialized. They delay the startup of a bash terminal or shell for the user, allowing tasks that should run at initialization of a bash shell to be executed. 387 | `.bash.sh` is the mandatory defined naming that must be used. 388 | 389 | These scripts are typically used to set environment variables, aliases, or functions that should be available when the user opens a bash terminal or shell. 390 | For example, if a user wants to set a specific `$PATH` for a project they are working on, they can add the necessary export statements to the Bash script. 391 | 392 | All enabled mod's Bash scripts run `synchronized` after each other. However, if the user starts a `second bash shell` or an `async script is still executed` in parallel, then the Bash script will run `in parallel` to these scripts. 393 | 394 | The Bash-scripts do not delay the start of the CodeC webserver because they are executed after the webserver has already started. 395 | 396 | Overall, Bash scripts are a powerful tool for configuring the user's environment and automating common tasks that need to be executed when a bash terminal or shell is initialized. 397 | 398 | ### Example Mod 399 | Here is some examples that explain how the script types are used in different mods: 400 | 401 | - ##### Mod: `starship` 402 | StarShip Shell is the minimal, blazing fast, and extremely customizable prompt for any shell! 403 | - `Boot`: Installation via CURL 404 | - `Bash`: Inizialization of StarShip in users prompt 405 | - ##### Mod: `devtools` 406 | Some commonly used developments tools. 407 | - `Env`: Defines API Packages to install 408 | - `Async`: Enables the ssh agent via systemctl 409 | - ##### Mod: `unmin` 410 | Installes `man` and unminifies and installes the ubuntu documentation that is normally not included in the ubuntu docker image. 411 | - `Env`: Installs the `man` apt package 412 | - `Async`: Executes the long taking unminify process 413 | - ##### Mod: `git` 414 | Git is a version control system that is very commonly used. 415 | Free Remote versioning solutions are GitLab and GitHub. 416 | - `Bash`: Sets some git configuration and sets the user name and email 417 | - ##### Mod: `jdk` 418 | Installes the java development kit based in the version inside the env script. 419 | - `Env`: Defines the jdk version and the apt package 420 | - ##### Mod: `cd` 421 | Creates some bash scripts named `cd.`, `cd..`, `cd...` and make them executable as shortcuts. 422 | The count of the `.` (dots) defines how many folders the shell should go above the current working directory. 423 | - `Async`: Creates the bash scripts in a binary directory ($PATH variable) 424 | - ##### Mod: `docker` 425 | Allows the user to use docker (for the provider: docker in docker) in their own CodeC instance. 426 | For this you need to have a [privileged](#start) CodeC docker container running. 427 | - `Async`: Enables all pre installed docker processes. 428 | 429 | ## Mounts 430 | `!!! This section not describes Docker volumes mounts !!!` 431 | First, read about why we need CodeC mounts for [persistent data](#persistence). 432 | 433 | To prevent data loss, CodeC offers a feature called `Mounts`. CodeC Mounts are symbolic links to directories outside the persistent CodeC folder (`/codec`) that are mounted into the persistent folder. 434 | 435 | Mounts can be set in the `/codec/.codec/mounts.json` JSON file as a `key-value object`. The key is the name (*without slashes*) for mount-folder in the `/codec/mounts/` folder, and the value is the target that should be mounted into there. If the folder named by the key does not exist, the mount script at the CodeC container startup copies the existing folder into the mount folder location in `/codec/mounts/` to get the default/existing files not deleted. 436 | 437 | # folder structure 438 | 439 | ## User FS 440 | Because most of the following files are in the persistent `/codec` folder, all user data in there will be persistent. 441 | 442 | - `/root/` 443 | - `ws/` <- /codec 444 | - `/usr/` 445 | - `bin/` <- codec bins moved to here 446 | - `/codec/` <- persistent folder 447 | - `mounts/` 448 | - `shared/` <- `a shared folder between all CodeC instances as share and exchange folder` 449 | - `logs/` <- logs folder for the CodeC System and Mods, 450 | - `ssh/` <- `/root/.ssh`, 451 | - `vscode/` <- `/root/.local/share/code-server` 452 | - `.codec/` 453 | - `bin/` <- custom executable user scripts 454 | - `enabled-mods` <- links to `/mods`-files 455 | - `mods/` <- folder with optional CodeC [Mods](#mods) 456 | - `mounts.json` <- file with CodeC [Mount](#mounts) configuration 457 | - `main/` 458 | - `todo/` 459 | - `archieved/` 460 | 461 | | Folder/File | Description | 462 | | ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------ | 463 | | `/codec` | The only [persistent folder](#persistence) for the user | 464 | | `/codec/.codec/` | Folder for the user with CodeC infos, configs, mods, mounts and scripts | 465 | | `/codec/.codec/ports.info.txt` | Text file containing the ports the user can use to test/run apps on (more infos [here](#start)) | 466 | | `/codec/.codec/bin/` | Contains custom executable files used by the CodeC system | 467 | | `/codec/.codec/enabled-mods/` | Directory for enabled [Mods](#mods) | 468 | | `/codec/.codec/mods/` | Directory for optional [Mods](#mods) | 469 | | `/codec/.codec/mounts.json` | JSON file for the user to [mount](#mounts) non-persistent files | 470 | | `/codec/mounts/systemd/` | [Mount point](#mounts) for custom systemd configuration files | 471 | | `/codec/mounts/ssh/` | [Mount point](#mounts) for the SSH server configuration files | 472 | | `/codec/mounts/vscode/` | [Mount point](#mounts) for the code-server configuration files | 473 | | `/codec/workspace/` | Directory for the main projects | 474 | | `/codec/todo/` | Directory for to-do projects | 475 | | `/codec/archived/` | Directory for archived projects | 476 | | `/root/` | CodeC user home folder | 477 | | `/root/ws/` | Link to the `/codec` directory inside the users home folder (user can execute `cd; cd ws` to get into the `/codec` workspace folder) | 478 | 479 | ## System FS 480 | The following files are intended for the CodeC container boot and health system rather than the user. 481 | Changes here can lead to unforeseen problems. 482 | We recommend to use [Mods](#mods) (or [Mounts](#mounts)) for dev env customization. 483 | 484 | - `/etc/` 485 | - `codec/` 486 | - `boot.sh` 487 | - `bash.sh` 488 | - `health.sh` 489 | - `skel` 490 | - `.codec` 491 | - `...skel... 492 | - `mounts` 493 | - `vscode` 494 | - `ports.info.txt` 495 | 496 | | Folder/File | Description | 497 | | ---------------------- | ------------------------------------------------------------------------------------------------------------------- | 498 | | `/etc/codec` | System CodeC folder with all needed boot, skeleton and initialization files | 499 | | `/etc/codec/boot.sh` | Bash script that runs on container start-up. This will trigger the [Env, Async and Boot Mod Scripts](#custom-mod). | 500 | | `/etc/codec/bash.sh` | Bash script that runs on bash shell start-up like `.bashrc`. This will trigger the [Bash Mod Scripts](#custom-mod). | 501 | | `/etc/codec/health.sh` | Bash script to check and repair desired CodeC state of folder and file structures | 502 | | `/etc/codec/skel/` | Skeleton directory used for the [user's CodeC folder](#user-fs) `/codec/.codec` below | 503 | 504 | # Preview 505 | ![AssemblyScript](./docs/img/codec-wasm-preview.png) 506 | ![Images](./docs/img/codec-image-preview.png) 507 | ![Makrdown](./docs/img/codec-markdown-preview.png) 508 | ![Login](./docs/img/login.png) 509 | 510 | # Codec v1 511 | 'Codec' v1 was successful, but not very well thought-out software. 512 | 'Codec' stands for **Code-C**ontainer* and wasn't written as "CodeC" back then. 513 | 514 | ## v1 Software 515 | 516 | The software used by Codec back then included `Ubuntu v20.04`, `Code Server v3` (*by Coder*), `dind` (*docker-in-docker docker-hub image*), `Git`, `Node v16`, and `NPM v8`, with an `unminimized ubuntu docker image`. Codec components included `Codec bins`, a own `Codec Linux user`, and a `boot` and a `bash script`. 517 | 518 | ## v1 folder structure 519 | 520 | In codec version 1, the folder structure consisted of a home directory with a Codec folder. Inside the Codec folder, there was a hidden ".codec" directory that contained bin and skel folders, as well as a docker-entrypoint.sh script. 521 | 522 | - `/home` 523 | - `/codec` 524 | - `/.codec` 525 | - `/bin` 526 | - `/skel` 527 | - `/docker-entrypoint.sh` 528 | - `/ws` <- Persistend directory 529 | - `/.codec` 530 | - `/bin` 531 | - `/boot.sh` 532 | - `/bash.sh` 533 | - `/default.code-workspace` 534 | - `/ports.txt` 535 | - ...etc... 536 | - `/main` 537 | - `/todo` 538 | - `/test` 539 | - ...etc... 540 | 541 | The `~` folder was the users home folder at `/home/codec`. 542 | 543 | | Folder/File | Description | 544 | | ------------------------------------ | ------------------------------------------------------------------- | 545 | | `~/.codec/bin` | Contains executable files used by the codec system | 546 | | `~/.codec/skel` | Skeleton directory used for users codec folder `~/ws/.codec` below | 547 | | `~/.codec/docker-entrypoint.sh` | Entrypoint script for the codec container | 548 | | `~/ws` | Only persistent folder for the user | 549 | | `~/ws/main` | Directory for the main projects | 550 | | `~/ws/todo` | Directory for to-do projects | 551 | | `~/ws/.codec/boot.sh` | Bash script that runs on container start up | 552 | | `~/ws/.codec/bash.sh` | Bash script that runs on bash shell start up like `.bashrc` | 553 | | `~/ws/.codec/ports.txt` | Text file containing the ports the user can use to test/run apps on | 554 | | `~/ws/.codec/default.code-workspace` | Default workspace file for the code-server | 555 | 556 | ## v1 Problems 557 | With Codec 1 we gained experience and analyzed some pain points and difficulties that were not easy to patch out. 558 | Therefore, CodeC 2.0.0 was developed, which was completely overhauled, solved many issues and brought many new features and possibilities with it. 559 | 560 | ## v2.0.0 changes 561 | Software Changes: 562 | - `+` Added Systemd 563 | - `*` Updated to Ubuntu v22.04 LTS (until then v20.04) 564 | - `*` Updated to VSCode Server v4.* (until then v3.*) 565 | 566 | Component Changes: 567 | - `-` Removed Codec Linux user 568 | - `-` Removed the boot and bash-init script 569 | - `+` Added Codec mods system 570 | - `+` Added Codec systemd service 571 | - `+` Added health check boot script 572 | - `*` Updated custom CLI tools 573 | - `*` Updated Codec user CLI 574 | 575 | # Contributing 576 | Contributions to this project are welcome! 577 | Interested users can refer to the guidelines provided in the [CONTRIBUTING.md](CONTRIBUTING.md) file to contribute to the project and help improve its functionality and features. 578 | 579 | # License 580 | This project is licensed under the [MIT license](LICENSE), providing users with flexibility and freedom to use and modify the software according to their needs. 581 | 582 | # Disclaimer 583 | This project is provided without warranties. 584 | Users are advised to review the accompanying license for more information on the terms of use and limitations of liability. 585 | 586 | 587 | 588 | -------------------------------------------------------------------------------- /build.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ./codeccli build -s -------------------------------------------------------------------------------- /codec3-arch.drawio: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /codeccli: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | CURRENT_DIR=$(dirname $(realpath $0)) 4 | 5 | echo "-----[CodecCLI]-----" 6 | echo "" 7 | 8 | if [ -z $1 ]; then 9 | echo "Error:" 10 | echo "You need to define one subcommand!" 11 | exit 1 12 | fi 13 | CMD="$1" 14 | 15 | if [[ "$CMD" = restartall* ]]; then 16 | CMD="restartall" 17 | fi 18 | if [[ "$CMD" = ena* ]]; then 19 | CMD="enable" 20 | fi 21 | if [[ "$CMD" = dis* ]]; then 22 | CMD="disable" 23 | fi 24 | 25 | if [[ "$CMD" = in* ]]; then 26 | CMD="install" 27 | fi 28 | if [[ "$CMD" = un* ]]; then 29 | CMD="uninstall" 30 | fi 31 | 32 | if [[ "$CMD" = up* ]]; then 33 | CMD="updateall" 34 | fi 35 | 36 | if [[ "$CMD" = defaultp* ]]; then 37 | CMD="defaultpass" 38 | fi 39 | if [[ "$CMD" = passh* ]]; then 40 | CMD="passhash" 41 | fi 42 | if [[ "$CMD" = setp* ]]; then 43 | CMD="setpass" 44 | fi 45 | 46 | if [[ "$CMD" = at* ]]; then 47 | CMD="attach" 48 | fi 49 | if [[ "$CMD" = bu* ]]; then 50 | CMD="build" 51 | fi 52 | if [[ "$CMD" = cr* ]]; then 53 | CMD="cron" 54 | fi 55 | if [[ "$CMD" = un* ]]; then 56 | CMD="uncron" 57 | fi 58 | if [[ "$CMD" = cl* ]]; then 59 | CMD="close" 60 | fi 61 | if [[ "$CMD" = dev* ]]; then 62 | CMD="dev" 63 | elif [[ "$CMD" = de* ]]; then 64 | CMD="delete" 65 | fi 66 | if [[ "$CMD" = ex* ]]; then 67 | CMD="exist" 68 | fi 69 | if [[ "$CMD" = he* ]]; then 70 | CMD="help" 71 | fi 72 | if [[ "$CMD" = lo* ]]; then 73 | CMD="logs" 74 | elif [[ "$CMD" = li* ]]; then 75 | CMD="list" 76 | fi 77 | if [[ "$CMD" = pa* ]]; then 78 | CMD="pass" 79 | fi 80 | 81 | if [[ "$CMD" = ra* ]]; then 82 | CMD="randompass" 83 | elif [[ "$CMD" = reseth* ]]; then 84 | CMD="resethash" 85 | elif [[ "$CMD" = reset ]]; then 86 | CMD="reset" 87 | fi 88 | 89 | if [[ "$CMD" = sto* ]]; then 90 | CMD="stopall" 91 | elif [[ "$CMD" = st* ]]; then 92 | CMD="start" 93 | fi 94 | 95 | if [ ! -f "$CURRENT_DIR/scripts/$CMD.sh" ]; then 96 | echo "CodecCLI command $CMD not found!" 97 | echo "" 98 | echo "Help:" 99 | $CURRENT_DIR/scripts/help.sh 100 | exit 1 101 | fi 102 | 103 | $CURRENT_DIR/scripts/$CMD.sh ${@:2} 104 | -------------------------------------------------------------------------------- /cron/task.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | CURRENT_DIR=$(dirname $(realpath $0)) 4 | 5 | UPDATE_START="$(date +'%Y_%m_%d_%H_%M')" 6 | 7 | if [ -z "$CODEC_USER_DATA" ]; then 8 | CODEC_USER_DATA="/var/lib/codec" 9 | fi 10 | 11 | sudo rm -rf $CODEC_USER_DATA/.codec/$UPDATE_START.log 12 | ($CURRENT_DIR/update.sh $1 $UPDATE_START) >> $CODEC_USER_DATA/.codec/$UPDATE_START.log 13 | -------------------------------------------------------------------------------- /cron/update.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | echo "[CODEC_CLI]: Crontask Update-All" 4 | echo "AT: $2" 5 | echo "--------------------------------" 6 | 7 | sudo -u "$1" -s bash -c 'codeccli build -s; codeccli updateall -f' 8 | -------------------------------------------------------------------------------- /cron/update.sh.save: -------------------------------------------------------------------------------- 1 | 2 | echo "[CODEC_CLI][CRON-TASK][UPDATE-ALL]" 3 | date +"%Y.%m.%d_%H:%M" 4 | echo "----- ----- -----" 5 | 6 | sudo -u '$1' -s bash -c 'codeccli updateall -s -f' 7 | -------------------------------------------------------------------------------- /docs/img/Success-Kid.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NobleMajo/codec/5516dc12746bf1e13662ad2cab33a8e4bb6730ad/docs/img/Success-Kid.png -------------------------------------------------------------------------------- /docs/img/cat1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NobleMajo/codec/5516dc12746bf1e13662ad2cab33a8e4bb6730ad/docs/img/cat1.png -------------------------------------------------------------------------------- /docs/img/cat2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NobleMajo/codec/5516dc12746bf1e13662ad2cab33a8e4bb6730ad/docs/img/cat2.png -------------------------------------------------------------------------------- /docs/img/challenge-accepted-meme.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NobleMajo/codec/5516dc12746bf1e13662ad2cab33a8e4bb6730ad/docs/img/challenge-accepted-meme.png -------------------------------------------------------------------------------- /docs/img/codec-image-preview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NobleMajo/codec/5516dc12746bf1e13662ad2cab33a8e4bb6730ad/docs/img/codec-image-preview.png -------------------------------------------------------------------------------- /docs/img/codec-markdown-preview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NobleMajo/codec/5516dc12746bf1e13662ad2cab33a8e4bb6730ad/docs/img/codec-markdown-preview.png -------------------------------------------------------------------------------- /docs/img/codec-wasm-preview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NobleMajo/codec/5516dc12746bf1e13662ad2cab33a8e4bb6730ad/docs/img/codec-wasm-preview.png -------------------------------------------------------------------------------- /docs/img/login-hover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NobleMajo/codec/5516dc12746bf1e13662ad2cab33a8e4bb6730ad/docs/img/login-hover.png -------------------------------------------------------------------------------- /docs/img/login.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NobleMajo/codec/5516dc12746bf1e13662ad2cab33a8e4bb6730ad/docs/img/login.png -------------------------------------------------------------------------------- /docs/img/one-does-not-simply.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NobleMajo/codec/5516dc12746bf1e13662ad2cab33a8e4bb6730ad/docs/img/one-does-not-simply.png -------------------------------------------------------------------------------- /docs/img/what-if-i-told.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NobleMajo/codec/5516dc12746bf1e13662ad2cab33a8e4bb6730ad/docs/img/what-if-i-told.png -------------------------------------------------------------------------------- /fetch-code-server-version.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | ( 4 | async () => { 5 | let fetch 6 | try { 7 | fetch = require("./node_modules/node-fetch/lib/index") 8 | } catch (err) { 9 | if (err.message.startsWith("Cannot find module")) { 10 | 11 | } 12 | const { exec } = require("child_process"); 13 | 14 | let err3 15 | await new Promise((res) => { 16 | exec("npm ci", (err2, stdout, stderr) => { 17 | if (err2) { 18 | err3 = err2 19 | } else if (stderr) { 20 | err3 = new Error("Error outpus:", stderr) 21 | } 22 | res() 23 | }) 24 | }) 25 | if (err3) { 26 | console.error("Error while install npm deps: ", err3) 27 | process.exit(1) 28 | } 29 | 30 | fetch = require("./node_modules/node-fetch/lib/index") 31 | } 32 | 33 | 34 | const url = "https://api.github.com/repos/coder/code-server/releases" 35 | const resp = await fetch(url) 36 | const data = await resp.json() 37 | for (const releases of data) { 38 | if ( 39 | typeof releases["tag_name"] == "string" && 40 | releases["tag_name"].startsWith("v") 41 | ) { 42 | v = releases["tag_name"] 43 | v = v.trim() 44 | v = v.substring(1) 45 | v = v.trim() 46 | process.stdout.write(v) 47 | process.exit(0) 48 | } 49 | } 50 | process.stderr.write( 51 | "No version found!" 52 | ) 53 | process.exit(1) 54 | } 55 | )() 56 | -------------------------------------------------------------------------------- /package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "codec", 3 | "lockfileVersion": 3, 4 | "requires": true, 5 | "packages": { 6 | "": { 7 | "dependencies": { 8 | "node-fetch": "2" 9 | } 10 | }, 11 | "node_modules/node-fetch": { 12 | "version": "2.7.0", 13 | "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", 14 | "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", 15 | "license": "MIT", 16 | "dependencies": { 17 | "whatwg-url": "^5.0.0" 18 | }, 19 | "engines": { 20 | "node": "4.x || >=6.0.0" 21 | }, 22 | "peerDependencies": { 23 | "encoding": "^0.1.0" 24 | }, 25 | "peerDependenciesMeta": { 26 | "encoding": { 27 | "optional": true 28 | } 29 | } 30 | }, 31 | "node_modules/tr46": { 32 | "version": "0.0.3", 33 | "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", 34 | "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==", 35 | "license": "MIT" 36 | }, 37 | "node_modules/webidl-conversions": { 38 | "version": "3.0.1", 39 | "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", 40 | "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==", 41 | "license": "BSD-2-Clause" 42 | }, 43 | "node_modules/whatwg-url": { 44 | "version": "5.0.0", 45 | "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", 46 | "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", 47 | "license": "MIT", 48 | "dependencies": { 49 | "tr46": "~0.0.3", 50 | "webidl-conversions": "^3.0.0" 51 | } 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "node-fetch": "2" 4 | } 5 | } -------------------------------------------------------------------------------- /proxy.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | if [ -z "$CODEC_NET" ]; then 4 | CODEC_NET="codec_net" 5 | fi 6 | 7 | docker pull majo418/cprox 8 | 9 | docker rm -f "codec2_proxy" > /dev/null 2>&1 10 | docker network create "$CODEC_NET" > /dev/null 2>&1 11 | 12 | docker run -itd --rm \ 13 | --name "codec2_proxy" \ 14 | -p 80:80 \ 15 | -p 443:443 \ 16 | --net "$CODEC_NET" \ 17 | -v /home/netde/static/main:/var/www/html \ 18 | -v /home/netde/certs/coreunit.net:/app/certs \ 19 | -e CERT_PATH="/app/certs" \ 20 | -e CERT_NAME="cert1.pem" \ 21 | -e KEY_NAME="privkey1.pem" \ 22 | -e CA_NAME="fullchain1.pem" \ 23 | -e VERBOSE="true" \ 24 | majo418/cprox \ 25 | "/app/dist/index.js" \ 26 | "discord.coreunit.net=REDIRECT:https://discord.gg/pwHNaHRa9W" \ 27 | "*.codec.coreunit.net=PROXY:http://codec_{-4}:8080" \ 28 | "majo.coreunit.net=REDIRECT:https://github.com/majo418" \ 29 | "coreunit.net=REDIRECT:https://discord.gg/pwHNaHRa9W" 30 | 31 | echo "### Proxy is running..." 32 | echo "(Check proxy with 'docker logs codec2_proxy')" 33 | -------------------------------------------------------------------------------- /scripts/attach.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | if [ -z "$1" ]; then 4 | echo "[CODEC_CLI][ATTACH]: No codec user defined!" 5 | exit 1 6 | fi 7 | 8 | echo "[CODEC_CLI][ATTACH]: Attach to '$1':" 9 | docker exec -it "codec_$1" bash -------------------------------------------------------------------------------- /scripts/build.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | export CURRENT_DIR=$(dirname $(realpath $0)) 4 | source $CURRENT_DIR/vars.sh 5 | 6 | cd $CURRENT_DIR/.. 7 | 8 | echo "The newest coder/code-server version is: $(./fetch-code-server-version.js)" 9 | 10 | FLAG_NAME="--scratch" 11 | FLAG_SHORTNAME="-s" 12 | if [ "$1" == "$FLAG_NAME" ] || [ "$1" == "$FLAG_SHORTNAME" ] || 13 | [ "$2" == "$FLAG_NAME" ] || [ "$2" == "$FLAG_SHORTNAME" ] || 14 | [ "$3" == "$FLAG_NAME" ] || [ "$3" == "$FLAG_SHORTNAME" ] || 15 | [ "$4" == "$FLAG_NAME" ] || [ "$5" == "$FLAG_NAME" ] || 16 | [ "$6" == "$FLAG_NAME" ] || [ "$7" == "$FLAG_NAME" ] || 17 | [ "$4" == "$FLAG_SHORTNAME" ] || [ "$5" == "$FLAG_SHORTNAME" ] || 18 | [ "$6" == "$FLAG_SHORTNAME" ] || [ "$7" == "$FLAG_SHORTNAME" ]; then 19 | echo "[CODEC_CLI][BUILD]: Build codec image form scratch..." 20 | 21 | docker build \ 22 | --pull \ 23 | --no-cache \ 24 | -t codec2 \ 25 | . 26 | 27 | echo "[CODEC_CLI][BUILD]: Scratch image ready!" 28 | exit 0 29 | fi 30 | 31 | 32 | 33 | echo "[CODEC_CLI][BUILD]: Build codec image..." 34 | 35 | docker build \ 36 | -t codec2 \ 37 | . 38 | 39 | echo "[CODEC_CLI][BUILD]: Image ready!" 40 | -------------------------------------------------------------------------------- /scripts/clean-pkg-mgmt-deps.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | targetPath=$1 4 | 5 | echo "Delete package manager dependencies in '$targetPath'..." 6 | directories=$(find $targetPath -type d) 7 | 8 | # Gehe durch die Liste der Verzeichnisse und lösche alle Ordner, die den exakten Namen "node_modules", "packages" oder "include/lib" haben. 9 | for directory in $directories; do 10 | # NPM 11 | if [[ "$directory" == "node_modules" ]]; then 12 | if [[ -f "$directory/../package.json" ]]; then 13 | echo "Deleting node_modules '$directory'..." 14 | rm -rf $directory 15 | else 16 | echo "Skipping node_modules '$directory' because no package.json file was found." 17 | fi 18 | fi 19 | 20 | # DOTNET/C# 21 | if [[ "$directory" == "packages" ]]; then 22 | if [[ -f "$directory/../packages.config" ]]; then 23 | echo "Deleting packages '$directory'..." 24 | rm -rf $directory 25 | else 26 | echo "Skipping packages '$directory' because no packages.config file was found." 27 | fi 28 | fi 29 | 30 | # C++ 31 | if [[ "$directory" == "include" || "$directory" == "lib" ]]; then 32 | if [[ -f "$directory/../CMakeLists.txt" ]]; then 33 | echo "Deleting include/lib '$directory'..." 34 | rm -rf $directory 35 | else 36 | echo "Skipping include/lib '$directory' because no CMakeLists.txt file was found." 37 | fi 38 | fi 39 | done 40 | 41 | echo "Done!" 42 | -------------------------------------------------------------------------------- /scripts/close.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | export CURRENT_DIR=$(dirname $(realpath $0)) 4 | source $CURRENT_DIR/vars.sh 5 | 6 | if [ -z "$1" ]; then 7 | echo "[CODEC_CLI][CLOSE]: No codec user defined!" 8 | exit 1 9 | fi 10 | 11 | echo "[CODEC_CLI][CLOSE]: Remove container for '$1'..." 12 | docker rm -f "codec_$1" > /dev/null 2>&1 13 | echo "[CODEC_CLI][CLOSE]: Container removed!" 14 | -------------------------------------------------------------------------------- /scripts/cron.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | export CURRENT_DIR=$(dirname $(realpath $0)) 4 | source $CURRENT_DIR/vars.sh 5 | 6 | $CURRENT_DIR/uncron.sh 7 | 8 | sudo mkdir -p $CURRENT_DIR/.codec/cron 9 | sudo rm -rf $CODEC_USER_DATA/.codec/cron/* 10 | sudo cp $CURRENT_DIR/../cron/* $CODEC_USER_DATA/.codec/cron/ 11 | 12 | sudo crontab -l > /tmp/codec-cron 13 | sudo echo "50 4 * * * $CODEC_USER_DATA/.codec/cron/task.sh $USER" >> /tmp/codec-cron 14 | sudo crontab /tmp/codec-cron 15 | sudo rm -rf /tmp/codec-cron 16 | -------------------------------------------------------------------------------- /scripts/defaultpass.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | export CURRENT_DIR=$(dirname $(realpath $0)) 4 | source $CURRENT_DIR/vars.sh 5 | 6 | if [ -z "$1" ]; then 7 | echo "[CODEC_CLI][DEFAULTPASS]: No codec user defined!" 8 | exit 1 9 | fi 10 | 11 | if [ -z "$2" ]; then 12 | echo "[CODEC_CLI][DEFAULTPASS]: No password hash defined!" 13 | exit 1 14 | fi 15 | 16 | echo "[CODEC_CLI][DEFAULTPASS]: Short hash..." 17 | HASH="$2" 18 | HASH="$(echo -n "$HASH" | sha256sum | cut -d' ' -f1)" 19 | HASH=${HASH:0:64} 20 | 21 | echo "[CODEC_CLI][DEFAULTPASS]: Default password hash..." 22 | docker rm -f codeccli-hash-helper > /dev/null 2>&1 23 | docker run -it --rm \ 24 | --name "codeccli-hash-helper" \ 25 | -v "$CODEC_USER_DATA/.codec:/app" \ 26 | ubuntu:22.04 \ 27 | bash -c \ 28 | "mkdir -p /app/hash \ 29 | && echo -n '$HASH' > /app/hash/$1.hash" 30 | 31 | echo "[CODEC_CLI][DEFAULTPASS]: Default password hash set!" 32 | -------------------------------------------------------------------------------- /scripts/delete.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | export CURRENT_DIR=$(dirname $(realpath $0)) 4 | source $CURRENT_DIR/vars.sh 5 | 6 | if [ -z "$1" ]; then 7 | echo "[CODEC_CLI][DELETE]: No codec user defined!" 8 | exit 1 9 | fi 10 | 11 | if [ "$2" != "-f" ] && [ "$2" != "--force" ]; then 12 | echo "[CODEC_CLI][DELETE]: Delete the codec user '$1'?" 13 | echo "Type 'y' to delete the codec user '$1'" 14 | echo "Userdata at:'$CODEC_USER_DATA/$1/.codec'" 15 | read INPUT_VALUE 16 | if [ "$INPUT_VALUE" != "y" ]; then 17 | echo "Abort because input was not 'y'!" 18 | exit 1 19 | fi 20 | fi 21 | 22 | $CURRENT_DIR/close.sh "$1" 23 | 24 | echo "[CODEC_CLI][DELETE]: Delete '$1'..." 25 | docker run -it --rm \ 26 | -v "$CODEC_USER_DATA:/app" \ 27 | ubuntu:22.04 \ 28 | rm -rf "/app/$1" 29 | 30 | 31 | echo "[CODEC_CLI][DELETE]: Delete ports cache for '$1'..." 32 | docker run -it --rm \ 33 | --name "codeccli-$1-port-helper" \ 34 | -v "$CODEC_USER_DATA/.codec:/app" \ 35 | ubuntu:22.04 \ 36 | bash -c \ 37 | "rm -rf /app/ports/$1.start.port \ 38 | && rm -rf /app/ports/$1.count.port \ 39 | && rm -rf /app/args/$1.extra.args \ 40 | && rm -rf /app/hash/$1.hash" 41 | 42 | echo "[CODEC_CLI][DELETE]: User '$1' deleted!" 43 | -------------------------------------------------------------------------------- /scripts/dev.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | export CURRENT_DIR=$(dirname $(realpath $0)) 4 | source $CURRENT_DIR/vars.sh 5 | 6 | if [ "$1" == "reset" ] || [ "$1" == "-r" ]; then 7 | echo "Reset user '$1_dev'..." 8 | $CURRENT_DIR/delete.sh "$1_dev" -f 9 | fi 10 | 11 | $CURRENT_DIR/build.sh 12 | $CURRENT_DIR/start.sh "$1_dev" 33330 10 -f 13 | 14 | if [ "$1" == "reset" ] || [ "$1" == "-r" ]; then 15 | sleep 3 16 | $CURRENT_DIR/pass.sh "$1_dev" 17 | fi 18 | -------------------------------------------------------------------------------- /scripts/disable.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | export CURRENT_DIR=$(dirname $(realpath $0)) 4 | source $CURRENT_DIR/vars.sh 5 | 6 | $CURRENT_DIR/close.sh $1 7 | 8 | echo "[CODEC_CLI][DISABLE]: Disable user '$1'..." 9 | docker rm -f codeccli-disable > /dev/null 2>&1 10 | docker run -it --rm \ 11 | --name "codeccli-disable" \ 12 | -v "$CODEC_USER_DATA/:/app" \ 13 | ubuntu:22.04 \ 14 | bash -c \ 15 | "mkdir -p /app/.codec/archive/$1 \ 16 | && mkdir -p /app/$1 \ 17 | && cp -r /app/$1/* /app/.codec/archive/$1/ \ 18 | && rm -rf /app/$1" 19 | -------------------------------------------------------------------------------- /scripts/dockerd-process.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | export CURRENT_DIR=$(dirname $(realpath $0)) 4 | source $CURRENT_DIR/vars.sh 5 | 6 | if [ -z "$1" ]; then 7 | echo "[CODEC_CLI][DOCKERD_PROCESS]: No codec user defined!" 8 | exit 1 9 | fi 10 | 11 | echo "[CODEC_CLI][DOCKERD_PROCESS]: Start docker daemon..." 12 | 13 | CODEC_USER=$1 14 | CODEC_DOCKERD_DIR="$CODEC_USER_DATA/.codec/dockerd/" 15 | CODEC_DOCKERD_CONFIG_PATH="$CODEC_DOCKERD_DIR/$CODEC_USER_dockerd_config.json" 16 | 17 | dockerd \ 18 | --config-file "$CODEC_DOCKERD_CONFIG_PATH" > \ 19 | "$CODEC_DOCKERD_DIR/$CODEC_USER_dockerd.logs" \ 20 | 2>&1 & 21 | 22 | CODEC_DOCKERD_PID=$! 23 | 24 | while docker ps -q --filter name=codec_$CODEC_USER &> /dev/null; do 25 | sleep 30 26 | done 27 | 28 | $CURRENT_DIR/dockerd-stop.sh $CODEC_USER 29 | kill -s SIGKILL $CODEC_DOCKERD_PID 30 | 31 | echo "[CODEC_CLI][DOCKERD_PROCESS]: dockerd exit!" 32 | -------------------------------------------------------------------------------- /scripts/dockerd-stop.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | export CURRENT_DIR=$(dirname $(realpath $0)) 4 | source $CURRENT_DIR/vars.sh 5 | 6 | if [ -z "$1" ]; then 7 | echo "[CODEC_CLI][DOCKERD_STOP]: No codec user defined!" 8 | exit 1 9 | fi 10 | 11 | CODEC_USER=$1 12 | CODEC_DOCKERD_DIR="$CODEC_USER_DATA/.codec/dockerd/" 13 | CODEC_DOCKERD_CONFIG_PATH="$CODEC_DOCKERD_DIR/$CODEC_USER_dockerd_config.json" 14 | CODEC_DOCKERD_PID_PATH="$CODEC_DOCKERD_DIR/$CODEC_USER_dockerd.pid" 15 | 16 | if [ ! -f "$CODEC_DOCKERD_PID_PATH" ]; then 17 | echo "[CODEC_CLI][DOCKERD_STOP]: No $CODEC_USER dockerd started for $CODEC_USER!" 18 | exit 0 19 | fi 20 | 21 | CODEC_DOCKERD_PID=$(<"$CODEC_DOCKERD_PID_PATH") 22 | 23 | echo "[CODEC_CLI][DOCKERD_STOP]: Exit $CODEC_USER dockerd graceful..." 24 | kill -s SIGTERM $CODEC_DOCKERD_PID 25 | 26 | GRACEFUL_COUNTER=0 27 | 28 | while ps -p $CODEC_DOCKERD_PID > /dev/null; do 29 | if [ $GRACEFUL_COUNTER -ge 10 ]; then 30 | echo "[CODEC_CLI][DOCKERD_STOP]: No graceful exit!" 31 | kill -s SIGKILL $CODEC_DOCKERD_PID 32 | break 33 | fi 34 | sleep 2 35 | GRACEFUL_COUNTER=$((GRACEFUL_COUNTER + 1)) 36 | done 37 | 38 | echo "[CODEC_CLI][DOCKERD_STOP]: $CODEC_USER dockerd exit!" -------------------------------------------------------------------------------- /scripts/dockerd.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | export CURRENT_DIR=$(dirname $(realpath $0)) 4 | source $CURRENT_DIR/vars.sh 5 | 6 | if [ -z "$1" ]; then 7 | echo "[CODEC_CLI][DOCKERD]: No codec user defined!" 8 | exit 1 9 | fi 10 | 11 | echo "[CODEC_CLI][DOCKERD]: Prepare $CODEC_USER docker daemon process..." 12 | 13 | CODEC_USER=$1 14 | CODEC_DOCKERD_DIR="$CODEC_USER_DATA/.codec/dockerd/" 15 | CODEC_DOCKERD_CONFIG_PATH="$CODEC_DOCKERD_DIR/$CODEC_USER_dockerd_config.json" 16 | CODEC_DOCKERD_PID_PATH="$CODEC_DOCKERD_DIR/$CODEC_USER_dockerd.pid" 17 | 18 | mkdir -p $CODEC_DOCKERD_DIR 19 | mkdir -p $CODEC_USER_DATA/$CODEC_USER/dockerd/ 20 | 21 | $CURRENT_DIR/dockerd-stop.sh $CODEC_USER 22 | 23 | cat < $CODEC_DOCKERD_CONFIG_PATH 24 | { 25 | "hosts": ["unix://$CODEC_USER_DATA/$CODEC_USER/dockerd/dockerd.sock"], 26 | "pidfile": "$CODEC_DOCKERD_DIR/$CODEC_USER_dockerd.pid", 27 | "data-root": "$CODEC_USER_DATA/$CODEC_USER/dockerd/data", 28 | "registry-mirrors": [ 29 | "https://docker-reg.coreunit.net" 30 | ], 31 | "storage-driver": "vfs", 32 | "debug": true, 33 | "log-driver": "json-file", 34 | "log-opts": { 35 | "max-size": "12m", 36 | "max-file": "3" 37 | } 38 | EOF 39 | 40 | echo "[CODEC_CLI][DOCKERD]: Run $CODEC_USER docker daemon process..." 41 | $CURRENT_DIR/dockerd-process.sh $CODEC_USER > "$CODEC_DOCKERD_DIR/$CODEC_USER_docker_sidecar.logs" & -------------------------------------------------------------------------------- /scripts/enable.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | export CURRENT_DIR=$(dirname $(realpath $0)) 4 | source $CURRENT_DIR/vars.sh 5 | 6 | USER=$1 7 | 8 | echo "[CODEC_CLI][ENABLE]: Enable user '$1'..." 9 | docker rm -f codeccli-disable > /dev/null 2>&1 10 | docker run -it --rm \ 11 | --name "codeccli-disable" \ 12 | -v "$CODEC_USER_DATA/:/app" \ 13 | ubuntu:22.04 \ 14 | bash -c \ 15 | "mkdir -p /app/.codec/archive/$1 \ 16 | && mkdir -p /app/$1 \ 17 | && cp -r /app/.codec/archive/$1/* /app/$1/ \ 18 | && rm -rf /app/.codec/archive/$1" 19 | 20 | -------------------------------------------------------------------------------- /scripts/exist.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | export CURRENT_DIR=$(dirname $(realpath $0)) 4 | source $CURRENT_DIR/vars.sh 5 | 6 | if [ -z "$1" ]; then 7 | echo "[CODEC_CLI][EXIST]: No codec user defined!" 8 | exit 1 9 | fi 10 | 11 | CODEC_USERS="$( 12 | docker run -it --rm \ 13 | -v "$CODEC_USER_DATA:/app" \ 14 | -w /app \ 15 | ubuntu:22.04 \ 16 | ls -AQ 17 | )" 18 | 19 | if [[ $CODEC_USERS != *"\"$1\""* ]]; then 20 | echo "false" 21 | exit 1 22 | fi 23 | 24 | if [ "$2" == "CODECDIR" ]; then 25 | CODEC_DIR="$( 26 | docker run -it --rm \ 27 | -v "$CODEC_USER_DATA/$1:/app" \ 28 | -w /app \ 29 | ubuntu:22.04 \ 30 | ls -AQ 31 | )" 32 | if [[ $CODEC_DIR != *"\".codec\""* ]]; then 33 | echo -n "false" 34 | exit 1 35 | fi 36 | fi 37 | 38 | echo -n "true" 39 | exit 0 40 | -------------------------------------------------------------------------------- /scripts/help.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | export CURRENT_DIR=$(dirname $(realpath $0)) 4 | source $CURRENT_DIR/vars.sh 5 | 6 | echo "CodeC - VS Code Container" 7 | echo "- A VS Code Docker Container Image" 8 | echo "- by Majo418 (See GitHub)" 9 | echo "- based on coder/code-server (See GitHub)" 10 | echo "- based on docker (See GitHub)" 11 | echo "" 12 | 13 | echo "Tipps:" 14 | echo "1. You need to enter minimum 2 letters of a command to execute it." 15 | echo "2. If you do something dangerous the cli tool will ask you if you really want to do it." 16 | echo "3. The subcommands do not have an infotext." 17 | echo "4. If you have no idea what you're doing, stop." 18 | echo "" 19 | 20 | echo "Available subcommands at:" 21 | echo "'$CURRENT_DIR'" 22 | ls -AQ $CURRENT_DIR 23 | -------------------------------------------------------------------------------- /scripts/install.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | export CURRENT_DIR=$(dirname $(realpath $0)) 4 | source $CURRENT_DIR/vars.sh 5 | 6 | echo "[CODEC_CLI][INSTALL]: Need super user rights to install codeccli..." 7 | sudo echo "[CODEC_CLI][INSTALL]: Super user access granted!" 8 | 9 | echo "test: $CODEC_BIN_INSTALL_PATH/codeccli" 10 | echo "test2: $CODEC_CLI_PATH $CODEC_BIN_INSTALL_PATH/codeccli" 11 | 12 | echo "[CODEC_CLI][INSTALL]: Install codeccli..." 13 | sudo rm -rf $CODEC_BIN_INSTALL_PATH/codeccli 14 | sudo ln -s $CODEC_CLI_PATH $CODEC_BIN_INSTALL_PATH/codeccli 15 | 16 | if [ "$1" != "-i" ] && [ "$1" != "--image" ]; then 17 | echo "[CODEC_CLI][INSTALL]: Build codec image?" 18 | echo "If you also want to build and cache the newest codec image enter 'y'." 19 | read INPUT_VALUE 20 | if [ "$INPUT_VALUE" == "y" ]; then 21 | $CURRENT_DIR/build.sh -s 22 | fi 23 | fi 24 | 25 | echo "[CODEC_CLI][INSTALL]: Done!" 26 | -------------------------------------------------------------------------------- /scripts/logs.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | export CURRENT_DIR=$(dirname $(realpath $0)) 4 | source $CURRENT_DIR/vars.sh 5 | 6 | if [ -z "$1" ]; then 7 | echo "[CODEC_CLI][LOGS]: No codec user defined!" 8 | exit 1 9 | fi 10 | 11 | echo "[CODEC_CLI][LOGS]: Sysdemd logs of '$1':" 12 | docker logs "codec_$1" 13 | echo "[CODEC_CLI][LOGS]: Codec boot logs of '$1':" 14 | docker exec -it "codec_$1" codec -l 15 | -------------------------------------------------------------------------------- /scripts/pass.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | export CURRENT_DIR=$(dirname $(realpath $0)) 4 | source $CURRENT_DIR/vars.sh 5 | 6 | if [ -z "$1" ]; then 7 | echo "[CODEC_CLI][PASS]: No codec user defined!" 8 | exit 1 9 | fi 10 | 11 | PASSWORD="" 12 | while [ ${#PASSWORD} -lt 8 ]; do 13 | echo "[CODEC_CLI][PASS]: Enter a password with min 8 letters:" 14 | echo "[CTRL] + [C] to abort" 15 | read -s PASSWORD 16 | 17 | echo -n "[CODEC_CLI][PASS]: Enter password again:" 18 | echo "[CTRL] + [C] to abort" 19 | read -s RE_PASSWORD 20 | echo 21 | if [ "$PASSWORD" != "$RE_PASSWORD" ]; then 22 | echo "[CODEC_CLI][PASS]: Passwords does not match!" 23 | echo "Please try again!" 24 | echo "[CTRL] + [C] to abort" 25 | continue 26 | fi 27 | done 28 | 29 | echo "[CODEC_CLI][PASS]: Hash password..." 30 | HASH="$(echo -n "$PASSWORD" | sha256sum | cut -d' ' -f1)" 31 | 32 | echo "[CODEC_CLI][PASS]: Set password hash..." 33 | $CURRENT_DIR/passhash.sh $1 "$HASH" 34 | 35 | echo "[CODEC_CLI][PASS]: Password set!" 36 | -------------------------------------------------------------------------------- /scripts/passhash.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | export CURRENT_DIR=$(dirname $(realpath $0)) 4 | source $CURRENT_DIR/vars.sh 5 | 6 | if [ -z "$1" ]; then 7 | echo "[CODEC_CLI][PASSHASH]: No codec user defined!" 8 | exit 1 9 | fi 10 | 11 | if [ -z "$2" ]; then 12 | echo "[CODEC_CLI][PASSHASH]: No password hash defined!" 13 | exit 1 14 | fi 15 | 16 | echo "[CODEC_CLI][PASSHASH]: Short hash..." 17 | HASH="$2" 18 | HASH=${HASH:0:64} 19 | 20 | echo "[CODEC_CLI][PASSHASH]: Save startup arguments..." 21 | docker rm -f codeccli-hash-helper > /dev/null 2>&1 22 | docker run -it --rm \ 23 | --name "codeccli-hash-helper" \ 24 | -v "$CODEC_USER_DATA/.codec:/app" \ 25 | ubuntu:22.04 \ 26 | bash -c \ 27 | "mkdir -p /app/ports \ 28 | && echo -n '$HASH' > /app/ports/$1.hash" 29 | 30 | echo "[CODEC_CLI][PASSHASH]: Set password hash..." 31 | docker exec -it "codec_$1" codec -rh "$HASH" 32 | 33 | echo "[CODEC_CLI][PASSHASH]: Password hash set!" 34 | -------------------------------------------------------------------------------- /scripts/randompass.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | if [ -z "$1" ]; then 4 | echo "[CODEC_CLI][RANDOMPASSWORD]: No codec user defined!" 5 | exit 1 6 | fi 7 | 8 | HASH_VALUE="$(date +'%N%S')$1$(date)$1$(date +'%S%N')" 9 | 10 | HASH="$(echo -n "$HASH_VALUE" | sha256sum | cut -d' ' -f1)" 11 | 12 | HASH="${HASH:16:1}${HASH:8:4}${HASH:32:2}${HASH:2:1}${HASH:24:2}" 13 | HASH+="${HASH:9:2}${HASH:22:2}${HASH:23:1}${HASH:15:1}${HASH:3:1}" 14 | 15 | HASH="$(echo -n "$(date +'%N%S')$HASH$(date +'%S%N')" | sha256sum | cut -d' ' -f1)" 16 | 17 | echo -n "${HASH:16:5}_$1_${HASH:4:5}_CODEC_${HASH:24:5}" 18 | -------------------------------------------------------------------------------- /scripts/reright.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | export CURRENT_DIR=$(dirname $(realpath $0)) 4 | source $CURRENT_DIR/vars.sh 5 | 6 | $CURRENT_DIR/build.sh > /dev/null 2>&1 & 7 | BUILD_PID=$! 8 | 9 | echo "[CODEC_CLI][RERIGHT]: Reset user rights on .codec folder..." 10 | docker run -it --rm \ 11 | --name "codeccli-reright" \ 12 | -v "$CODEC_USER_DATA/.codec:/app" \ 13 | ubuntu:22.04 \ 14 | bash -c \ 15 | "chown -R root /app" 16 | 17 | docker run -it --rm \ 18 | --name "codeccli-start-port-reader" \ 19 | -v "$CODEC_USER_DATA/.codec:/app" \ 20 | ubuntu:22.04 \ 21 | bash 22 | -------------------------------------------------------------------------------- /scripts/reset.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | export CURRENT_DIR=$(dirname $(realpath $0)) 4 | source $CURRENT_DIR/vars.sh 5 | 6 | if [ -z "$1" ]; then 7 | echo "[CODEC_CLI][RESET]: No codec user defined!" 8 | exit 1 9 | fi 10 | 11 | if [ "$2" != "-f" ] && [ "$2" != "--force" ]; then 12 | echo "[CODEC_CLI][RESET]: Reset codec user data of '$1'?" 13 | echo "Type 'y' to delete the codec user '$1'" 14 | echo "Userdata at:'$CODEC_USER_DATA/$1/.codec'" 15 | read INPUT_VALUE 16 | if [ "$INPUT_VALUE" != "y" ]; then 17 | echo "Abort because input was not 'y'!" 18 | exit 1 19 | fi 20 | fi 21 | 22 | $CURRENT_DIR/close.sh "$1" 23 | 24 | echo "Delete '/codec/.codec' for '$1'..." 25 | docker run -it --rm \ 26 | -v "$CODEC_USER_DATA/$1:/app" \ 27 | ubuntu:22.04 \ 28 | bash -c 'mv "/app/.codec/vscode-server.yaml" "/vscode-server.yaml" \ 29 | && rm -rf "/app/.codec/*" \ 30 | && mv "/vscode-server.yaml" "/app/.codec/"' 31 | 32 | -------------------------------------------------------------------------------- /scripts/resethash.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | export CURRENT_DIR=$(dirname $(realpath $0)) 4 | source $CURRENT_DIR/vars.sh 5 | 6 | if [ -z "$1" ]; then 7 | echo "[CODEC_CLI][RESETHASH]: No codec user defined!" 8 | exit 1 9 | fi 10 | 11 | echo "[CODEC_CLI][RESETHASH]: Short hash..." 12 | HASH="$2" 13 | HASH=${HASH:0:64} 14 | 15 | echo "[CODEC_CLI][RESETHASH]: Default password hash..." 16 | docker rm -f codeccli-reset-hash-helper > /dev/null 2>&1 17 | DEFAULT_PASS="$( 18 | docker run -it --rm \ 19 | --name "codeccli-reset-hash-helper" \ 20 | -v "$CODEC_USER_DATA/.codec:/app" \ 21 | ubuntu:22.04 \ 22 | bash -c \ 23 | "cat /app/hash/$1.hash" 24 | )" 25 | 26 | echo "Reset password hash to: '$DEFAULT_PASS'" 27 | 28 | $CURRENT_DIR/passhash.sh $1 "$DEFAULT_PASS" 29 | 30 | echo "[CODEC_CLI][RESETHASH]: Default password hash set!" 31 | -------------------------------------------------------------------------------- /scripts/restartall.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | export CURRENT_DIR=$(dirname $(realpath $0)) 4 | source $CURRENT_DIR/vars.sh 5 | 6 | echo "[CODEC_CLI][UPDATEALL]: Load codec container user list..." 7 | USER_LIST=$(ls -AQ $CODEC_USER_DATA) 8 | 9 | USER_LIST=${USER_LIST::-1} 10 | USER_ARR=() 11 | for USER_FOLDER in ${USER_LIST[@]}; do 12 | if [ $USER_FOLDER == '".codec"' ]; then 13 | continue 14 | fi 15 | USER_ARR+=($(echo -n "${USER_FOLDER:1:-1}")) 16 | done 17 | 18 | if [ "${#USER_ARR[@]}" == "0" ]; then 19 | echo "[CODEC_CLI][UPDATEALL]: No codec user exists!" 20 | exit 1 21 | fi 22 | 23 | echo "" 24 | echo "[CODEC_CLI][UPDATEALL]: " 25 | echo "##### UPDATE ALL #####" 26 | echo "# Following users will be re/started:" 27 | for USER_NAME in ${USER_ARR[@]}; do 28 | echo "# - '$USER_NAME'" 29 | done 30 | 31 | FLAG_NAME="--force" 32 | FLAG_SHORTNAME="-f" 33 | if [ "$1" == "$FLAG_NAME" ] || [ "$1" == "$FLAG_SHORTNAME" ] || 34 | [ "$2" == "$FLAG_NAME" ] || [ "$2" == "$FLAG_SHORTNAME" ] || 35 | [ "$3" == "$FLAG_NAME" ] || [ "$3" == "$FLAG_SHORTNAME" ] || 36 | [ "$4" == "$FLAG_NAME" ] || [ "$5" == "$FLAG_NAME" ] || 37 | [ "$6" == "$FLAG_NAME" ] || [ "$7" == "$FLAG_NAME" ] || 38 | [ "$4" == "$FLAG_SHORTNAME" ] || [ "$5" == "$FLAG_SHORTNAME" ] || 39 | [ "$6" == "$FLAG_SHORTNAME" ] || [ "$7" == "$FLAG_SHORTNAME" ]; then 40 | echo "[CODEC_CLI][UPDATEALL]: Force update all containers!" 41 | else 42 | echo "# Enter 'y' to start the '${#USER_ARR[@]}' codec user containers." 43 | echo "# [CTRL] + [C] to abort!" 44 | read INPUT_VALUE 45 | if [ "$INPUT_VALUE" != "y" ]; then 46 | echo "Abort because input was not 'y'!" 47 | exit 1 48 | fi 49 | fi 50 | 51 | echo "[CODEC_CLI][UPDATEALL]: Wait for image building..." 52 | wait $BUILD_PID 53 | echo "[CODEC_CLI][UPDATEALL]: Image ready!" 54 | 55 | echo "[CODEC_CLI][UPDATEALL]: Start user container..." 56 | for USER_NAME in ${USER_ARR[@]}; do 57 | echo "##### ##### ##### ##### ##### ##### #####" 58 | echo " Next user: $USER_NAME" 59 | $CURRENT_DIR/start.sh "$USER_NAME" -f 60 | done 61 | echo "##### ##### ##### ##### ##### ##### #####" 62 | 63 | echo "[CODEC_CLI][UPDATEALL]: All containers started!" 64 | 65 | echo "[CODEC_CLI][UPDATEALL]: Clear unused docker resources..." 66 | docker system prune -f --volumes --all 67 | 68 | echo "[CODEC_CLI][UPDATEALL]: Finished!" 69 | -------------------------------------------------------------------------------- /scripts/setpass.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | export CURRENT_DIR=$(dirname $(realpath $0)) 4 | source $CURRENT_DIR/vars.sh 5 | 6 | if [ -z "$1" ]; then 7 | echo "[CODEC_CLI][SETPASS]: No codec user defined!" 8 | exit 1 9 | fi 10 | 11 | if [ -z "$2" ]; then 12 | echo "[CODEC_CLI][SETPASS]: No password!" 13 | exit 1 14 | fi 15 | 16 | echo "[CODEC_CLI][PASSETPASSS]: Hash password..." 17 | HASH="$(echo -n "$2" | sha256sum | cut -d' ' -f1)" 18 | 19 | echo "[CODEC_CLI][SETPASS]: Set password hash..." 20 | $CURRENT_DIR/passhash.sh $1 "$HASH" 21 | 22 | echo "[CODEC_CLI][SETPASS]: Password set!" 23 | -------------------------------------------------------------------------------- /scripts/start.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | export CURRENT_DIR=$(dirname $(realpath $0)) 4 | source $CURRENT_DIR/vars.sh 5 | 6 | $CURRENT_DIR/build.sh > /dev/null 2>&1 & 7 | BUILD_PID=$! 8 | 9 | if [ -z "$1" ]; then 10 | echo "[CODEC_CLI][START]: No codec user defined!" 11 | exit 1 12 | fi 13 | 14 | CODEC_USER="$1" 15 | 16 | if [ -z "$MAX_ALLOED_CODEC_PORTs" ]; then 17 | MAX_ALLOED_CODEC_PORTS=99 18 | fi 19 | 20 | if [ -z "$DEFAULT_CODEC_PORT_COUNT" ]; then 21 | DEFAULT_CODEC_PORT_COUNT="10" 22 | fi 23 | 24 | START_PORT="$2" # 20 25 | PORT_COUNT="$3" # 5 26 | 27 | if (( START_PORT > 65535 )) || (( START_PORT < 1 )); then 28 | START_PORT="" 29 | fi 30 | if (( PORT_COUNT > $MAX_ALLOED_CODEC_PORTS )) || (( PORT_COUNT < 1 )); then 31 | PORT_COUNT="" 32 | fi 33 | 34 | if [ -z $START_PORT ]; then 35 | docker rm -f codeccli-start-port-reader > /dev/null 2>&1 36 | START_PORT="$( 37 | docker run -it --rm \ 38 | --name "codeccli-start-port-reader" \ 39 | -v "$CODEC_USER_DATA/.codec/ports:/app" \ 40 | ubuntu:22.04 \ 41 | bash -c \ 42 | " \ 43 | touch /app/$CODEC_USER.start.port && \ 44 | cat /app/$CODEC_USER.start.port \ 45 | " 46 | )" 47 | if [ -z $START_PORT ]; then 48 | echo "[CODEC_CLI][START]: Start port not defined!" 49 | exit 1 50 | fi 51 | fi 52 | echo "[CODEC_CLI][START]: Defined start port is:" 53 | echo "'$START_PORT'" 54 | 55 | if [ -z $PORT_COUNT ]; then 56 | docker rm -f codeccli-end-port-reader > /dev/null 2>&1 57 | 58 | PORT_COUNT="$( 59 | docker run -it --rm \ 60 | --name "codeccli-end-port-reader" \ 61 | -v "$CODEC_USER_DATA/.codec/ports:/app" \ 62 | ubuntu:22.04 \ 63 | bash -c \ 64 | "touch /app/$CODEC_USER.count.port && cat /app/$CODEC_USER.count.port" 65 | )" 66 | if [ -z $PORT_COUNT ]; then 67 | PORT_COUNT="$DEFAULT_CODEC_PORT_COUNT" 68 | fi 69 | fi 70 | 71 | echo "[CODEC_CLI][START]: Defined port count is:" 72 | echo "'$PORT_COUNT'" 73 | 74 | if (( START_PORT > 65535 )); then 75 | echo "[CODEC_CLI][START]: The start port '$START_PORT' is not in the port range (1-65535)!" 76 | exit 1 77 | fi 78 | if (( START_PORT < 1 )); then 79 | echo "[CODEC_CLI][START]: The start port '$START_PORT' is not in the port range (1-65535)!" 80 | exit 1 81 | fi 82 | if (( PORT_COUNT > $MAX_ALLOED_CODEC_PORTS )); then 83 | echo "[CODEC_CLI][START]: The port count '$PORT_COUNT' is greater then the maximum allowed count of ports '$MAX_ALLOED_CODEC_PORTS'!" 84 | exit 1 85 | fi 86 | if (( PORT_COUNT < 1 )); then 87 | echo "[CODEC_CLI][START]: The port counts needs to be minimum '1'!" 88 | exit 1 89 | fi 90 | 91 | END_PORT=$(($START_PORT+$PORT_COUNT-1)) 92 | 93 | if (( END_PORT > 65535 )); then 94 | echo "[CODEC_CLI][START]: The end port '$END_PORT' is not in the port range (1-65535)!" 95 | exit 1 96 | fi 97 | if (( END_PORT < 1 )); then 98 | echo "[CODEC_CLI][START]: The end port '$END_PORT' is not in the port range (1-65535)!" 99 | exit 1 100 | fi 101 | 102 | ALREADY_EXIST=$($CURRENT_DIR/exist.sh "$CODEC_USER" "CODECDIR") 103 | 104 | DOCKER_START_CMD=" \ 105 | docker run -d \ 106 | --privileged \ 107 | --name 'codec_$CODEC_USER' \ 108 | --net '$CODEC_NET' \ 109 | --restart unless-stopped \ 110 | -p '0.0.0.0:$START_PORT-$END_PORT:$START_PORT-$END_PORT/tcp' \ 111 | -p '0.0.0.0:$START_PORT-$END_PORT:$START_PORT-$END_PORT/udp' \ 112 | -e 'CODEC_PORTS=$START_PORT-$END_PORT' \ 113 | -v '$CODEC_USER_DATA/.codec/shared_folder:/codec/mounts/shared' \ 114 | -v '$CODEC_USER_DATA/$CODEC_USER:/codec' \ 115 | codec2 \ 116 | " 117 | 118 | echo "[CODEC_CLI][START]: Docker run command preview: '" 119 | echo "$DOCKER_START_CMD" 120 | echo "'" 121 | 122 | FLAG_NAME="--force" 123 | FLAG_SHORTNAME="-f" 124 | if [ "$CODEC_USER" != "$FLAG_NAME" ] && [ "$CODEC_USER" != "$FLAG_SHORTNAME" ] && 125 | [ "$2" != "$FLAG_NAME" ] && [ "$2" != "$FLAG_SHORTNAME" ] && 126 | [ "$3" != "$FLAG_NAME" ] && [ "$3" != "$FLAG_SHORTNAME" ] && 127 | [ "$4" != "$FLAG_NAME" ] && [ "$5" != "$FLAG_NAME" ] && 128 | [ "$6" != "$FLAG_NAME" ] && [ "$7" != "$FLAG_NAME" ] && 129 | [ "$4" != "$FLAG_SHORTNAME" ] && [ "$5" != "$FLAG_SHORTNAME" ] && 130 | [ "$6" != "$FLAG_SHORTNAME" ] && [ "$7" != "$FLAG_SHORTNAME" ]; then 131 | echo "" 132 | echo "[CODEC_CLI][START]: " 133 | echo "####### CONTAINER DATA #######" 134 | echo "# Ports: '$START_PORT-$END_PORT'" 135 | echo "# Datapath: '$CODEC_USER_DATA/$CODEC_USER/'" 136 | echo "# Exist: '$ALREADY_EXIST'" 137 | echo "# Enter 'y' to start the '$CODEC_USER' codec user container." 138 | echo "# [CTRL] + [C] to abort!" 139 | read INPUT_VALUE 140 | if [ "$INPUT_VALUE" != "y" ]; then 141 | echo "Abort because input was not 'y'!" 142 | exit 1 143 | fi 144 | fi 145 | 146 | echo "[CODEC_CLI][START]: Wait for image building..." 147 | while kill -0 $BUILD_PID >/dev/null 2>&1; do 148 | sleep 1 149 | done 150 | echo "[CODEC_CLI][START]: Image ready!" 151 | 152 | $CURRENT_DIR/close.sh $CODEC_USER 153 | 154 | docker network create "$CODEC_NET" > /dev/null 2>&1 155 | 156 | echo "[CODEC_CLI][START]: Run docker container..." 157 | bash -c "$DOCKER_START_CMD" 158 | 159 | #echo "[CODEC_CLI][START]: Run docker daemon..." 160 | #$CURRENT_DIR/dockerd.sh $CODEC_USER 161 | 162 | echo "[CODEC_CLI][START]: Set port user info..." 163 | PORT_INFO_TEXT="Your codec ports: codec.coreunit.net:$START_PORT-$END_PORT" 164 | 165 | docker rm -f codeccli-info-helper > /dev/null 2>&1 166 | docker run -it --rm \ 167 | --name "codeccli-info-helper" \ 168 | -v "$CODEC_USER_DATA/$CODEC_USER:/codec" \ 169 | ubuntu:22.04 \ 170 | bash -c \ 171 | " \ 172 | mkdir -p /codec/.codec && \ 173 | chmod 777 /codec/.codec && \ 174 | echo '$PORT_INFO_TEXT' > /codec/.codec/ports.info.txt \ 175 | && chmod 744 /codec/.codec \ 176 | " 177 | 178 | echo "[CODEC_CLI][START]: Save startup arguments..." 179 | docker rm -f codeccli-port-helper > /dev/null 2>&1 180 | docker run -it --rm \ 181 | --name "codeccli-port-helper" \ 182 | -v "$CODEC_USER_DATA/.codec:/app" \ 183 | ubuntu:22.04 \ 184 | bash -c \ 185 | " \ 186 | mkdir -p /app/ports \ 187 | && touch /app/ports/$CODEC_USER.start.port \ 188 | && echo -n '$START_PORT' > /app/ports/$CODEC_USER.start.port \ 189 | && touch /app/ports/$CODEC_USER.count.port \ 190 | && echo -n '$PORT_COUNT' > /app/ports/$CODEC_USER.count.port \ 191 | " 192 | 193 | if [ "$ALREADY_EXIST" == "false" ]; then 194 | echo "[CODEC_CLI][START]: Set new random generated password..." 195 | NEW_DEFAULT_PASS="$($CURRENT_DIR/randompass.sh $CODEC_USER)" 196 | $CURRENT_DIR/defaultpass.sh $CODEC_USER "$NEW_DEFAULT_PASS" 197 | $CURRENT_DIR/setpass.sh $CODEC_USER "$NEW_DEFAULT_PASS" 198 | 199 | echo "Default password is: '$NEW_DEFAULT_PASS'" 200 | fi 201 | 202 | echo "[CODEC_CLI][START]: Finished!" 203 | -------------------------------------------------------------------------------- /scripts/stopall.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | export CURRENT_DIR=$(dirname $(realpath $0)) 4 | source $CURRENT_DIR/vars.sh 5 | 6 | echo "[CODEC_CLI][STOPALL]: Load codec container user list..." 7 | USER_LIST=$(ls -AQ $CODEC_USER_DATA) 8 | 9 | USER_LIST=${USER_LIST::-1} 10 | USER_ARR=() 11 | for USER_FOLDER in ${USER_LIST[@]}; do 12 | if [ $USER_FOLDER == '".codec"' ]; then 13 | continue 14 | fi 15 | USER_ARR+=($(echo -n "${USER_FOLDER:1:-1}")) 16 | done 17 | 18 | if ["${#USER_ARR[@]}" == "0"]; then 19 | echo "[CODEC_CLI][UPDATEALL]: No codec user exists!" 20 | exit 1 21 | fi 22 | 23 | echo "" 24 | echo "[CODEC_CLI][STOPALL]: " 25 | echo "##### STOP ALL #####" 26 | echo "# Stop following users?" 27 | for USER_NAME in ${USER_ARR[@]}; do 28 | echo "# - '$USER_NAME'" 29 | done 30 | 31 | echo "# Enter 'y' to start the '$1' codec user container." 32 | echo "# [CTRL] + [C] to abort!" 33 | read INPUT_VALUE 34 | if [ "$INPUT_VALUE" != "y" ]; then 35 | echo "Abort because input was not 'y'!" 36 | exit 1 37 | fi 38 | 39 | echo "[CODEC_CLI][STOPALL]: Stop user container..." 40 | for USER_NAME in ${USER_ARR[@]}; do 41 | echo "##### ##### ##### ##### ##### ##### #####" 42 | echo " Next user: $USER_NAME" 43 | $CURRENT_DIR/close.sh $USER_NAME 44 | done 45 | echo "##### ##### ##### ##### ##### ##### #####" 46 | 47 | echo "[CODEC_CLI][STOPALL]: All user contaienrs stopped!" 48 | -------------------------------------------------------------------------------- /scripts/test.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | export CURRENT_DIR=$(dirname $(realpath $0)) 4 | source $CURRENT_DIR/vars.sh 5 | 6 | $CURRENT_DIR/build.sh > /dev/null 2>&1 & 7 | BUILD_PID=$! 8 | 9 | DOCKER_START_CMD=" \ 10 | docker run -it \ 11 | --name 'codeccli_test' \ 12 | --net '$CODEC_NET' \ 13 | -e 'CODEC_PORTS=NONE-TEST-CONTAINER' \ 14 | codec2 \ 15 | /bin/bash \ 16 | " 17 | 18 | echo "[CODEC_CLI][TEST]: Docker run command preview: '" 19 | echo "$DOCKER_START_CMD" 20 | echo "'" 21 | 22 | echo "[CODEC_CLI][TEST]: Wait for image building..." 23 | while kill -0 $BUILD_PID >/dev/null 2>&1; do 24 | sleep 1 25 | done 26 | echo "[CODEC_CLI][TEST]: Image ready!" 27 | 28 | docker rm -f codeccli_test > /dev/null 2>&1 29 | docker network create "$CODEC_NET" > /dev/null 2>&1 30 | 31 | echo "[CODEC_CLI][TEST]: Run docker container..." 32 | bash -c "$DOCKER_START_CMD" 33 | 34 | #echo "[CODEC_CLI][TEST]: Run docker daemon..." 35 | #$CURRENT_DIR/dockerd.sh $CODEC_USER 36 | 37 | echo "[CODEC_CLI][TEST]: Finished!" 38 | -------------------------------------------------------------------------------- /scripts/uncron.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | export CURRENT_DIR=$(dirname $(realpath $0)) 4 | source $CURRENT_DIR/vars.sh 5 | 6 | echo "Need root access..." 7 | sudo echo "Root access granted!" 8 | 9 | sudo crontab -l > /tmp/codec-cron 10 | sed '/.codec/d' /tmp/codec-cron > /tmp/codec-cron 11 | sudo crontab /tmp/codec-cron 12 | sudo rm -rf /tmp/codec-cron 13 | -------------------------------------------------------------------------------- /scripts/uninstall.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | export CURRENT_DIR=$(dirname $(realpath $0)) 4 | source $CURRENT_DIR/vars.sh 5 | 6 | echo "[CODEC_CLI][UNINSTALL]: Need super user rights to uninstall codeccli..." 7 | sudo echo "[CODEC_CLI][UNINSTALL]: Super user access granted!" 8 | 9 | if [ "$1" != "-f" ] && [ "$1" != "--force" ]; then 10 | echo "[CODEC_CLI][UNINSTALL]: Uninstall codeccli?" 11 | echo "If you want to uninstall codec enter 'y'." 12 | read INPUT_VALUE 13 | if [ "$INPUT_VALUE" != "y" ]; then 14 | echo "Abort uninstall!" 15 | exit 1 16 | fi 17 | fi 18 | 19 | echo "[CODEC_CLI][UNINSTALL]: Uninstall codeccli..." 20 | sudo rm -rf $CODEC_BIN_INSTALL_PATH/codeccli 21 | 22 | echo "[CODEC_CLI][UNINSTALL]: Done!" 23 | -------------------------------------------------------------------------------- /scripts/updateall.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | export CURRENT_DIR=$(dirname $(realpath $0)) 4 | source $CURRENT_DIR/vars.sh 5 | 6 | FLAG_NAME="--scratch" 7 | FLAG_SHORTNAME="-s" 8 | if [ "$1" == "$FLAG_NAME" ] || [ "$1" == "$FLAG_SHORTNAME" ] || 9 | [ "$2" == "$FLAG_NAME" ] || [ "$2" == "$FLAG_SHORTNAME" ] || 10 | [ "$3" == "$FLAG_NAME" ] || [ "$3" == "$FLAG_SHORTNAME" ] || 11 | [ "$4" == "$FLAG_NAME" ] || [ "$5" == "$FLAG_NAME" ] || 12 | [ "$6" == "$FLAG_NAME" ] || [ "$7" == "$FLAG_NAME" ] || 13 | [ "$4" == "$FLAG_SHORTNAME" ] || [ "$5" == "$FLAG_SHORTNAME" ] || 14 | [ "$6" == "$FLAG_SHORTNAME" ] || [ "$7" == "$FLAG_SHORTNAME" ]; then 15 | $CURRENT_DIR/build.sh -s > /dev/null 2>&1 & 16 | BUILD_PID=$! 17 | echo "[CODEC_CLI][UPDATEALL]: Build image in background from scratch!" 18 | echo "This can take some minutes!" 19 | echo "Background process id: '$BUILD_PID'" 20 | else 21 | $CURRENT_DIR/build.sh > /dev/null 2>&1 & 22 | BUILD_PID=$! 23 | echo "[CODEC_CLI][UPDATEALL]: Build image in background." 24 | echo "Background process id: '$BUILD_PID'" 25 | fi 26 | 27 | echo "[CODEC_CLI][UPDATEALL]: Load codec container user list..." 28 | USER_LIST=$(ls -AQ $CODEC_USER_DATA) 29 | 30 | USER_LIST=${USER_LIST::-1} 31 | USER_ARR=() 32 | for USER_FOLDER in ${USER_LIST[@]}; do 33 | if [ $USER_FOLDER == '".codec"' ]; then 34 | continue 35 | fi 36 | USER_ARR+=($(echo -n "${USER_FOLDER:1:-1}")) 37 | done 38 | 39 | if [ "${#USER_ARR[@]}" == "0" ]; then 40 | echo "[CODEC_CLI][UPDATEALL]: No codec user exists!" 41 | exit 1 42 | fi 43 | 44 | echo "" 45 | echo "[CODEC_CLI][UPDATEALL]: " 46 | echo "##### UPDATE ALL #####" 47 | echo "# Following users will be re/started:" 48 | for USER_NAME in ${USER_ARR[@]}; do 49 | echo "# - '$USER_NAME'" 50 | done 51 | 52 | FLAG_NAME="--force" 53 | FLAG_SHORTNAME="-f" 54 | if [ "$1" == "$FLAG_NAME" ] || [ "$1" == "$FLAG_SHORTNAME" ] || 55 | [ "$2" == "$FLAG_NAME" ] || [ "$2" == "$FLAG_SHORTNAME" ] || 56 | [ "$3" == "$FLAG_NAME" ] || [ "$3" == "$FLAG_SHORTNAME" ] || 57 | [ "$4" == "$FLAG_NAME" ] || [ "$5" == "$FLAG_NAME" ] || 58 | [ "$6" == "$FLAG_NAME" ] || [ "$7" == "$FLAG_NAME" ] || 59 | [ "$4" == "$FLAG_SHORTNAME" ] || [ "$5" == "$FLAG_SHORTNAME" ] || 60 | [ "$6" == "$FLAG_SHORTNAME" ] || [ "$7" == "$FLAG_SHORTNAME" ]; then 61 | echo "[CODEC_CLI][UPDATEALL]: Force update all containers!" 62 | else 63 | echo "# Enter 'y' to start the '${#USER_ARR[@]}' codec user containers." 64 | echo "# [CTRL] + [C] to abort!" 65 | read INPUT_VALUE 66 | if [ "$INPUT_VALUE" != "y" ]; then 67 | echo "Abort because input was not 'y'!" 68 | exit 1 69 | fi 70 | fi 71 | 72 | echo "[CODEC_CLI][UPDATEALL]: Wait for image building..." 73 | wait $BUILD_PID 74 | echo "[CODEC_CLI][UPDATEALL]: Image ready!" 75 | 76 | echo "[CODEC_CLI][UPDATEALL]: Start user container..." 77 | for USER_NAME in ${USER_ARR[@]}; do 78 | echo "##### ##### ##### ##### ##### ##### #####" 79 | echo " Next user: $USER_NAME" 80 | $CURRENT_DIR/start.sh "$USER_NAME" -f 81 | done 82 | echo "##### ##### ##### ##### ##### ##### #####" 83 | 84 | echo "[CODEC_CLI][UPDATEALL]: All containers started!" 85 | 86 | echo "[CODEC_CLI][UPDATEALL]: Clear unused docker resources..." 87 | docker system prune -f --volumes --all 88 | 89 | echo "[CODEC_CLI][UPDATEALL]: Finished!" 90 | -------------------------------------------------------------------------------- /scripts/users.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | export CURRENT_DIR=$(dirname $(realpath $0)) 4 | source $CURRENT_DIR/vars.sh 5 | 6 | echo "[CODEC_CLI][USERS]: Load codec container user list..." 7 | USER_LIST=$( 8 | docker run -it --rm \ 9 | -v "$CODEC_USER_DATA:/app" \ 10 | -w /app \ 11 | ubuntu:22.04 \ 12 | ls -AQ 13 | ) 14 | 15 | USER_LIST=${USER_LIST::-1} 16 | USER_ARR=() 17 | for USER_FOLDER in ${USER_LIST[@]}; do 18 | if [ $USER_FOLDER == '".codec"' ]; then 19 | continue 20 | fi 21 | USER_ARR+=($(echo -n "${USER_FOLDER:1:-1}")) 22 | done 23 | 24 | echo "[CODEC_CLI][USERS]: Existing user folder:" 25 | for USER_NAME in ${USER_ARR[@]}; do 26 | echo " - '$USER_NAME'" 27 | done 28 | -------------------------------------------------------------------------------- /scripts/vars.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | if [ -z "$CODEC_NET" ]; then 4 | export CODEC_NET="ff_codec_net" 5 | fi 6 | 7 | if [ -z "$CODEC_BIN_INSTALL_PATH" ]; then 8 | export CODEC_BIN_INSTALL_PATH="/usr/bin" 9 | fi 10 | 11 | export CURRENT_DIR=$(dirname $(realpath $0)) 12 | export CODEC_CLI_PATH=$(realpath "$CURRENT_DIR/../codeccli") 13 | 14 | if [ -z "$CODEC_USER_DATA" ]; then 15 | export CODEC_USER_DATA="$CURRENT_DIR/../codec-data" 16 | fi 17 | -------------------------------------------------------------------------------- /start.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ./codeccli build -s 4 | 5 | ./codeccli start tester 30000 0 -f 6 | -------------------------------------------------------------------------------- /system/bash.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | source /etc/environment 4 | 5 | codec -w 6 | 7 | alias ws="cd /codec/ws" 8 | 9 | MODS_PATH="/codec/.codec/enabled-mods" 10 | BASH_MOD_PATHS=("$(find $MODS_PATH -name "*.bash.sh")") 11 | 12 | for BASH_MOD_PATH in $BASH_MOD_PATHS; do 13 | source $BASH_MOD_PATH 14 | done -------------------------------------------------------------------------------- /system/bin/code: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | if [ -z "$1" ]; then 4 | set "$1" "/codec/.codec/default.code-workspace" 5 | fi 6 | 7 | # node /usr/lib/code-server 8 | /usr/lib/code-server/bin/code-server \ 9 | --reuse-window \ 10 | --verbose \ 11 | --disable-telemetry \ 12 | $@ 13 | -------------------------------------------------------------------------------- /system/bin/codec: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # if first argument is -rc or --restart, stop the main process 4 | if [[ "$1" == "-r" || "$1" == "--restart" || "$1" == "restart" ]]; then 5 | echo "///CODEC///: Restarting codec container..." 6 | 7 | rm -rf /tmp/* 8 | 9 | /etc/codec/mods.sh --quit 10 | 11 | rm -rf /tmp/* 12 | 13 | echo "Shutdown..." 14 | 15 | sleep 2 16 | shutdown -P 0 17 | exit 0 18 | fi 19 | 20 | if [[ "$1" == "-l" || "$1" == "--logs" || "$1" == "logs" ]]; then 21 | echo "///CODEC///: Logs:" 22 | journalctl -u codec 23 | exit 0 24 | fi 25 | 26 | 27 | # if first argument is -r or --fast-restart, restart the vscode process 28 | if [[ "$1" == "-fr" || "$1" == "--fast-restart" || "$1" == "fast-restart" ]]; then 29 | echo "///CODEC///: Restarting codec vscode..." 30 | systemctl restart vscode 31 | exit 0 32 | fi 33 | 34 | # if first argument is -fd or --free-disk, free some disk space 35 | if [[ "$1" == "-fd" || "$1" == "--free-disk" || "$1" == "free-disk" ]]; then 36 | echo "///CODEC///: Clear all codec logs..." 37 | rm -rf /codec/.codec/logs/* 38 | 39 | echo "///CODEC///: Clear tmp folder..." 40 | rm -rf /tmp/* 41 | 42 | echo "///CODEC///: Clear codeserver cache files..." 43 | rm -rf /codec/.codec/vscode/CachedExtensionVSIXs/* 44 | rm -rf /codec/.codec/vscode/User/Backups/* 45 | rm -rf /codec/.codec/vscode/User/workspaceStorage/* 46 | rm -rf /codec/.codec/vscode/User/customBuiltinExtensionsCache.json 47 | 48 | echo "///CODEC///: node_mods folder..." 49 | find /codec/main -name "node_mods" -type d -prune -print | xargs du -chs 50 | find /codec/old -name "node_mods" -type d -prune -print | xargs du -chs 51 | find /codec/test -name "node_mods" -type d -prune -print | xargs du -chs 52 | 53 | echo "///CODEC///: Wipe docker..." 54 | codecdd start 55 | codecdd swipe 56 | codecdd stop 57 | 58 | echo "///CODEC///: Clear apt cache files..." 59 | aptup 60 | sudo apt-get autoremove -y 61 | sudo apt-get clean 62 | sudo apt-get autoclean 63 | 64 | echo "///CODEC///: Wipe unused screens..." 65 | screen -wipe > /dev/null 2>&1 66 | 67 | echo "///CODEC///: Clear system logs..." 68 | sudo journalctl --rotate > /dev/null 2>&1 69 | sudo journalctl --vacuum-time=3s 70 | 71 | echo "///CODEC///: Finished!" 72 | exit 0 73 | fi 74 | 75 | # if first argument is -cc or --clear-cache, clear some cache 76 | if [[ "$1" == "-cc" || "$1" == "--clear-cache" || "$1" == "clear-cache" ]]; then 77 | echo "///CODEC///: Clear all codec logs..." 78 | rm -rf /codec/.codec/logs/* 79 | 80 | echo "///CODEC///: Clear tmp folder..." 81 | rm -rf /tmp/* 82 | 83 | echo "///CODEC///: Clear codeserver cache files..." 84 | rm -rf /codec/.codec/vscode/CachedExtensionVSIXs/* 85 | rm -rf /codec/.codec/vscode/User/Backups/* 86 | rm -rf /codec/.codec/vscode/User/workspaceStorage/* 87 | rm -rf /codec/.codec/vscode/User/customBuiltinExtensionsCache.json 88 | 89 | echo "///CODEC///: Wipe docker..." 90 | codecdd clean 91 | 92 | echo "///CODEC///: Clear apt cache files..." 93 | sudo apt-get autoremove -y 94 | sudo apt-get clean 95 | sudo apt-get autoclean 96 | 97 | echo "///CODEC///: Wipe unused screens..." 98 | screen -wipe > /dev/null 2>&1 99 | 100 | echo "///CODEC///: Clear system logs..." 101 | sudo journalctl --rotate > /dev/null 2>&1 102 | sudo journalctl --vacuum-time=3s 103 | 104 | echo "///CODEC///: Finished!" 105 | exit 0 106 | fi 107 | 108 | ENABLED_MODS_PATH="/codec/.codec/enabled-mods" 109 | OPTIONAL_MODS_PATH="/codec/.codec/mods" 110 | LOGS_PATH="/etc/codec/logs" 111 | 112 | if [[ "$1" == "-em" || "$1" == "--modon" || "$1" == "modon" ]]; then 113 | MOD_NAME=$2 114 | if [ -z "$2" ]; then 115 | echo "You need to define a mod" 116 | exit 1 117 | fi 118 | echo "///CODEC///: Enable mod '$MOD_NAME'..." 119 | rm -rf $ENABLED_MODS_PATH/$MOD_NAME.*.sh 120 | if [ -f $OPTIONAL_MODS_PATH/$MOD_NAME.env.sh ]; then 121 | ln -s \ 122 | $OPTIONAL_MODS_PATH/$MOD_NAME.env.sh \ 123 | $ENABLED_MODS_PATH/$MOD_NAME.env.sh 124 | fi 125 | if [ -f $OPTIONAL_MODS_PATH/$MOD_NAME.boot.sh ]; then 126 | ln -s \ 127 | $OPTIONAL_MODS_PATH/$MOD_NAME.boot.sh \ 128 | $ENABLED_MODS_PATH/$MOD_NAME.boot.sh 129 | fi 130 | if [ -f $OPTIONAL_MODS_PATH/$MOD_NAME.async.sh ]; then 131 | ln -s \ 132 | $OPTIONAL_MODS_PATH/$MOD_NAME.async.sh \ 133 | $ENABLED_MODS_PATH/$MOD_NAME.async.sh 134 | fi 135 | if [ -f $OPTIONAL_MODS_PATH/$MOD_NAME.bash.sh ]; then 136 | ln -s \ 137 | $OPTIONAL_MODS_PATH/$MOD_NAME.bash.sh \ 138 | $ENABLED_MODS_PATH/$MOD_NAME.bash.sh 139 | fi 140 | 141 | echo "Apply the changes on next codec restart!" 142 | echo "Restart via: 'codec -r'" 143 | exit 0 144 | fi 145 | 146 | if [[ "$1" == "-dm" || "$1" == "--modoff" || "$1" == "modoff" ]]; then 147 | MOD_NAME=$2 148 | if [ -z "$2" ]; then 149 | echo "You need to define a mod" 150 | exit 1 151 | fi 152 | echo "///CODEC///: Disable mod '$MOD_NAME'..." 153 | rm -rf $ENABLED_MODS_PATH/$MOD_NAME.*.sh 154 | 155 | echo "Apply the changes on next codec restart!" 156 | echo "Restart via: 'codec -r'" 157 | exit 0 158 | fi 159 | 160 | # if first argument is -l or --log, print a logfile 161 | if [[ "$1" == "-l" || "$1" == "--log" || "$1" == "log" ]]; then 162 | LINES=$2 163 | if [ -z "$2" ]; then 164 | LINES="20" 165 | fi 166 | LOGNAME=$3 167 | if [ -z "$3" ]; then 168 | LOGNAME="boot" 169 | fi 170 | echo "///CODEC///: Logs of '/codec/.codec/logs/$LOGNAME_*.log' ..." 171 | if [[ "$LINES" == "all" ]]; then 172 | tail /codec/.codec/logs/$LOGNAME_*.log | cat -n 173 | else 174 | tail -n $LINES /codec/.codec/logs/$LOGNAME_*.log | cat -n 175 | fi 176 | 177 | echo "///CODEC///: Finished!" 178 | exit 0 179 | fi 180 | 181 | # if first argument is -w or --welcome, print welcome message and exit 182 | if [[ "$1" == "-w" || "$1" == "welcome" ]]; then 183 | echo " " 184 | echo " ▄▄ " 185 | echo " ▄▄█▀▀▀█▄█ ▀███ ▄▄█▀▀▀█▄█" 186 | echo "▄██▀ ▀█ ██ ▄██▀ ▀█" 187 | echo "██▀ ▀ ▄██▀██▄ ▄█▀▀███ ▄▄█▀████▀ ▀" 188 | echo "██ ██▀ ▀██▄██ ██ ▄█▀ ███ " 189 | echo "█▓▄ ██ ███▓█ █▓ ▓█▀▀▀▀▀▀▓▄ " 190 | echo "▀▓█▄ ▄▀██ ▓█▀▓█ █▓ ▓█▄ ▄▓█▄ ▄▀" 191 | echo "▓▓▓ ▓█ ▓▓▓▓▓ ▓▓ ▓▓▀▀▀▀▀▀▓▓ " 192 | echo "▒▓▓▒ ▓▀▓▓▓ ▓▓▓▀▒▓ ▓▒ ▒▓▓ ▒▓▓▒ ▓▀" 193 | echo " ▒ ▒ ▒ ▒▓ ▒ ▒ ▒ ▓ ▒ ▒ ▒ ▓ ▒ ▒ ▒ ▒▒ ▓ ▒ ▒ ▒▓ " 194 | echo " ▒ ▒ ▒▒ ▒ ▒ ▓ ▒ ▒ ▒ ▒ ▒ " 195 | echo " ▒ ▒ ▒ ▒ ▒ ▒ " 196 | echo " ▒ ▒ by NobleMajo " 197 | echo " Welcome to CodeC ▒ & CoreUnit.NET " 198 | echo " " 199 | exit 0 200 | fi 201 | 202 | # if first argument is -rh or --hash 203 | if [[ "$1" == "-rh" || "$1" == "---hash" || "$1" == "hash" ]]; then 204 | # print error if no second argument 205 | if [ -z "$2" ]; then 206 | echo "///CODEC///: No hash as second argument!" 207 | exit 1 208 | fi 209 | # print error if hash is shorter than 32 characters 210 | if [ ${#2} -lt 32 ]; then 211 | echo "///CODEC///: Hash is too short!" 212 | exit 1 213 | fi 214 | 215 | HASH=$2 216 | HASH=${HASH:0:64} 217 | 218 | printf "///CODEC///: Set new hash: \"%s\"\n" "$HASH" 219 | 220 | sed -i '/^hashed-password:/d' /codec/.codec/vscode-server.yaml 221 | echo -n "hashed-password: $HASH" >> /codec/.codec/vscode-server.yaml 222 | 223 | echo "///CODEC///: Hash set!" 224 | 225 | echo "///CODEC///: Codec is restarting..." 226 | echo "Please reload the page!" 227 | systemctl restart vscode 228 | exit 0 229 | fi 230 | 231 | PASSWORD="$2" 232 | # if the first argument is -i then ask for a password in a prompt and save it in the first argument 233 | if [[ 234 | "$1" == "-i" || 235 | "$1" == "--interactive" || 236 | "$1" == "interactive" || 237 | "$1" == "setpw" || 238 | "$1" == "prompt" 239 | ]]; then 240 | PASSWORD="" 241 | while [ ${#PASSWORD} -lt 8 ]; do 242 | echo "///CODEC///: Enter a password with min 8 letters:" 243 | read -s PASSWORD 244 | 245 | echo -n "///CODEC///: Enter password again:" 246 | read -s RE_PASSWORD 247 | echo 248 | if [ "$PASSWORD" != "$RE_PASSWORD" ]; then 249 | echo "///CODEC///: Passwords do not match! Try again!" 250 | echo "[CTRL] + [C] to abort" 251 | continue 252 | fi 253 | done 254 | fi 255 | 256 | # if first argument is -p, --password, -i or --interactive, set the password 257 | if [[ 258 | "$1" == "-p" || 259 | "$1" == "--pass" || 260 | "$1" == "pass" || 261 | "$1" == "-i" || 262 | "$1" == "--interactive" || 263 | "$1" == "interactive" || 264 | "$1" == "setpw" || 265 | "$1" == "prompt" 266 | ]]; then 267 | # print error if no $PASSWORD 268 | if [ -z "$PASSWORD" ]; then 269 | echo "///CODEC///: No password given!" 270 | exit 1 271 | fi 272 | # print error if password is shorter than 8 characters 273 | if [ ${#PASSWORD} -lt 8 ]; then 274 | echo "///CODEC///: Password is too short!" 275 | exit 1 276 | fi 277 | echo "///CODEC///: Set new password..." 278 | codec -rh "$(sha256sum2 "$PASSWORD")" 279 | 280 | echo "///CODEC///: New password set!" 281 | exit 0 282 | fi 283 | 284 | echo " / / / / /" 285 | echo " C O D E C " 286 | echo " / / / / / " 287 | echo " v2" 288 | echo "A Ubuntu 22.04 based vscode server docker image" 289 | 290 | if [[ "$1" == "-h" || "$1" == "help" ]]; then 291 | echo "" 292 | echo "Usage: 'codec [OPTION]'" 293 | echo "It is not possible to use multiple options." 294 | echo "Options:" 295 | echo " -h, help: print this help and exit" 296 | echo " -l, logs: show codec service logs" 297 | echo " -i, interactive: start interactive password prompt" 298 | echo " -p, pass : set password " 299 | echo " -rh, hash : saves a raw password hash" 300 | echo " -w, welcome: print welcome message and exit" 301 | echo " -fr, fast-restart: restart the vscode process" 302 | echo " -r, restart: restart the codec container" 303 | echo " -fd, free-disk: free some disk space" 304 | echo " -cc, clear-cache: clear codec cache" 305 | echo " -em, modon : Enable a codec mod" 306 | echo " -dm, modoff : Disable a codec mod" 307 | echo " -l, log : print a logfile (example: boot, dockerd)" 308 | else 309 | echo "Use 'codec -h' to get more informations about this command." 310 | fi 311 | 312 | echo "" 313 | echo " by NobleMajo" 314 | echo " & CoreUnit.NET" 315 | 316 | -------------------------------------------------------------------------------- /system/bin/codei: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # execute the "code --install-extension $1" for eacht argument 4 | for i in "$@" 5 | do 6 | code --force --install-extension $i 7 | done 8 | 9 | 10 | -------------------------------------------------------------------------------- /system/bin/codepr: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | if [ -z "$1" ]; then 4 | echo "No hash set!" 5 | exit 6 | fi 7 | 8 | HASH=$1 9 | HASH=${HASH:0:64} 10 | 11 | printf "Set new hash: \"%s\"\n" "$HASH" 12 | 13 | sed -i '/^hashed-password:/d' ~/.config/code-server/config.yaml 14 | echo -n "hashed-password: $HASH" >> ~/.config/code-server/config.yaml 15 | systemctl restart code-server@root 16 | 17 | echo "Hash set!" -------------------------------------------------------------------------------- /system/bin/codeu: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # execute the "code --install-extension $1" for eacht argument 4 | for i in "$@" 5 | do 6 | code --uninstall-extension $i 7 | done 8 | 9 | 10 | -------------------------------------------------------------------------------- /system/bin/screen-alive: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | if screen -list | grep -q "$1"; then 4 | echo "true" 5 | else 6 | echo "false" 7 | fi -------------------------------------------------------------------------------- /system/bin/screenit: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ -z $1 ]; then 4 | echo "The first parameter is missing. The first argument must be the screen and log name and the second argument must be the command to run." 5 | exit 1 6 | fi 7 | 8 | if [ -z $2 ]; then 9 | echo "The Second parameter is missing. The first argument must be the screen and log name and the second argument must be the command to run." 10 | exit 1 11 | fi 12 | 13 | echo "Start screen '$1'..." 14 | 15 | screen \ 16 | -dmS $1 \ 17 | -L -Logfile /codec/mounts/logs/codec/screen.$1.custom.mod.log \ 18 | bash -c \ 19 | "$2" 20 | 21 | echo "Screen '$1' started!" -------------------------------------------------------------------------------- /system/bin/sha256sum2: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | echo -n "$1" | sha256sum | cut -d' ' -f1 -------------------------------------------------------------------------------- /system/boot.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | source /etc/environment 4 | 5 | # clear cache files 6 | /etc/codec/cache.sh 7 | 8 | # health check 9 | /etc/codec/health.sh 10 | 11 | apt-get update 12 | 13 | # default vscode extensions 14 | /etc/codec/extensions.sh 15 | 16 | # init mod system 17 | source /etc/codec/mods.sh 18 | 19 | # reload sysctl 20 | sysctl -p 21 | 22 | # run vscode server service 23 | echo "[CODEC][VSCODE]: Start vscode service..." 24 | systemctl start vscode 25 | 26 | # init async mods 27 | /etc/codec/mods_async.sh 28 | 29 | echo "[CODEC][VSCODE]: Done!" 30 | -------------------------------------------------------------------------------- /system/cache.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | echo "[CODEC][CACHE]: Clear vscode cache files..." 4 | rm -rf /codec/mounts/vscode/User/caches 5 | rm -rf /codec/mounts/vscode/logs 6 | rm -rf /codec/mounts/vscode/CachedExtensions 7 | rm -rf /codec/mounts/vscode/coder-logs 8 | rm -rf /codec/mounts/vscode/User/customBuiltinExtensionsCache.json 9 | rm -rf /tmp/* 10 | 11 | -------------------------------------------------------------------------------- /system/codec.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Codec Service 3 | 4 | [Service] 5 | Type=simple 6 | PIDFile=/etc/codec/codec.pid 7 | ExecStart=/bin/bash -c /etc/codec/boot.sh 8 | StandardOutput=/codec/mounts/logs/codec_service.log 9 | StandardError=/codec/mounts/logs/codec_service_err.log 10 | 11 | [Install] 12 | WantedBy=multi-user.target -------------------------------------------------------------------------------- /system/deamon.json: -------------------------------------------------------------------------------- 1 | { 2 | "storage-driver": "vfs", 3 | "debug": true, 4 | "log-driver": "json-file", 5 | "log-opts": { 6 | "max-size": "24m", 7 | "max-file": "3" 8 | } 9 | } -------------------------------------------------------------------------------- /system/extensions.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | echo "[CODEC][EXTENSION]: Set vscode extension store..." 4 | export VSCODE_GALLERY=ms2 5 | /etc/codec/vscode_gallery.js &> /codec/mounts/logs/vscode_gallery.js.log 6 | 7 | echo "[CODEC][EXTENSION]: Install default extensions..." 8 | 9 | codei emmanuelbeziat.vscode-great-icons 10 | -------------------------------------------------------------------------------- /system/health.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | echo "[CODEC][HEALTH]: Create folder..." 4 | 5 | mkdir -p /codec/.codec/mods 6 | mkdir -p /codec/.codec/enabled-mods 7 | mkdir -p /etc/codec/logs 8 | mkdir -p /codec/mounts/logs 9 | mkdir -p /codec/archive 10 | mkdir -p /codec/ws 11 | 12 | echo "[CODEC][HEALTH]: Copy codec skel..." 13 | cp -nr /etc/codec/skel/* /codec/.codec/ 14 | 15 | echo "[CODEC][HEALTH]: Disable vscode telemetry..." 16 | /etc/codec/vscode_telemetry.js &> /codec/mounts/logs/vscode_telemetry.js.log 17 | echo "[CODEC][HEALTH]: Telemetry disabled!" 18 | 19 | echo "[CODEC][HEALTH]: Mounting..." 20 | /etc/codec/mounts.js &> /codec/mounts/logs/mount.js.log 21 | 22 | echo "[CODEC][HEALTH]: Linking 'config.yaml'..." 23 | mkdir -p /root/.config/code-server 24 | rm -rf /root/.config/code-server/config.yaml 25 | cp -n /etc/codec/vscode-server.yaml /codec/.codec/vscode-server.yaml 26 | ln -sf /codec/.codec/vscode-server.yaml /root/.config/code-server/config.yaml 27 | echo "Linked: '/root/.config/code-server/config.yaml'" 28 | 29 | echo "[CODEC][HEALTH]: Linking 'keybindings.json'..." 30 | mkdir -p /root/.local/share/code-server/User 31 | rm -rf /codec/mounts/vscode/User/keybindings.json 32 | ln -sf /codec/.codec/keybindings.json /root/.local/share/code-server/User/keybindings.json 33 | echo "Linked: '/root/.local/share/code-server/User/keybindings.json'" 34 | 35 | echo "[CODEC][HEALTH]: Linking 'vscode/User/settings.json'..." 36 | mkdir -p /root/.local/share/code-server/User 37 | rm -rf /codec/mounts/vscode/User/settings.json 38 | ln -sf /codec/.codec/settings.json /root/.local/share/code-server/User/settings.json 39 | echo "Linked: '/root/.local/share/code-server/User/settings.json'" 40 | 41 | echo "[CODEC][HEALTH]: Linking..." 42 | rm -rf /usr/lib/code-server/src/browser/pages 43 | ln -sf /etc/codec/login /usr/lib/code-server/src/browser/pages 44 | echo "Linked: '/usr/lib/code-server/src/browser'" 45 | 46 | echo "[CODEC][HEALTH]: Linking home 'ws' dir..." 47 | rm -rf /root/ws 48 | ln -sf /codec/ws /root/ws 49 | echo "Link in '/codec/ws' to '/root/ws' created!" 50 | 51 | echo "[CODEC][HEALTH]: Linking home 'workspace' dir..." 52 | rm -rf /root/workspace 53 | ln -sf /codec/ws /root/workspace 54 | echo "Link in '/root/workspace' to '/codec/ws' created!" 55 | 56 | echo "[CODEC][HEALTH]: Linking home 'codec' dir..." 57 | rm -rf /root/codec 58 | ln -sf /codec /root/codec 59 | echo "Link in '/root/codec' to '/codec' created!" 60 | -------------------------------------------------------------------------------- /system/login/bg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NobleMajo/codec/5516dc12746bf1e13662ad2cab33a8e4bb6730ad/system/login/bg.jpg -------------------------------------------------------------------------------- /system/login/error.css: -------------------------------------------------------------------------------- 1 | .error-display { 2 | box-sizing: border-box; 3 | padding: 20px; 4 | text-align: center; 5 | } 6 | 7 | .error-display > .header { 8 | font-size: 6rem; 9 | margin: 0; 10 | } 11 | 12 | .error-display > .body { 13 | color: #444; 14 | font-size: 1.2rem; 15 | } 16 | 17 | .error-display > .links { 18 | margin-top: 16px; 19 | } 20 | 21 | .error-display > .links > .link { 22 | color: rgb(87, 114, 245); 23 | text-decoration: none; 24 | } 25 | 26 | .error-display > .links > .link:hover { 27 | text-decoration: underline; 28 | } 29 | 30 | .error-display .success { 31 | color: green; 32 | } 33 | -------------------------------------------------------------------------------- /system/login/error.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 8 | 10 | 11 | {{ERROR_TITLE}} |CodeC 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 |
25 |

{{ERROR_HEADER}}

26 |
{{ERROR_BODY}}
27 | 30 |
31 |
32 | 33 | 34 | -------------------------------------------------------------------------------- /system/login/global.css: -------------------------------------------------------------------------------- 1 | html, 2 | body, 3 | #root { 4 | height: 100%; 5 | width: 100%; 6 | } 7 | 8 | body { 9 | background: #212121; 10 | color: #cccccc; 11 | margin: 0; 12 | font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", 13 | "Segoe UI Emoji", "Segoe UI Symbol"; 14 | overflow: hidden; 15 | } 16 | 17 | input, 18 | button { 19 | font-family: inherit; 20 | font-size: 1rem; 21 | line-height: 1rem; 22 | } 23 | 24 | .-button { 25 | background-color: #212121; 26 | border-radius: 5px; 27 | border: none; 28 | box-sizing: border-box; 29 | color: #ffffff; 30 | cursor: pointer; 31 | padding: 18px 20px; 32 | text-decoration: none; 33 | } 34 | 35 | .center-container { 36 | align-items: center; 37 | box-sizing: border-box; 38 | display: flex; 39 | flex-direction: column; 40 | justify-content: center; 41 | min-height: 100%; 42 | padding: 20px; 43 | width: 100%; 44 | } 45 | 46 | .card-box { 47 | background-color: #131313; 48 | border-radius: 5px; 49 | box-shadow: rgba(60, 66, 87, 0.117647) 0px 7px 14px 0px, rgba(0, 0, 0, 0.117647) 0px 3px 6px 0px; 50 | max-width: 650px; 51 | width: 100%; 52 | } 53 | 54 | .card-box > .header { 55 | border-bottom: 1px solid #EE8241; 56 | color: #444; 57 | padding: 30px; 58 | } 59 | 60 | .card-box > .header > .main { 61 | margin: 0; 62 | font-size: 1.5rem; 63 | } 64 | 65 | .card-box > .header > .sub { 66 | color: #555; 67 | margin-top: 10px; 68 | } 69 | 70 | .card-box > .content { 71 | padding: 40px; 72 | } 73 | 74 | .card-box > .content > .none { 75 | margin: 2px 0; 76 | } 77 | 78 | .card-box + .card-box { 79 | margin-top: 26px; 80 | } 81 | 82 | canvas { 83 | top: 0; 84 | left: 0; 85 | } 86 | -------------------------------------------------------------------------------- /system/login/login.css: -------------------------------------------------------------------------------- 1 | @import url("https://rsms.me/inter/inter.css"); 2 | html { 3 | font-family: "Inter", sans-serif; 4 | } 5 | @supports (font-variation-settings: normal) { 6 | html { 7 | font-family: "Inter var", sans-serif; 8 | } 9 | } 10 | 11 | body { 12 | font-family: "Inter", sans-serif; 13 | height: 100vh; 14 | background: url("./bg.jpg") 50% fixed; 15 | background-size: cover; 16 | } 17 | .wrapper { 18 | display: flex; 19 | align-items: center; 20 | flex-direction: column; 21 | justify-content: center; 22 | width: 100%; 23 | min-height: 100%; 24 | background: rgba(124, 53, 11, 0.33); 25 | } 26 | 27 | .user { 28 | display: none; 29 | } 30 | 31 | .error-box { 32 | margin-top: 18px; 33 | color: #a72a2aed; 34 | font-size: 22px; 35 | font-family: "Inter", sans-serif; 36 | width: 100%; 37 | text-align: center; 38 | } 39 | 40 | .info-box { 41 | position: absolute; 42 | bottom: 3%; 43 | right: 2%; 44 | background: rgba(0, 0, 0, 0.5); 45 | box-sizing: border-box; 46 | box-shadow: 0 15px 25px rgba(0, 0, 0, 0.6); 47 | border-radius: 10px; 48 | 49 | padding: 16px; 50 | font-size: 12px; 51 | text-align: right; 52 | width: 200px; 53 | } 54 | 55 | .login-box { 56 | position: absolute; 57 | top: 50%; 58 | left: 50%; 59 | width: 400px; 60 | padding: 40px; 61 | transform: translate(-50%, -50%); 62 | background: rgba(0, 0, 0, 0.5); 63 | box-sizing: border-box; 64 | box-shadow: 0 15px 25px rgba(0, 0, 0, 0.6); 65 | border-radius: 10px; 66 | } 67 | 68 | .login-box h2 { 69 | margin: 0 0 30px; 70 | padding: 0; 71 | color: #fff; 72 | text-align: center; 73 | } 74 | 75 | .login-box .user-box { 76 | position: relative; 77 | margin-top: 34px; 78 | } 79 | 80 | .login-box .user-box input { 81 | width: 100%; 82 | padding: 10px 0; 83 | font-size: 16px; 84 | color: #fff; 85 | margin-bottom: 30px; 86 | border: none; 87 | border-bottom: 1px solid #fff; 88 | outline: none; 89 | background: transparent; 90 | } 91 | .login-box .user-box label { 92 | position: absolute; 93 | top: 0; 94 | left: 0; 95 | padding: 10px 0; 96 | font-size: 16px; 97 | color: #fff; 98 | pointer-events: none; 99 | transition: 0.8s; 100 | } 101 | 102 | .login-box .user-box input:focus ~ label, 103 | .login-box .user-box input:valid ~ label { 104 | top: -24px; 105 | left: 0; 106 | color: #ee8241; 107 | font-size: 12px; 108 | } 109 | 110 | .login-box form a { 111 | position: relative; 112 | display: inline-block; 113 | padding: 10px 20px; 114 | color: #ee8241; 115 | font-size: 16px; 116 | text-decoration: none; 117 | text-transform: uppercase; 118 | overflow: hidden; 119 | transition: 0.8s; 120 | margin-top: 10px; 121 | letter-spacing: 4px; 122 | 123 | width: 100%; 124 | padding: 10px 0; 125 | text-align: center; 126 | } 127 | 128 | .login-box a:hover { 129 | background: #ee8241; 130 | color: #fff; 131 | border-radius: 5px; 132 | box-shadow: 0 0 5px #ee8241, 0 0 25px #ee8241, 0 0 50px #ee8241, 0 0 100px #ee8241; 133 | } 134 | 135 | .login-box a span { 136 | position: absolute; 137 | display: block; 138 | } 139 | 140 | .login-box a span:nth-child(1) { 141 | top: 0; 142 | left: -100%; 143 | width: 100%; 144 | height: 2px; 145 | background: linear-gradient(90deg, transparent, #ee8241); 146 | animation: btn-anim1 1s linear infinite; 147 | } 148 | 149 | @keyframes btn-anim1 { 150 | 0% { 151 | left: -100%; 152 | } 153 | 50%, 154 | 100% { 155 | left: 100%; 156 | } 157 | } 158 | 159 | .login-box a span:nth-child(2) { 160 | top: -100%; 161 | right: 0; 162 | width: 2px; 163 | height: 100%; 164 | background: linear-gradient(180deg, transparent, #ee8241); 165 | animation: btn-anim2 1s linear infinite; 166 | animation-delay: 0.25s; 167 | } 168 | 169 | @keyframes btn-anim2 { 170 | 0% { 171 | top: -100%; 172 | } 173 | 50%, 174 | 100% { 175 | top: 100%; 176 | } 177 | } 178 | 179 | .login-box a span:nth-child(3) { 180 | bottom: 0; 181 | right: -100%; 182 | width: 100%; 183 | height: 2px; 184 | background: linear-gradient(270deg, transparent, #ee8241); 185 | animation: btn-anim3 1s linear infinite; 186 | animation-delay: 0.5s; 187 | } 188 | 189 | @keyframes btn-anim3 { 190 | 0% { 191 | right: -100%; 192 | } 193 | 50%, 194 | 100% { 195 | right: 100%; 196 | } 197 | } 198 | 199 | .header .main { 200 | font-family: "Inter", sans-serif; 201 | } 202 | 203 | .header .sub { 204 | font-family: "Inter", sans-serif; 205 | } 206 | 207 | .login-box a span:nth-child(4) { 208 | bottom: -100%; 209 | left: 0; 210 | width: 2px; 211 | height: 100%; 212 | background: linear-gradient(360deg, transparent, #ee8241); 213 | animation: btn-anim4 1s linear infinite; 214 | animation-delay: 0.75s; 215 | } 216 | 217 | @keyframes btn-anim4 { 218 | 0% { 219 | bottom: -100%; 220 | } 221 | 50%, 222 | 100% { 223 | bottom: 100%; 224 | } 225 | } 226 | -------------------------------------------------------------------------------- /system/login/login.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 8 | 10 | Login |CodeC 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 |
24 | Made with 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 |
71 | by NobleMajo
72 | based on code-server
74 | & Ubuntu (Docker)
76 | powered by CoreUnitNET 77 |
78 | 79 | 115 | 116 |
117 | 204 | 205 | 206 | 207 | -------------------------------------------------------------------------------- /system/mods.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | echo "[CODEC][MOD]: Load mods..." 4 | 5 | ENABLED_MODS_PATH="/codec/.codec/enabled-mods" 6 | OPTIONAL_MODS_PATH="/codec/.codec/mods" 7 | LOGS_PATH="/etc/codec/logs/mods" 8 | BAK_LOGS_PATH="/etc/codec/logs/mods.bak" 9 | 10 | rm -rf $BAK_LOGS_PATH 11 | mv $LOGS_PATH $BAK_LOGS_PATH 12 | 13 | mkdir -p $ENABLED_MODS_PATH 14 | mkdir -p $OPTIONAL_MODS_PATH 15 | mkdir -p $LOGS_PATH 16 | 17 | ENV_MOD_PATHS=("$(find $ENABLED_MODS_PATH -name "*.env.sh")") 18 | BOOT_MOD_PATHS=("$(find $ENABLED_MODS_PATH -name "*.boot.sh")") 19 | ASYNC_MOD_PATHS=("$(find $ENABLED_MODS_PATH -name "*.async.sh")") 20 | BASH_MOD_PATHS=("$(find $ENABLED_MODS_PATH -name "*.bash.sh")") 21 | QUIT_MOD_PATHS=("$(find $ENABLED_MODS_PATH -name "*.quit.sh")") 22 | 23 | MOD_COUNTER=0 24 | 25 | for MOD_PATH in $ENV_MOD_PATHS; do 26 | chmod +x $MOD_PATH 27 | MOD_COUNTER=$(($MOD_COUNTER+1)) 28 | done 29 | for MOD_PATH in $BOOT_MOD_PATHS; do 30 | chmod +x $MOD_PATH 31 | MOD_COUNTER=$(($MOD_COUNTER+1)) 32 | done 33 | for MOD_PATH in $ASYNC_MOD_PATHS; do 34 | chmod +x $MOD_PATH 35 | MOD_COUNTER=$(($MOD_COUNTER+1)) 36 | done 37 | for MOD_PATH in $BASH_MOD_PATHS; do 38 | chmod +x $MOD_PATH 39 | MOD_COUNTER=$(($MOD_COUNTER+1)) 40 | done 41 | for MOD_PATH in $QUIT_MOD_PATHS; do 42 | chmod +x $MOD_PATH 43 | MOD_COUNTER=$(($MOD_COUNTER+1)) 44 | done 45 | 46 | # if codec cli quits 47 | if [[ "$1" == "-q" || "$1" == "--quit" || "$1" == "quit" ]]; then 48 | for QUIT_MOD_PATH in $QUIT_MOD_PATHS; do 49 | QUIT_MOD_NAME=$(basename "$QUIT_MOD_PATH") 50 | QUIT_MOD_LOGS_PATH=$LOGS_PATH/$QUIT_MOD_NAME.log 51 | echo "[CODEC][MOD][QUIT]: Load '$QUIT_MOD_NAME' for quit" 52 | touch $QUIT_MOD_LOGS_PATH 53 | source $QUIT_MOD_PATH &> $QUIT_MOD_LOGS_PATH 54 | echo "[CODEC][MOD][QUIT]: '$QUIT_MOD_NAME' loaded!" 55 | done 56 | 57 | echo "[CODEC][MOD][QUIT]: All finished!" 58 | 59 | exit 0 60 | fi 61 | 62 | echo "[CODEC][MOD]: $MOD_COUNTER mods found!" 63 | 64 | export CODEC_ALL_APT_PACKAGES="" 65 | export CODEC_ALL_NPM_PACKAGES="" 66 | export HOME="/root" 67 | 68 | for ENV_MOD_PATH in $ENV_MOD_PATHS; do 69 | ENV_MOD_NAME=$(basename "$ENV_MOD_PATH") 70 | ENV_MOD_LOGS_PATH=$LOGS_PATH/$ENV_MOD_NAME.log 71 | echo "[CODEC][MOD][ENV]: Load '$ENV_MOD_NAME' env" 72 | touch $ENV_MOD_LOGS_PATH 73 | source $ENV_MOD_PATH &> $ENV_MOD_LOGS_PATH 74 | echo "[CODEC][MOD][ENV]: '$ENV_MOD_NAME' loaded!" 75 | if [ "$CODEC_APT_PACKAGES" != "" ]; then 76 | if [ "$CODEC_ALL_APT_PACKAGES" != "" ]; then 77 | export CODEC_ALL_APT_PACKAGES="$CODEC_ALL_APT_PACKAGES $CODEC_APT_PACKAGES" 78 | else 79 | export CODEC_ALL_APT_PACKAGES="$CODEC_APT_PACKAGES" 80 | fi 81 | 82 | export CODEC_APT_PACKAGES="" 83 | fi 84 | if [ "$CODEC_NPM_PACKAGES" != "" ]; then 85 | if [ "$CODEC_ALL_NPM_PACKAGES" != "" ]; then 86 | export CODEC_ALL_NPM_PACKAGES="$CODEC_ALL_NPM_PACKAGES $CODEC_NPM_PACKAGES" 87 | else 88 | export CODEC_ALL_NPM_PACKAGES="$CODEC_NPM_PACKAGES" 89 | fi 90 | 91 | export CODEC_NPM_PACKAGES="" 92 | fi 93 | done 94 | 95 | source /codec/.codec/env.sh &> $LOGS_PATH/env.log 96 | 97 | apt-get update 98 | if [ "$CODEC_ALL_APT_PACKAGES" != "" ]; then 99 | echo "[CODEC][MOD][APT]: Install following packages:" 100 | echo "'$CODEC_ALL_APT_PACKAGES'" 101 | apt-get install -y --no-install-recommends $CODEC_ALL_APT_PACKAGES 102 | else 103 | echo "[CODEC][MOD][APT]: No apt packages defined!" 104 | fi 105 | 106 | if [ "$CODEC_ALL_NPM_PACKAGES" != "" ]; then 107 | echo "[CODEC][MOD][NPM]: Install following packages:" 108 | echo "'$CODEC_ALL_NPM_PACKAGES'" 109 | npm i -g $CODEC_ALL_NPM_PACKAGES 110 | else 111 | echo "[CODEC][MOD][NPM]: No npm packages defined!" 112 | fi 113 | 114 | for BOOT_MOD_PATH in $BOOT_MOD_PATHS; do 115 | BOOT_MOD_NAME=$(basename "$BOOT_MOD_PATH") 116 | BOOT_MOD_LOGS_PATH=$LOGS_PATH/$BOOT_MOD_NAME.log 117 | echo "[CODEC][MOD][BOOT]: Start '$BOOT_MOD_NAME'..." 118 | touch $BOOT_MOD_LOGS_PATH 119 | $BOOT_MOD_PATH &> $BOOT_MOD_LOGS_PATH 120 | echo "[CODEC][MOD][BOOT]: '$BOOT_MOD_NAME' done!" 121 | done 122 | -------------------------------------------------------------------------------- /system/mods_async.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | echo "[CODEC][MOD]: Load mods..." 4 | 5 | ENABLED_MODS_PATH="/codec/.codec/enabled-mods" 6 | OPTIONAL_MODS_PATH="/codec/.codec/mods" 7 | LOGS_PATH="/etc/codec/logs/mods" 8 | 9 | ASYNC_MOD_PATHS=("$(find $ENABLED_MODS_PATH -name "*.async.sh")") 10 | 11 | for ASYNC_MOD_PATH in $ASYNC_MOD_PATHS; do 12 | ASYNC_MOD_NAME=$(basename "$ASYNC_MOD_PATH") 13 | ASYNC_MOD_LOGS_PATH=$LOGS_PATH/$ASYNC_MOD_NAME.log 14 | echo "[CODEC][MOD][ASYNC]: Start '$ASYNC_MOD_NAME' async..." 15 | touch $ASYNC_MOD_LOGS_PATH 16 | $ASYNC_MOD_PATH &> $ASYNC_MOD_LOGS_PATH 17 | echo "Started $ASYNC_MOD_NAME async in background!" 18 | done 19 | 20 | -------------------------------------------------------------------------------- /system/mounts.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | const fs = require("fs").promises 4 | const path = require("path") 5 | const mounts = require("/codec/.codec/mounts.json") 6 | 7 | const mounts2 = {} 8 | let targets = Object.keys(mounts).map( 9 | (key) => { 10 | const target = path.normalize("/codec/mounts/" + key) 11 | mounts2[target] = mounts[key] 12 | return target 13 | } 14 | ) 15 | 16 | async function func() { 17 | await Promise.all( 18 | targets.map(createTargetLink) 19 | ) 20 | console.info("Done!") 21 | } 22 | func() 23 | 24 | async function createTargetLink( 25 | target 26 | ) { 27 | try { 28 | for (const target2 of targets.filter((target2) => target2 != target)) { 29 | if (target.startsWith(target2)) { 30 | console.info("### Wait for '" + target2 + "' before create '" + target + "'") 31 | return 32 | } 33 | } 34 | console.info("### Create link for '" + target + "'") 35 | let link = mounts2[target] 36 | if (!link.startsWith("/")) { 37 | link = "/codec/mounts/" + link 38 | } 39 | link = path.normalize(link) 40 | console.info("### Create link and target parent dirs if not exist!") 41 | await Promise.all([ 42 | fs.mkdir( 43 | path.dirname(target), 44 | { 45 | recursive: true 46 | } 47 | ), 48 | fs.mkdir( 49 | path.dirname(link), 50 | { 51 | recursive: true 52 | } 53 | ) 54 | ]) 55 | await codecLink( 56 | link, 57 | target 58 | ) 59 | targets = targets.filter((target2) => target2 != target) 60 | for (const target2 of targets) { 61 | if (target2.startsWith(target)) { 62 | await createTargetLink(target2) 63 | } 64 | } 65 | } catch (err) { 66 | console.error("Failed to link '" + target + "':\n", err) 67 | } 68 | } 69 | 70 | async function codecLink( 71 | link, 72 | target 73 | ) { 74 | targetParent = fileParent(target) 75 | linkParent = fileParent(link) 76 | 77 | try { 78 | await fs.mkdir( 79 | targetParent, 80 | { 81 | recursive: true, 82 | } 83 | ) 84 | } catch (err) { } 85 | try { 86 | await fs.mkdir( 87 | linkParent, 88 | { 89 | recursive: true, 90 | } 91 | ) 92 | } catch (err) { } 93 | 94 | let [targetExists, targetIsDir, targetIsLink] = await fileStats(target) 95 | let [linkExists, linkIsDir, linkIsLink] = await fileStats(link) 96 | 97 | console.debug("link stats: ", { 98 | link, 99 | target, 100 | linkExists, 101 | linkIsDir, 102 | linkIsLink, 103 | targetExists, 104 | targetIsDir, 105 | targetIsLink, 106 | }) 107 | 108 | if (targetIsLink) { 109 | await fs.rm( 110 | targetIsLink, 111 | { 112 | recursive: true, 113 | force: true, 114 | } 115 | ) 116 | targetIsLink = false 117 | targetIsDir = false 118 | targetExists = false 119 | } 120 | 121 | if (linkIsLink) { 122 | await fs.rm( 123 | link, 124 | { 125 | recursive: true, 126 | force: true, 127 | } 128 | ) 129 | linkIsLink = false 130 | linkIsDir = false 131 | linkExists = false 132 | } 133 | 134 | if (targetExists) { 135 | if (linkExists) { 136 | console.debug("remove file at link: " + link) 137 | await fs.rm( 138 | link, 139 | { 140 | recursive: true, 141 | force: true, 142 | } 143 | ) 144 | } 145 | } else { 146 | if (linkExists) { 147 | console.debug("copy file at link path to target: " + link + " > " + target) 148 | await fs.cp( 149 | link, 150 | target, 151 | { 152 | recursive: true, 153 | force: true, 154 | } 155 | ) 156 | await fs.rm( 157 | link, 158 | { 159 | recursive: true, 160 | force: true, 161 | } 162 | ) 163 | } else { 164 | console.debug("create target dir: " + target) 165 | await fs.mkdir( 166 | target, 167 | { 168 | recursive: true, 169 | } 170 | ) 171 | } 172 | } 173 | 174 | console.debug("link: '" + link + "' > '" + target + "'") 175 | await fs.symlink( 176 | target, 177 | link, 178 | ) 179 | } 180 | 181 | async function fileStats(path) { 182 | try { 183 | const stat = await fs.stat(path) 184 | return [stat.isDirectory() || stat.isFile(), stat.isDirectory(), stat.isSymbolicLink()] 185 | } catch (e) { } 186 | return [false, false, false] 187 | } 188 | 189 | function fileParent(filename) { 190 | return path.basename(path.dirname(filename)) 191 | } -------------------------------------------------------------------------------- /system/reboot.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | systemctl stop vscode@root 4 | 5 | source /etc/environment 6 | systemctl daemon-reload 7 | 8 | systemctl start codec 9 | -------------------------------------------------------------------------------- /system/shutdown.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | echo "Shutdown..." 4 | shutdown -P 0 5 | -------------------------------------------------------------------------------- /system/skel/bin/allow: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # print error if $1 is empty 4 | if [ -z "$1" ]; then 5 | echo "Error: $1 is not defined!" 6 | exit 1 7 | fi 8 | 9 | # print error if $1 is not a file 10 | if [ ! -f "$1" ]; then 11 | echo "Error: $1 is a folder!" 12 | exit 1 13 | fi 14 | 15 | chmod +x $1 16 | -------------------------------------------------------------------------------- /system/skel/bin/aptup: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | export DEBIAN_FRONTEND=noninteractive 4 | 5 | sudo -E apt-get update 6 | sudo -E apt-get full-upgrade -y 7 | sudo -E apt-get autoremove -y 8 | sudo -E apt-get clean 9 | sudo -E rm -rf /tmp/* 10 | 11 | -------------------------------------------------------------------------------- /system/skel/bin/dockerstat: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | echo "Docker container stats:" 4 | docker stats --no-trunc --no-stream --format "table {{.Name}} | {{.CPUPerc}} | {{.MemUsage}}" -------------------------------------------------------------------------------- /system/skel/bin/dockertop: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | docker stats --format "table {{.Name}} | CPU {{.CPUPerc}} | MEM {{.MemUsage}}" 4 | -------------------------------------------------------------------------------- /system/skel/bin/eclean: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | export DEBIAN_FRONTEND=noninteractive 4 | 5 | apt-get autoclean 6 | apt-get clean 7 | rm -rf /var/lib/apt/lists/* 8 | rm -rf /tmp/* 9 | rm -rf /root/.cache 10 | rm -rf /home/*/.cache 11 | 12 | apt-get update 13 | apt-get --purge remove "$(dpkg --list | grep -E -i 'linux-image|linux-headers' | awk '/ii/{ print $2}' | grep -E -v "$i")" 14 | 15 | docker ps -q | xargs docker stop 16 | docker ps -q | xargs docker kill 17 | docker ps -q -a | xargs docker rm 18 | docker image prune -a -f 19 | rm -rf /var/lib/docker 20 | 21 | apt-get update 22 | apt-get full-upgrade -yq 23 | apt-get autoremove ––purge -yq 24 | apt-get autoclean 25 | apt-get clean 26 | rm -rf /var/lib/apt/lists/* 27 | rm -rf /tmp/* 28 | rm -rf /root/.cache 29 | rm -rf /home/*/.cache -------------------------------------------------------------------------------- /system/skel/bin/gin: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | git branch -a 4 | git status -------------------------------------------------------------------------------- /system/skel/bin/gtree: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | git log --graph --oneline --decorate -------------------------------------------------------------------------------- /system/skel/bin/gundo: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | if [ "$1" == "-f" ]; then 4 | echo "Undo the last commit:" 5 | git log -1 --pretty=%B 6 | else 7 | echo "Press [ENTER] to undo the last commit:" 8 | git log -1 --pretty=%B 9 | echo "(or [CTRL+C] to abort)" 10 | read 11 | fi 12 | git reset --soft HEAD~1 13 | echo "DONE!" 14 | gin -------------------------------------------------------------------------------- /system/skel/bin/killport: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | if [ -z "$1" ] || [ "$1" -lt 1 ] || [ "$1" -gt 65535 ]; then 4 | echo "Invalid port number" 5 | exit 1 6 | fi 7 | 8 | sudo lsof -i ":$1" 9 | sudo kill -9 "$(sudo lsof -t -i :$1)" -------------------------------------------------------------------------------- /system/skel/bin/latexi: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | echo " ### Install latex deps..." 4 | sudo -E apt-get install -y \ 5 | latexmk biber \ 6 | texlive-bibtex-extra texlive-lang-german \ 7 | texlive texlive-lang-european texlive-pictures \ 8 | texlive-latex-base texlive-latex-extra \ 9 | texlive-fonts-recommended texlive-fonts-extra 10 | 11 | echo " ### Finished!" -------------------------------------------------------------------------------- /system/skel/bin/map: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | echo "Map keys:" 4 | echo " - 'q' = Quit/Exit" 5 | echo " - 'a' = Zoom in" 6 | echo " - 'y' = Zoom out" 7 | echo " - Arrows = Navigate" 8 | echo " - Mouse = Navigate & Zoom" 9 | 10 | telnet mapscii.me 11 | 12 | clear -------------------------------------------------------------------------------- /system/skel/bin/myip: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | echo "### External IP Address ###" 4 | echo -n "CURL: IPINFO.IO: " 5 | curl https://ipinfo.io/ip 6 | echo "" 7 | echo -n "WGET: IFCONFIG.ME: " 8 | wget -qO- ifconfig.me/ip 9 | echo "" -------------------------------------------------------------------------------- /system/skel/bin/ports: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | sudo lsof -i UDP -P -n 4 | sudo lsof -i -P -n | grep LISTEN -------------------------------------------------------------------------------- /system/skel/bin/sbash: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | if [ "$(screen-alive 'sbash')" == "false" ] ; then 4 | echo "create screen..." 5 | screen -SU sbash sudo -u codec bash 6 | else 7 | echo "enter screen..." 8 | screen -xU sbash 9 | fi -------------------------------------------------------------------------------- /system/skel/bin/wttr: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | if [ -z "$1" ] || [ "${#1}" -lt 1 ]; then 4 | echo "First argument needs to be a city name!" 5 | exit 1 6 | fi 7 | 8 | curl wttr.in/$1 -------------------------------------------------------------------------------- /system/skel/default.code-workspace: -------------------------------------------------------------------------------- 1 | { 2 | "folders": [ 3 | { 4 | "name": "CodeC", 5 | "path": "/codec/.codec" 6 | }, 7 | { 8 | "name": "Mounts", 9 | "path": "/codec/mounts" 10 | }, 11 | { 12 | "name": "Archive", 13 | "path": "/codec/archive" 14 | }, 15 | { 16 | "name": "Workspace", 17 | "path": "/codec/ws" 18 | } 19 | ], 20 | "settings": {} 21 | } -------------------------------------------------------------------------------- /system/skel/keybindings.json: -------------------------------------------------------------------------------- 1 | [ 2 | // --- NobleMajo Eclipse --- 3 | // NobleMajo's Eclipse keymap is a eclipse ide shortcut keymap. 4 | // The best of eclipse and vscode. 5 | // 6 | // Windows/Linux 7 | { 8 | "key": "ctrl+f", 9 | "command": "actions.find", 10 | "when": "!isMac && actionsFind" 11 | }, 12 | { 13 | "key": "ctrl+y", 14 | "command": "redo", 15 | "when": "!isMac && textInputFocus && !editorReadonly" 16 | }, 17 | { 18 | "key": "ctrl+numpad_divide", 19 | "command": "editor.fold", 20 | "when": "!isMac && editorFocus" 21 | }, 22 | { 23 | "key": "ctrl+numpad_multiply", 24 | "command": "editor.unfold", 25 | "when": "!isMac && editorFocus" 26 | }, 27 | { 28 | "key": "ctrl+shift+numpad_divide", 29 | "command": "editor.foldAll", 30 | "when": "!isMac && editorFocus" 31 | }, 32 | { 33 | "key": "ctrl+shift+numpad_multiply", 34 | "command": "editor.unfoldAll", 35 | "when": "!isMac && editorFocus" 36 | }, 37 | { 38 | "key": "ctrl+3", 39 | "command": "workbench.action.showCommands", 40 | "when": "!isMac" 41 | }, 42 | { 43 | "key": "ctrl+shift+r", 44 | "command": "workbench.action.quickOpen", 45 | "when": "!isMac" 46 | }, 47 | { 48 | "key": "ctrl+h", 49 | "command": "workbench.view.search", 50 | "when": "!isMac" 51 | }, 52 | { 53 | "key": "ctrl+shift+t", 54 | "command": "workbench.action.showAllSymbols", 55 | "when": "!isMac" 56 | }, 57 | { 58 | "key": "ctrl+l", 59 | "command": "workbench.action.gotoLine", 60 | "when": "!isMac" 61 | }, 62 | { 63 | "key": "ctrl+w", 64 | "command": "workbench.action.closeActiveEditor", 65 | "when": "!isMac" 66 | }, 67 | { 68 | "key": "ctrl+shift+s", 69 | "command": "workbench.action.files.saveAll", 70 | "when": "!isMac" 71 | }, 72 | { 73 | "key": "ctrl+alt+s", 74 | "command": "workbench.action.files.saveAs", 75 | "when": "!isMac" 76 | }, 77 | { 78 | "key": "ctrl+alt+t", 79 | "command": "workbench.action.terminal.toggleTerminal", 80 | "when": "!isMac" 81 | }, 82 | { 83 | "key": "ctrl+m", 84 | "command": "workbench.action.toggleSidebarVisibility", 85 | "when": "!isMac" 86 | }, 87 | { 88 | "key": "ctrl+e", 89 | "command": "workbench.action.openPreviousRecentlyUsedEditorInGroup", 90 | "when": "!isMac" 91 | }, 92 | { 93 | "key": "ctrl+shift+w", 94 | "command": "workbench.action.closeAllEditors", 95 | "when": "!isMac" 96 | }, 97 | { 98 | "key": "ctrl+shift+f4", 99 | "command": "workbench.action.closeAllEditors", 100 | "when": "!isMac" 101 | }, 102 | { 103 | "key": "ctrl+f12", 104 | "command": "workbench.action.focusActiveEditorGroup", 105 | "when": "!isMac" 106 | }, 107 | { 108 | "key": "ctrl+shift+c", 109 | "command": "editor.action.commentLine", 110 | "when": "!isMac && editorTextFocus" 111 | }, 112 | { 113 | "key": "ctrl+shift+/", 114 | "command": "editor.action.blockComment", 115 | "when": "!isMac && editorTextFocus" 116 | }, 117 | { 118 | "key": "ctrl+alt+y", 119 | "command": "editor.action.toggleWordWrap", 120 | "when": "!isMac && editorTextFocus" 121 | }, 122 | { 123 | "key": "ctrl+alt+j", 124 | "command": "editor.action.joinLines", 125 | "when": "!isMac && editorTextFocus" 126 | }, 127 | { 128 | "key": "ctrl+o", 129 | "command": "workbench.action.gotoSymbol", 130 | "when": "!isMac && editorTextFocus" 131 | }, 132 | { 133 | "key": "ctrl+shift+f", 134 | "command": "editor.action.formatSelection", 135 | "when": "!isMac && editorTextFocus && editorHasSelection" 136 | }, 137 | { 138 | "key": "ctrl+shift+f", 139 | "command": "editor.action.formatDocument", 140 | "when": "!isMac && editorTextFocus && !editorHasSelection" 141 | }, 142 | { 143 | "key": "cmd+shift+down", 144 | "command": "editor.action.copyLinesDownAction", 145 | "when": "!isMac && editorTextFocus" 146 | }, 147 | { 148 | "key": "cmd+shift+up", 149 | "command": "editor.action.copyLinesUpAction", 150 | "when": "!isMac && editorTextFocus" 151 | }, 152 | { 153 | "key": "alt+down", 154 | "command": "editor.action.moveLinesDownAction", 155 | "when": "!isMac && editorTextFocus" 156 | }, 157 | { 158 | "key": "alt+up", 159 | "command": "editor.action.moveLinesUpAction", 160 | "when": "!isMac && editorTextFocus" 161 | }, 162 | { 163 | "key": "ctrl+d", 164 | "command": "editor.action.deleteLines", 165 | "when": "!isMac && editorTextFocus" 166 | }, 167 | { 168 | "key": "ctrl+shift+delete", 169 | "command": "deleteAllRight", 170 | "when": "!isMac && editorTextFocus" 171 | }, 172 | { 173 | "key": "ctrl+alt+r", 174 | "command": "editor.action.rename", 175 | "when": "!isMac && editorTextFocus" 176 | }, 177 | { 178 | "key": "ctrl+shift+o", 179 | "command": "editor.action.organizeImports", 180 | "when": "!isMac && editorTextFocus && !editorReadonly && supportedCodeAction =~ /(\\s|^)source\\.organizeImports\\b/" 181 | }, 182 | { 183 | "key": "ctrl+space", 184 | "command": "editor.action.triggerSuggest", 185 | "when": "!isMac && editorTextFocus" 186 | }, 187 | { 188 | "key": "ctrl+.", 189 | "command": "editor.action.marker.next", 190 | "when": "!isMac && editorFocus && !editorReadonly" 191 | }, 192 | { 193 | "key": "f3", 194 | "command": "editor.action.goToDeclaration", 195 | "when": "!isMac && editorTextFocus" 196 | }, 197 | { 198 | "key": "ctrl+1", 199 | "command": "editor.action.quickFix", 200 | "when": "!isMac && editorTextFocus" 201 | }, 202 | { 203 | "key": "ctrl+shift+g", 204 | "command": "editor.action.referenceSearch.trigger", 205 | "when": "!isMac && editorTextFocus" 206 | }, 207 | { 208 | "key": "ctrl+shift+b", 209 | "command": "editor.debug.action.toggleBreakpoint", 210 | "when": "!isMac && editorTextFocus" 211 | }, 212 | { 213 | "key": "ctrl+shift+x", 214 | "command": "editor.action.transformToUppercase", 215 | "when": "!isMac && editorTextFocus" 216 | }, 217 | { 218 | "key": "ctrl+shift+y", 219 | "command": "editor.action.transformToLowercase", 220 | "when": "!isMac && editorTextFocus" 221 | }, 222 | { 223 | "key": "ctrl+shift+k", 224 | "command": "editor.action.previousSelectionMatchFindAction", 225 | "when": "!isMac && editorTextFocus" 226 | }, 227 | { 228 | "key": "alt+left", 229 | "command": "cursorWordPartLeft", 230 | "when": "!isMac && textInputFocus" 231 | }, 232 | { 233 | "key": "alt+right", 234 | "command": "cursorWordPartRight", 235 | "when": "!isMac && textInputFocus" 236 | }, 237 | { 238 | "key": "alt+shift+left", 239 | "command": "cursorWordPartLeftSelect", 240 | "when": "!isMac && textInputFocus" 241 | }, 242 | { 243 | "key": "alt+shift+right", 244 | "command": "cursorWordPartRightSelect", 245 | "when": "!isMac && textInputFocus" 246 | }, 247 | { 248 | "key": "ctrl+alt+left", 249 | "command": "workbench.action.navigateBack", 250 | "when": "!isMac" 251 | }, 252 | { 253 | "key": "ctrl+alt+right", 254 | "command": "workbench.action.navigateForward", 255 | "when": "!isMac" 256 | }, 257 | { 258 | "key": "f8", 259 | "command": "workbench.action.debug.continue", 260 | "when": "!isMac && inDebugMode" 261 | }, 262 | { 263 | "key": "ctrl+shift+f11", 264 | "command": "workbench.action.debug.start", 265 | "when": "!isMac && !inDebugMode" 266 | }, 267 | { 268 | "key": "f5", 269 | "command": "workbench.action.debug.stepInto", 270 | "when": "!isMac && inDebugMode" 271 | }, 272 | { 273 | "key": "f7", 274 | "command": "workbench.action.debug.stepOut", 275 | "when": "!isMac && inDebugMode" 276 | }, 277 | { 278 | "key": "f6", 279 | "command": "workbench.action.debug.stepOver", 280 | "when": "!isMac && inDebugMode" 281 | }, 282 | { 283 | "key": "ctrl+f2", 284 | "command": "workbench.action.debug.stop", 285 | "when": "!isMac && inDebugMode" 286 | }, 287 | { 288 | "key": "ctrl+shift+C", 289 | "command": "-editor.action.commentLine", 290 | "when": "!isMac && editorTextFocus && !editorReadonly" 291 | }, 292 | { 293 | "key": "ctrl+shift+C", 294 | "command": "-toggleExplainMode", 295 | "when": "!isMac && suggestWidgetVisible" 296 | }, 297 | { 298 | "key": "ctrl+shift+z", 299 | "command": "-redo", 300 | "when": "!isMac && textInputFocus && !editorReadonly" 301 | }, 302 | { 303 | "key": "shift+alt+z", 304 | "command": "workbench.action.files.saveLocalFile", 305 | "when": "!isMac && remoteFileDialogVisible" 306 | }, 307 | { 308 | "key": "shift+alt+z", 309 | "command": "-workbench.action.files.saveAs", 310 | "when": "!isMac" 311 | }, 312 | { 313 | "key": "shift+ctrl+s", 314 | "command": "-workbench.action.files.saveAs", 315 | "when": "!isMac" 316 | }, 317 | { 318 | "key": "shift+ctrl+s", 319 | "command": "-workbench.action.files.saveLocalFile", 320 | "when": "!isMac && remoteFileDialogVisible" 321 | }, 322 | { 323 | "key": "shift+alt+q", 324 | "command": "workbench.action.closeWindow", 325 | "when": "!isMac" 326 | }, 327 | { 328 | "key": "shift+ctrl+w", 329 | "command": "-workbench.action.closeWindow", 330 | "when": "!isMac" 331 | }, 332 | { 333 | "key": "alt+d", 334 | "command": "editor.action.addSelectionToNextFindMatch", 335 | "when": "!isMac && editorFocus" 336 | }, 337 | // MacOS 338 | { 339 | "key": "cmd+f", 340 | "command": "actions.find", 341 | "when": "isMac && actionsFind" 342 | }, 343 | { 344 | "key": "cmd+y", 345 | "command": "redo", 346 | "when": "isMac && textInputFocus && !editorReadonly" 347 | }, 348 | { 349 | "key": "cmd+numpad_divide", 350 | "command": "editor.fold", 351 | "when": "isMac && editorFocus" 352 | }, 353 | { 354 | "key": "cmd+numpad_multiply", 355 | "command": "editor.unfold", 356 | "when": "isMac && editorFocus" 357 | }, 358 | { 359 | "key": "cmd+shift+numpad_divide", 360 | "command": "editor.foldAll", 361 | "when": "isMac && editorFocus" 362 | }, 363 | { 364 | "key": "cmd+shift+numpad_multiply", 365 | "command": "editor.unfoldAll", 366 | "when": "isMac && editorFocus" 367 | }, 368 | { 369 | "key": "cmd+3", 370 | "command": "workbench.action.showCommands", 371 | "when": "isMac" 372 | }, 373 | { 374 | "key": "cmd+shift+r", 375 | "command": "workbench.action.quickOpen", 376 | "when": "isMac" 377 | }, 378 | { 379 | "key": "cmd+h", 380 | "command": "workbench.view.search", 381 | "when": "isMac" 382 | }, 383 | { 384 | "key": "cmd+shift+t", 385 | "command": "workbench.action.showAllSymbols", 386 | "when": "isMac" 387 | }, 388 | { 389 | "key": "cmd+l", 390 | "command": "workbench.action.gotoLine", 391 | "when": "isMac" 392 | }, 393 | { 394 | "key": "cmd+w", 395 | "command": "workbench.action.closeActiveEditor", 396 | "when": "isMac" 397 | }, 398 | { 399 | "key": "cmd+shift+s", 400 | "command": "workbench.action.files.saveAll", 401 | "when": "isMac" 402 | }, 403 | { 404 | "key": "cmd+alt+s", 405 | "command": "workbench.action.files.saveAs", 406 | "when": "isMac" 407 | }, 408 | { 409 | "key": "cmd+alt+t", 410 | "command": "workbench.action.terminal.toggleTerminal", 411 | "when": "isMac" 412 | }, 413 | { 414 | "key": "cmd+m", 415 | "command": "workbench.action.toggleSidebarVisibility", 416 | "when": "isMac" 417 | }, 418 | { 419 | "key": "cmd+e", 420 | "command": "workbench.action.openPreviousRecentlyUsedEditorInGroup", 421 | "when": "isMac" 422 | }, 423 | { 424 | "key": "cmd+shift+w", 425 | "command": "workbench.action.closeAllEditors", 426 | "when": "isMac" 427 | }, 428 | { 429 | "key": "cmd+shift+f4", 430 | "command": "workbench.action.closeAllEditors", 431 | "when": "isMac" 432 | }, 433 | { 434 | "key": "cmd+f12", 435 | "command": "workbench.action.focusActiveEditorGroup", 436 | "when": "isMac" 437 | }, 438 | { 439 | "key": "cmd+shift+c", 440 | "command": "editor.action.commentLine", 441 | "when": "isMac && editorTextFocus" 442 | }, 443 | { 444 | "key": "cmd+shift+/", 445 | "command": "editor.action.blockComment", 446 | "when": "isMac && editorTextFocus" 447 | }, 448 | { 449 | "key": "cmd+alt+y", 450 | "command": "editor.action.toggleWordWrap", 451 | "when": "isMac && editorTextFocus" 452 | }, 453 | { 454 | "key": "cmd+alt+j", 455 | "command": "editor.action.joinLines", 456 | "when": "isMac && editorTextFocus" 457 | }, 458 | { 459 | "key": "cmd+o", 460 | "command": "workbench.action.gotoSymbol", 461 | "when": "isMac && editorTextFocus" 462 | }, 463 | { 464 | "key": "cmd+shift+f", 465 | "command": "editor.action.formatSelection", 466 | "when": "isMac && editorTextFocus && editorHasSelection" 467 | }, 468 | { 469 | "key": "cmd+shift+f", 470 | "command": "editor.action.formatDocument", 471 | "when": "isMac && editorTextFocus && !editorHasSelection" 472 | }, 473 | { 474 | "key": "ctrl+shift+down", 475 | "command": "editor.action.copyLinesDownAction", 476 | "when": "isMac && editorTextFocus" 477 | }, 478 | { 479 | "key": "ctrl+shift+up", 480 | "command": "editor.action.copyLinesUpAction", 481 | "when": "isMac && editorTextFocus" 482 | }, 483 | { 484 | "key": "alt+down", 485 | "command": "editor.action.moveLinesDownAction", 486 | "when": "isMac && editorTextFocus" 487 | }, 488 | { 489 | "key": "alt+up", 490 | "command": "editor.action.moveLinesUpAction", 491 | "when": "isMac && editorTextFocus" 492 | }, 493 | { 494 | "key": "cmd+d", 495 | "command": "editor.action.deleteLines", 496 | "when": "isMac && editorTextFocus" 497 | }, 498 | { 499 | "key": "cmd+shift+delete", 500 | "command": "deleteAllRight", 501 | "when": "isMac && editorTextFocus" 502 | }, 503 | { 504 | "key": "cmd+alt+r", 505 | "command": "editor.action.rename", 506 | "when": "isMac && editorTextFocus" 507 | }, 508 | { 509 | "key": "cmd+shift+o", 510 | "command": "editor.action.organizeImports", 511 | "when": "isMac && editorTextFocus && !editorReadonly && supportedCodeAction =~ /(\\s|^)source\\.organizeImports\\b/" 512 | }, 513 | { 514 | "key": "cmd+space", 515 | "command": "editor.action.triggerSuggest", 516 | "when": "isMac && editorTextFocus" 517 | }, 518 | { 519 | "key": "cmd+.", 520 | "command": "editor.action.marker.next", 521 | "when": "isMac && editorFocus && !editorReadonly" 522 | }, 523 | { 524 | "key": "f3", 525 | "command": "editor.action.goToDeclaration", 526 | "when": "isMac && editorTextFocus" 527 | }, 528 | { 529 | "key": "cmd+1", 530 | "command": "editor.action.quickFix", 531 | "when": "isMac && editorTextFocus" 532 | }, 533 | { 534 | "key": "cmd+shift+g", 535 | "command": "editor.action.referenceSearch.trigger", 536 | "when": "isMac && editorTextFocus" 537 | }, 538 | { 539 | "key": "cmd+shift+b", 540 | "command": "editor.debug.action.toggleBreakpoint", 541 | "when": "isMac && editorTextFocus" 542 | }, 543 | { 544 | "key": "cmd+shift+x", 545 | "command": "editor.action.transformToUppercase", 546 | "when": "isMac && editorTextFocus" 547 | }, 548 | { 549 | "key": "cmd+shift+y", 550 | "command": "editor.action.transformToLowercase", 551 | "when": "isMac && editorTextFocus" 552 | }, 553 | { 554 | "key": "cmd+k", 555 | "command": "editor.action.nextSelectionMatchFindAction", 556 | "when": "isMac && editorTextFocus" 557 | }, 558 | { 559 | "key": "cmd+shift+k", 560 | "command": "editor.action.previousSelectionMatchFindAction", 561 | "when": "isMac && editorTextFocus" 562 | }, 563 | { 564 | "key": "alt+left", 565 | "command": "cursorWordPartLeft", 566 | "when": "isMac && textInputFocus" 567 | }, 568 | { 569 | "key": "alt+right", 570 | "command": "cursorWordPartRight", 571 | "when": "isMac && textInputFocus" 572 | }, 573 | { 574 | "key": "alt+shift+left", 575 | "command": "cursorWordPartLeftSelect", 576 | "when": "isMac && textInputFocus" 577 | }, 578 | { 579 | "key": "alt+shift+right", 580 | "command": "cursorWordPartRightSelect", 581 | "when": "isMac && textInputFocus" 582 | }, 583 | { 584 | "key": "cmd+alt+left", 585 | "command": "workbench.action.navigateBack", 586 | "when": "isMac" 587 | }, 588 | { 589 | "key": "cmd+alt+right", 590 | "command": "workbench.action.navigateForward", 591 | "when": "isMac" 592 | }, 593 | { 594 | "key": "f8", 595 | "command": "workbench.action.debug.continue", 596 | "when": "isMac && inDebugMode" 597 | }, 598 | { 599 | "key": "cmd+shift+f11", 600 | "command": "workbench.action.debug.start", 601 | "when": "isMac && !inDebugMode" 602 | }, 603 | { 604 | "key": "f5", 605 | "command": "workbench.action.debug.stepInto", 606 | "when": "isMac && inDebugMode" 607 | }, 608 | { 609 | "key": "f7", 610 | "command": "workbench.action.debug.stepOut", 611 | "when": "isMac && inDebugMode" 612 | }, 613 | { 614 | "key": "f6", 615 | "command": "workbench.action.debug.stepOver", 616 | "when": "isMac && inDebugMode" 617 | }, 618 | { 619 | "key": "cmd+f2", 620 | "command": "workbench.action.debug.stop", 621 | "when": "isMac && inDebugMode" 622 | }, 623 | { 624 | "key": "cmd+shift+C", 625 | "command": "-editor.action.commentLine", 626 | "when": "isMac && editorTextFocus && !editorReadonly" 627 | }, 628 | { 629 | "key": "cmd+shift+C", 630 | "command": "-toggleExplainMode", 631 | "when": "isMac && suggestWidgetVisible" 632 | }, 633 | { 634 | "key": "cmd+shift+z", 635 | "command": "-redo", 636 | "when": "isMac && textInputFocus && !editorReadonly" 637 | }, 638 | { 639 | "key": "shift+alt+z", 640 | "command": "workbench.action.files.saveLocalFile", 641 | "when": "isMac && remoteFileDialogVisible" 642 | }, 643 | { 644 | "key": "shift+alt+z", 645 | "command": "-workbench.action.files.saveAs", 646 | "when": "isMac" 647 | }, 648 | { 649 | "key": "shift+cmd+s", 650 | "command": "-workbench.action.files.saveAs", 651 | "when": "isMac" 652 | }, 653 | { 654 | "key": "shift+cmd+s", 655 | "command": "-workbench.action.files.saveLocalFile", 656 | "when": "isMac && remoteFileDialogVisible" 657 | }, 658 | { 659 | "key": "shift+alt+q", 660 | "command": "workbench.action.closeWindow", 661 | "when": "isMac" 662 | }, 663 | { 664 | "key": "shift+cmd+w", 665 | "command": "-workbench.action.closeWindow", 666 | "when": "isMac" 667 | }, 668 | { 669 | "key": "ctrl+d", 670 | "command": "editor.action.addSelectionToNextFindMatch", 671 | "when": "isMac && editorFocus" 672 | }, 673 | // Browser in code-server 674 | { 675 | "key": "alt+b", 676 | "command": "simpleBrowser.show", 677 | "args": "https://google.com" 678 | }, 679 | { 680 | "key": "ctrl+alt+q", 681 | "command": "workbench.action.quickOpenView" 682 | }, 683 | { 684 | "key": "ctrl+q", 685 | "command": "-workbench.action.quickOpenView" 686 | }, 687 | { 688 | "key": "ctrl+alt+q", 689 | "command": "workbench.action.quickOpenNavigateNextInViewPicker", 690 | "when": "inQuickOpen && inViewsPicker" 691 | }, 692 | { 693 | "key": "ctrl+q", 694 | "command": "-workbench.action.quickOpenNavigateNextInViewPicker", 695 | "when": "inQuickOpen && inViewsPicker" 696 | }, 697 | { 698 | "key": "ctrl+alt+p", 699 | "command": "workbench.action.quickOpen" 700 | }, 701 | { 702 | "key": "ctrl+p", 703 | "command": "-workbench.action.quickOpen" 704 | }, 705 | { 706 | "key": "ctrl+alt+p", 707 | "command": "workbench.action.quickOpenNavigateNextInFilePicker", 708 | "when": "inFilesPicker && inQuickOpen" 709 | }, 710 | { 711 | "key": "ctrl+p", 712 | "command": "-workbench.action.quickOpenNavigateNextInFilePicker", 713 | "when": "inFilesPicker && inQuickOpen" 714 | }, 715 | ] -------------------------------------------------------------------------------- /system/skel/mounts.json: -------------------------------------------------------------------------------- 1 | { 2 | "logs/codec": "/etc/codec/logs", 3 | "ssh": "/root/.ssh", 4 | "vscode": "/root/.local/share/code-server" 5 | } -------------------------------------------------------------------------------- /system/skel/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "window.titleBarStyle": "native", 3 | "window.customTitleBarVisibility": "never", 4 | "window.menuBarVisibility": "hidden", 5 | "window.commandCenter": false, 6 | "editor.lineHeight": 18, 7 | "editor.wordWrap": "on", 8 | "editor.tabSize": 4, 9 | "editor.renderWhitespace": "trailing", 10 | "editor.insertSpaces": true, 11 | "editor.formatOnSave": true, 12 | "editor.formatOnPaste": false, 13 | "editor.formatOnType": false, 14 | "editor.detectIndentation": true, 15 | "editor.codeActionsOnSave": { 16 | "source.fixAll": "explicit", 17 | "source.organizeImports": "explicit" 18 | }, 19 | "editor.snippetSuggestions": "bottom", 20 | "editor.quickSuggestions": { 21 | "comments": "on", 22 | "strings": "on", 23 | "other": "on" 24 | }, 25 | "editor.semanticTokenColorCustomizations": { 26 | "enabled": false 27 | }, 28 | "editor.fontLigatures": true, 29 | "editor.fontFamily": "Menlo, Monaco, Consolas, 'Courier New', Consolas, Lucida Console, 'Droid Sans', sans-serif, Arial", 30 | "editor.mouseWheelZoom": true, 31 | "editor.fontSize": 14, 32 | "workbench.iconTheme": "vscode-great-icons", 33 | "workbench.tree.indent": 8, 34 | "workbench.editor.enablePreviewFromCodeNavigation": true, 35 | "workbench.startupEditor": "none", 36 | "workbench.panel.defaultLocation": "right", 37 | "workbench.panel.opensMaximized": "never", 38 | "workbench.colorTheme": "Default Dark Modern", 39 | "workbench.statusBar.visible": false, 40 | "workbench.layoutControl.enabled": false, 41 | "workbench.activityBar.location": "top", 42 | "workbench.colorCustomizations": { 43 | "minimap.background": "#00000000", 44 | "tab.inactiveBackground": "#0c0e14" 45 | }, 46 | "terminal.integrated.allowMnemonics": true, 47 | "terminal.integrated.rendererType": "dom", 48 | "terminal.integrated.showExitAlert": true, 49 | "terminal.integrated.defaultProfile.linux": "bash", 50 | "terminal.integrated.defaultProfile.osx": "bash", 51 | "terminal.integrated.defaultProfile.windows": "bash", 52 | "terminal.integrated.cwd": "/codec/ws", 53 | "security.workspace.trust.enabled": false, 54 | "security.workspace.trust.banner": "never", 55 | "security.workspace.trust.untrustedFiles": "open", 56 | "telemetry.enableTelemetry": false, 57 | "telemetry.enableCrashReporter": false, 58 | "telemetry.enableErrorTelemetry": false, 59 | "files.hotExit": "off", 60 | "files.saveConflictResolution": "askUser", 61 | "files.autoSaveDelay": 12000, 62 | "keyboard.layout": "de", 63 | "keyboard.dispatch": "keyCode", 64 | "extensions.autoCheckUpdates": true, 65 | "extensions.autoUpdate": "onlyEnabledExtensions", 66 | "update.mode": "none", 67 | "breadcrumbs.enabled": true, 68 | "problems.showUnused": true, 69 | "comments.openView": "file", 70 | "search.followSymlinks": true, 71 | "remote.autoForwardPorts": false, 72 | "git.terminalAuthentication": true, 73 | "git.autoStash": true, 74 | "git.repositoryScanIgnoredFolders": [ 75 | "node_modules", 76 | ".codec", 77 | ".store", 78 | ".ignore", 79 | ".logs", 80 | "logs" 81 | ], 82 | "sshfs.configs": [], 83 | "sshfs.configpaths": [ 84 | "/codec/.codec/sshfs.jsonc" 85 | ], 86 | "javascript.updateImportsOnFileMove.enabled": "always", 87 | "typescript.updateImportsOnFileMove.enabled": "always", 88 | "tabnine.experimentalAutoImports": true, 89 | "tabnine.useProxySupport": false, 90 | "markdown.extension.toc.levels": "1..3", 91 | "liveshare.anonymousGuestApproval": "accept", 92 | "hediet.vscode-drawio.resizeImages": null, 93 | "vscode_custom_css.imports": [ 94 | "file:///codec/mounts/vscode/extensions/coltwillcox.synthwave-x-fluoromachine-contrast-1.0.2/synthwave-x-fluoromachine.css", 95 | "file:///codec/mounts/vscode/extensions/coltwillcox.synthwave-x-fluoromachine-contrast-1.0.2/epic-80s-transitions.css", 96 | "file:///codec/mounts/vscode/extensions/coltwillcox.synthwave-x-fluoromachine-contrast-1.0.2/logo.css" 97 | ], 98 | "hediet.vscode-drawio.zoomFactor": 2, 99 | "vsicons.dontShowNewVersionMessage": true, 100 | "cSpell.userWords": [ 101 | "CodeC", 102 | "debconf", 103 | "ipaddress", 104 | "majo", 105 | "Millis", 106 | "noble", 107 | "noblemajo", 108 | "vrrp" 109 | ] 110 | } -------------------------------------------------------------------------------- /system/skel/vscode-server.yaml: -------------------------------------------------------------------------------- 1 | bind-addr: 0.0.0.0:8080 2 | cert: false 3 | auth: password 4 | hashed-password: none -------------------------------------------------------------------------------- /system/vscode-server.yaml: -------------------------------------------------------------------------------- 1 | bind-addr: 0.0.0.0:8080 2 | cert: false 3 | auth: password 4 | hashed-password: none 5 | -------------------------------------------------------------------------------- /system/vscode.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=codec vscode 3 | After=network.target 4 | 5 | [Service] 6 | Type=exec 7 | ExecStart=/usr/bin/code-server --disable-telemetry --auth password --bind-addr 0.0.0.0:8080 /codec/.codec/default.code-workspace 8 | Restart=always 9 | User=root 10 | 11 | [Install] 12 | WantedBy=default.target -------------------------------------------------------------------------------- /system/vscode_gallery.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | const path = "/usr/lib/code-server/lib/vscode/product.json" 4 | const object = require(path) 5 | const fs = require("fs") 6 | 7 | let gallery = process.env["VSCODE_GALLERY"] 8 | 9 | if ( 10 | typeof gallery != "string" || 11 | gallery.length == 0 12 | ) { 13 | gallery = "ms" 14 | } 15 | 16 | function setOpenVSXGallery(object) { 17 | object["extensionsGallery"] = { 18 | "serviceUrl": "https://open-vsx.org/vscode/gallery", 19 | "itemUrl": "https://open-vsx.org/vscode/item" 20 | } 21 | 22 | object["linkProtectionTrustedDomains"] = [ 23 | "https://open-vsx.org" 24 | ] 25 | } 26 | 27 | function setMicrosoftGallery(object) { 28 | object["extensionsGallery"] = { 29 | "nlsBaseUrl": "https://www.vscode-unpkg.net/_lp/", 30 | "serviceUrl": "https://marketplace.visualstudio.com/_apis/public/gallery", 31 | "itemUrl": "https://marketplace.visualstudio.com/items", 32 | "publisherUrl": "https://marketplace.visualstudio.com/publishers", 33 | "resourceUrlTemplate": "https://{publisher}.vscode-unpkg.net/{publisher}/{name}/{version}/{path}", 34 | "controlUrl": "https://az764295.vo.msecnd.net/extensions/marketplace.json" 35 | } 36 | 37 | object["linkProtectionTrustedDomains"] = [ 38 | "https://*.visualstudio.com", "https://*.microsoft.com", 39 | "https://aka.ms", 40 | "https://*.gallerycdn.vsassets.io", 41 | "https://*.github.com", 42 | "https://login.microsoftonline.com", 43 | "https://*.vscode.dev", 44 | "https://*.github.dev", 45 | "https://gh.io", 46 | "https://portal.azure.com", 47 | "https://raw.githubusercontent.com", 48 | "https://private-user-images.githubusercontent.com", 49 | "https://avatars.githubusercontent.com" 50 | ] 51 | } 52 | 53 | if ( 54 | gallery.startsWith("ov") || 55 | gallery.startsWith("open") 56 | ) { 57 | setOpenVSXGallery(object) 58 | } else if ( 59 | gallery.startsWith("ms") || 60 | gallery.startsWith("microsoft") 61 | ) { 62 | setMicrosoftGallery(object) 63 | } 64 | 65 | fs.writeFileSync( 66 | path, 67 | JSON.stringify( 68 | object, 69 | null, 70 | 4 71 | ) 72 | ) 73 | -------------------------------------------------------------------------------- /system/vscode_telemetry.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | const path = "/usr/lib/code-server/lib/vscode/product.json" 4 | const object = require(path) 5 | const fs = require("fs") 6 | 7 | object["enableTelemetry"] = false 8 | 9 | fs.writeFileSync( 10 | path, 11 | JSON.stringify( 12 | object, 13 | null, 14 | 4 15 | ) 16 | ) 17 | 18 | --------------------------------------------------------------------------------