alanhe421 / coding-note

note
3 stars 1 forks source link

cloudstudio #455

Open alanhe421 opened 1 year ago

alanhe421 commented 1 year ago

wx cloudstudio net_ws_pfkctc

alanhe421 commented 1 year ago

CSP问题

default-src 'self' https://cs-res-1258344699.file.myqcloud.com/; img-src 'self' https://cs-res-1258344699.file.myqcloud.com/ https: data: blob:; media-src 'self' https://cs-res-1258344699.file.myqcloud.com/; script-src 'self' 'unsafe-eval' 'sha256-HuyBNEnumn/Bw3njx2R0EXAv9HicWHLQQd9NJ9ruyrk=' 'sha256-bB36OH+7jasqz41ZpqtH9l9cQ4U7ttmhz2ZtlkT/Ggk=' 'sha256-EedBSAXIe6lScECyUaFb8Q0XwCH8E/xuc5huek8eQ0o=' 'sha256-yxwQ9j8YGPsfU554CNGiSCW08z5yqDVvuQmssjoPsm8=' 'sha256-fh3TwPMflhsEIpR8g1OYTIMVWhXTLcjQ9kh2tIpmv54=' http://wx.cloudstudio.net/ https://cs-res-1258344699.file.myqcloud.com/ https://cdn-go.cn/; child-src 'self' https://cs-res-1258344699.file.myqcloud.com/; frame-src 'self' https://*.vscode-webview.net https://*.vscode-cdn.net https://cs-res-1258344699.file.myqcloud.com/ data:; worker-src 'self' https://cs-res-1258344699.file.myqcloud.com/ data:; style-src 'self' 'unsafe-inline' https://cs-res-1258344699.file.myqcloud.com/; connect-src 'self' https://cs-res-1258344699.file.myqcloud.com/ ws: wss: https: http:; font-src 'self' https://cs-res-1258344699.file.myqcloud.com/ blob:; manifest-src 'self' https://cs-res-1258344699.file.myqcloud.com/;
alanhe421 commented 1 year ago

cloudstudio存储路径

/root/.local/lib

alanhe421 commented 1 year ago

supervisord

supervisord: Exec format error

注意supervisord针对x86/arm需要使用不同版本

alanhe421 commented 1 year ago

CDN

  1. 将workbench.html中资源切换到CDN路径即可
  2. arm/x86,宿主文件workbench.html内容是一致的

    
    <!-- Copyright (C) Microsoft Corporation. All rights reserved. -->
    <!DOCTYPE html>
    <html>
    <head>
    <script>
      performance.mark('code/didStartRenderer');
    </script>
    <meta charset="utf-8"/>
    
    <!-- Mobile tweaks -->
    <meta name="mobile-web-app-capable" content="yes"/>
    <meta name="apple-mobile-web-app-capable" content="yes"/>
    <meta name="apple-mobile-web-app-title" content="Code">
    <link rel="apple-touch-icon"
          href="https://cs-res-1258344699.file.myqcloud.com/cloudstudio/vscode/79aab9211c0b234c13eaf77a1e7378571155878c/release-standalone/resources/server/code-192.png"/>
    
    <!-- Disable pinch zooming -->
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
    
    <!-- Workbench Configuration -->
    <meta id="vscode-workbench-web-configuration"
          data-settings="{&quot;webviewEndpoint&quot;:&quot;./stable-79aab9211c0b234c13eaf77a1e7378571155878c/static/out/vs/workbench/contrib/webview/browser/pre&quot;,&quot;userDataPath&quot;:&quot;/root/.local/share/code-server&quot;,&quot;windowIndicator&quot;:{&quot;label&quot;:&quot;$(cloudstudio-icon) Cloud Studio&quot;},&quot;initialColorTheme&quot;:{&quot;themeType&quot;:&quot;dark&quot;},&quot;remoteAuthority&quot;:&quot;wx.cloudstudio.net&quot;,&quot;configurationDefaults&quot;:{&quot;files.saveConflictResolution&quot;:&quot;overwriteFileOnDisk&quot;,&quot;workbench.colorTheme&quot;:&quot;Default Dark+&quot;,&quot;workbench.startupEditor&quot;:&quot;readme&quot;,&quot;window.menuBarVisibility&quot;:&quot;visible&quot;,&quot;security.workspace.trust.enabled&quot;:false,&quot;terminal.integrated.gpuAcceleration&quot;:&quot;off&quot;,&quot;files.eol&quot;:&quot;\n&quot;,&quot;editor.suggest.preview&quot;:true,&quot;window.commandCenter&quot;:true,&quot;C_Cpp.intelliSenseEngine&quot;:&quot;disabled&quot;},&quot;developmentOptions&quot;:{&quot;logLevel&quot;:2},&quot;enableWorkspaceTrust&quot;:true,&quot;folderUri&quot;:{&quot;$mid&quot;:1,&quot;path&quot;:&quot;/root/RemoteWorking&quot;,&quot;scheme&quot;:&quot;vscode-remote&quot;,&quot;authority&quot;:&quot;wx.cloudstudio.net&quot;},&quot;productConfiguration&quot;:{&quot;embedderIdentifier&quot;:&quot;server-distro&quot;,&quot;extensionsGallery&quot;:{&quot;serviceUrl&quot;:&quot;https://internal-openvsx.cloudstudio.net/vscode/gallery&quot;,&quot;itemUrl&quot;:&quot;https://open-vsx.org/vscode/item&quot;,&quot;resourceUrlTemplate&quot;:&quot;https://openvsxorg.blob.core.windows.net/resources/{publisher}/{name}/{version}/{path}&quot;,&quot;controlUrl&quot;:&quot;&quot;,&quot;recommendationsUrl&quot;:&quot;&quot;}},&quot;callbackRoute&quot;:&quot;/stable-79aab9211c0b234c13eaf77a1e7378571155878c/callback&quot;}">
    
    <!-- Workbench Auth Session -->
    <meta id="vscode-workbench-auth-session" data-settings="">
    
    <!-- NLS Configuration -->
    <meta id="vscode-remote-nls-configuration"
          data-settings="{&quot;locale&quot;:&quot;zh-cn&quot;,&quot;availableLanguages&quot;:{&quot;*&quot;:&quot;zh-cn&quot;},&quot;_languagePackId&quot;:&quot;5244843ad73cf2575717c83bd5b7a2ef.zh-cn&quot;,&quot;_translationsConfigFile&quot;:&quot;/root/.local/share/code-server/clp/5244843ad73cf2575717c83bd5b7a2ef.zh-cn/tcf.json&quot;,&quot;_cacheRoot&quot;:&quot;/root/.local/share/code-server/clp/5244843ad73cf2575717c83bd5b7a2ef.zh-cn&quot;,&quot;_resolvedLanguagePackCoreLocation&quot;:&quot;/root/.local/share/code-server/clp/5244843ad73cf2575717c83bd5b7a2ef.zh-cn/79aab9211c0b234c13eaf77a1e7378571155878c&quot;,&quot;_corruptedFile&quot;:&quot;/root/.local/share/code-server/clp/5244843ad73cf2575717c83bd5b7a2ef.zh-cn/corrupted.info&quot;,&quot;_languagePackSupport&quot;:true}">
    
    <!-- Workbench Icon/Manifest/CSS -->
    <link rel="icon"
          href="https://cs-res-1258344699.file.myqcloud.com/cloudstudio/vscode/79aab9211c0b234c13eaf77a1e7378571155878c/release-standalone/resources/server/favicon.ico"
          type="image/x-icon"/>
    <link rel="manifest" href="./stable-79aab9211c0b234c13eaf77a1e7378571155878c/static/resources/server/manifest.json"
          crossorigin="use-credentials"/>
    <link data-name="vs/workbench/workbench.web.main" rel="stylesheet"
          href="https://cs-res-1258344699.file.myqcloud.com/cloudstudio/vscode/79aab9211c0b234c13eaf77a1e7378571155878c/release-standalone/out/vs/workbench/workbench.web.main.css">
    <script src="https://cdn-go.cn/aegis/aegis-sdk/latest/aegis.min.js"></script>
    <script>
      const getId = () => {
        const hostname = window.location.hostname;
        switch (true) {
          case hostname.includes('cloudstudio'):
            return 'okyPOubvJnKY2KEQ9m';
          case hostname.includes('tencent'):
            return '3o0lYfLoO0JL9rmbgO';
        }
        return '2epG3TKoKzZY1eg7zE';
      };
      const aegis = new Aegis({
        id: getId(), // 上报 id
        reportApiSpeed: true, // 接口测速
        reportAssetSpeed: true, // 静态资源测速
        spa: true, // spa 应用页面跳转的时候开启 pv 计算
      });
    </script>
    <style>
      .loading-iframe {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        border: none;
      }
    
      .workspace-loader {
        visibility: hidden;
        position: absolute;
      }
    </style>
    </head>

alanhe421 commented 1 year ago

extension拓展

image

拓展商店地址自定义

export EXTENSIONS_GALLERY='{"serviceUrl": "https://extensions.coder.com/api"}'
alanhe421 commented 1 year ago

.js.map

code-server是面向开发者的,因此提供的离线包包含js.map,如果是生产部署,可以考虑删除。

alanhe421 commented 1 year ago

config.yaml

bind-addr: 127.0.0.1:8080
auth: password
password: cf8a917f175aafa43ef31bad
cert: false
alanhe421 commented 1 year ago

启动脚本

#!/usr/bin/env bash
IDE_WORK_DIR=$(eval "echo $IDE_WORK_DIR")
if [ -z "$IDE_EDITOR_SERVER_BIND_ADDRESS" ]; then
  IDE_EDITOR_SERVER_BIND_ADDRESS=0.0.0.0
fi

if [ -z "$IDE_EDITOR_SERVER_CMD" ]; then
  exec $IDE_EDITOR_SERVER_DIR/lib/node $IDE_EDITOR_SERVER_DIR --disable-update-check --auth=$IDE_EDITOR_SERVER_AUTH_TYPE --proxy-domain=$IDE_APP_ACCESS_URL_DOMAIN  --disable-telemetry --loading-url=$IDE_EDITOR_SERVER_LOADING_URL --hidden-iframe-url=$IDE_EDITOR_SERVER_HIDDEN_IFRAME_URL --remote-authority=$IDE_EDITOR_SERVER_REMOTE_AUTHORITY --workbench-web-base-url=$IDE_EDITOR_SERVER_WORKBENCH_WEB_BASE_URL --host=$IDE_EDITOR_SERVER_BIND_ADDRESS --port=$IDE_EDITOR_SERVER_PORT --window-indicator-label="\$(cloudstudio-icon) Cloud Studio" --without-connection-token --disable-workspace-trust --default-folder=$IDE_WORK_DIR --initial-color-theme=dark --locale=zh-cn --user-data-dir=/root/.local/share/code-server
else
  exec $(eval "echo $IDE_EDITOR_SERVER_CMD")
fi
alanhe421 commented 1 year ago

插件所在位置

/root/.local/lib/cloudstudio-d75a35a16000bd05f5c0ce87be1ae0d446173fed/vendor/modules/code-oss-dev/extensions

alanhe421 commented 1 year ago

CloudStudio.code-assistant-pro

https://github.com/THUDM/CodeGeeX/blob/main/README_zh.md

目前来看是基于CodeGeeX插件改造。

原插件开源且免费使用AI 插件地址:https://marketplace.visualstudio.com/items?itemName=aminer.codegeex 插件源码:https://github.com/CodeGeeX/codegeex-vscode-extension

该插件的禁用方式需要在设置中控制开关与GitHub copilot类似。

alanhe421 commented 1 year ago

连接稳定性

image