diff --git a/README.md b/README.md index 4bfeb3d..c6e6f5c 100644 --- a/README.md +++ b/README.md @@ -13,4 +13,5 @@ 自VSCode发布以来,VSCode就受到了广大程序员的青睐。VSCode丰富的插件能够满足使用者各色各样的需求。 但VSCode使用受限于图形化界面的需求,只能安装在客户端而不能安装在服务器上。 code-server的出现完美的解决了VSCode不能安装在服务端的缺陷。 -code-server是一款运行在浏览器界面上的可以安装在任何机器上的VSCode程序,code-server不仅继承了VSCode的使用逻辑,丰富的插件,在VSCode的基础上还提供了更多VSCode所没有的特性,满足更多的使用场景和业务需求。 +code-server是一款运行在浏览器界面上的可以安装在任何机器上的VSCode程序,code-server不仅继承了VSCode的使用逻辑,丰富的插件,在VSCode的基础上还提供了更多 +VSCode所没有的特性,由ctllo-bit提供内嵌飞牛界面,以满足更多的使用场景和业务需求。 diff --git a/app/docker/docker-compose.yaml b/app/docker/docker-compose.yaml index caaa2f1..09c4062 100755 --- a/app/docker/docker-compose.yaml +++ b/app/docker/docker-compose.yaml @@ -6,11 +6,16 @@ services: container_name: code-server restart: unless-stopped ports: - - "${server_port}:8080" # 端口如果冲突请修改冒号前面的端口号,冒号后面的不要改。 + - "5333:8080" # 端口如果冲突请修改冒号前面的端口号,冒号后面的不要改。 volumes: - "/var/apps/vs-code/shares/data/.config:/home/coder/.config" # 配置文件路径 - - "/var/apps/vs-code/shares/data/project:/home/coder/project" # 项目路径 + - "/vol1/1000/VscodeProject:/home/coder/project" # 项目路径 + user: "1000:1001" environment: - PASSWORD=${admin_password} #登陆密码修改成你自己的密码 - TZ=Asia/Shanghai + - PUID=1000 + - PGID=1001 + # 增加下面这一行,进入网页直接就是你的项目 + command: --auth password --bind-addr 0.0.0.0:8080 /home/coder/project network_mode: bridge \ No newline at end of file diff --git a/app/ui/config b/app/ui/config index c56fd76..a845946 100755 --- a/app/ui/config +++ b/app/ui/config @@ -1,12 +1,23 @@ { ".url": { - "vs-code.Application": { - "title": "VS Code", + "vs-code.main": { + "title": "VS Code桌面版", "icon": "images/icon_{0}.png", + "type": "iframe", + "url": "/cgi/ThirdParty/vs-code/index.cgi/", + "allUsers": true + }, + "vs-code.Application": { + "title": "VS Code外链版", + "icon": "images/code_icon_{0}.png", "type": "url", "protocol": "http", "port": "5333", + "url": "/", "allUsers": false } } -} \ No newline at end of file +} + + + \ No newline at end of file diff --git a/app/ui/env.cgi b/app/ui/env.cgi new file mode 100644 index 0000000..c532a4f --- /dev/null +++ b/app/ui/env.cgi @@ -0,0 +1,41 @@ +#!/bin/sh + +# 添加 HTTP 响应头 +echo "Content-Type: application/javascript; charset=utf-8" +echo "" + +cat < /index.html + REL_PATH="${URI_NO_QUERY#*index.cgi}" + ;; +esac + +# 如果为空或只有 /,就默认 /index.html +if [ -z "$REL_PATH" ] || [ "$REL_PATH" = "/" ]; then + REL_PATH="/index.html" +fi + +# 拼出真实文件路径:basePath + /ui + index.cgi 后面的路径 +TARGET_FILE="${BASE_PATH}${REL_PATH}" + +# 简单防御:禁止 .. 越级访问 +if echo "$TARGET_FILE" | grep -q '\.\.'; then + echo "Status: 400 Bad Request" + echo "Content-Type: text/plain; charset=utf-8" + echo "" + echo "Bad Request" + exit 0 +fi + +# 2. 判断文件是否存在 +if [ ! -f "$TARGET_FILE" ]; then + echo "Status: 404 Not Found" + echo "Content-Type: text/plain; charset=utf-8" + echo "" + echo "404 Not Found: ${REL_PATH}" + exit 0 +fi + +# 3. 根据扩展名简单判断 Content-Type +ext="${TARGET_FILE##*.}" +case "$ext" in + html|htm) + mime="text/html; charset=utf-8" + ;; + css) + mime="text/css; charset=utf-8" + ;; + js) + mime="application/javascript; charset=utf-8" + ;; + jpg|jpeg) + mime="image/jpeg" + ;; + png) + mime="image/png" + ;; + gif) + mime="image/gif" + ;; + svg) + mime="image/svg+xml" + ;; + txt|log) + mime="text/plain; charset=utf-8" + ;; + *) + mime="application/octet-stream" + ;; +esac + +# 4. 输出头 + 文件内容 +echo "Content-Type: $mime" +echo "" + +cat "$TARGET_FILE" diff --git a/app/www/css/style.css b/app/www/css/style.css new file mode 100644 index 0000000..e570008 --- /dev/null +++ b/app/www/css/style.css @@ -0,0 +1,21 @@ +/* 基础尺寸保证 */ +html, body { + width: 100%; + height: 100%; + margin: 0; +} + +/* 盒模型统一 */ +html { + box-sizing: border-box; +} +*, *::before, *::after { + box-sizing: inherit; +} + +/* 只对根容器禁用滚动 */ +#app, #root, .container { + width: 100%; + height: 100%; + overflow: hidden; +} diff --git a/app/www/index.html b/app/www/index.html new file mode 100644 index 0000000..10624bc --- /dev/null +++ b/app/www/index.html @@ -0,0 +1,12 @@ + + + + + + Monaco in fnOS + + + + + + \ No newline at end of file diff --git a/manifest b/manifest index e1fb181..11bf298 100755 --- a/manifest +++ b/manifest @@ -1,17 +1,17 @@ -appname=vs-code -version=1.0.0 -display_name="VS Code" -desc="""运行在浏览器上的VSCode,项目地址:code-server +appname = vs-code +version = 1.0.1 +display_name = "VS Code" +desc ="""运行在浏览器上的VSCode,项目地址:code-server "GitHub Discussions" "Join us on Slack" Twitter Follow Discord codecov See latest 自VSCode发布以来,VSCode就受到了广大程序员的青睐。VSCode丰富的插件能够满足使用者各色各样的需求。 但VSCode使用受限于图形化界面的需求,只能安装在客户端而不能安装在服务器上。 code-server的出现完美的解决了VSCode不能安装在服务端的缺陷。 code-server是一款运行在浏览器界面上的可以安装在任何机器上的VSCode程序,code-server不仅继承了VSCode的使用逻辑,丰富的插件,在VSCode的基础上还提供了更多VSCode所没有的特性,满足更多的使用场景和业务需求。 """ -arch=x86_64 -source=thirdparty -maintainer=code-server -maintainer_url=https://github.com/coder/code-server -distributor=MR_XIAOBO -desktop_uidir=ui -desktop_applaunchname="vs-code.Application" \ No newline at end of file +arch = x86_64 +source = thirdparty +maintainer = code-server +maintainer_url = https://github.com/coder/code-server +distributor = MR_XIAOBO +desktop_uidir = ui +desktop_applaunchname = vs-code.Application