From 05a5041743a389df3d995ec6958a6deb24f8e6a1 Mon Sep 17 00:00:00 2001 From: podda2006 <223249222+bhawan-kavinda@users.noreply.github.com> Date: Sun, 27 Sep 2026 01:01:09 +0530 Subject: [PATCH 1/8] add capasitor apk code --- .../AndroidManifest-changes.xml | 20 +++ capacitor.config.ts | 16 ++ package.json | 154 +----------------- www/index.html | 17 ++ 4 files changed, 62 insertions(+), 145 deletions(-) create mode 100644 android-manifest-ref/AndroidManifest-changes.xml create mode 100644 capacitor.config.ts create mode 100644 www/index.html diff --git a/android-manifest-ref/AndroidManifest-changes.xml b/android-manifest-ref/AndroidManifest-changes.xml new file mode 100644 index 000000000000..773ad8d41fb4 --- /dev/null +++ b/android-manifest-ref/AndroidManifest-changes.xml @@ -0,0 +1,20 @@ + + + + + + + + + diff --git a/capacitor.config.ts b/capacitor.config.ts new file mode 100644 index 000000000000..1169669f672f --- /dev/null +++ b/capacitor.config.ts @@ -0,0 +1,16 @@ +import { CapacitorConfig } from '@capacitor/cli'; + +const config: CapacitorConfig = { + appId: 'com.mycoder.bk', + appName: 'BKCode', + webDir: 'www', + server: { + url: 'http://127.0.0.1:8080', + cleartext: true + }, + android: { + allowMixedContent: true + } +}; + +export default config; diff --git a/package.json b/package.json index 1f9ea92c1d3a..8c017c204aa5 100644 --- a/package.json +++ b/package.json @@ -1,152 +1,16 @@ { - "name": "code-server", - "license": "MIT", - "version": "0.0.0", - "description": "Run VS Code on a remote server.", - "homepage": "https://github.com/coder/code-server", - "bugs": { - "url": "https://github.com/coder/code-server/issues" - }, - "repository": "https://github.com/coder/code-server", + "name": "mycode-app", + "version": "1.0.0", + "description": "code-server backend එකට connect වෙන WebView APK", "scripts": { - "clean": "./ci/build/clean.sh", - "build": "./ci/build/build-code-server.sh", - "build:vscode": "./ci/build/build-vscode.sh", - "doctoc": "./ci/dev/doctoc.sh", - "release": "./ci/build/build-release.sh", - "release:prep": "./ci/build/release-prep.sh", - "test:e2e": "VSCODE_IPC_HOOK_CLI= ./ci/dev/test-e2e.sh", - "test:e2e:proxy": "USE_PROXY=1 ./ci/dev/test-e2e.sh", - "test:unit": "./ci/dev/test-unit.sh --forceExit --detectOpenHandles", - "test:integration": "./ci/dev/test-integration.sh", - "test:native": "./ci/dev/test-native.sh", - "test:scripts": "./ci/dev/test-scripts.sh", - "package": "./ci/build/build-packages.sh", - "prettier": "prettier --write --log-level=warn --cache .", - "preinstall": "node ./ci/dev/preinstall.js", - "postinstall": "./ci/dev/postinstall.sh", - "publish:npm": "./ci/steps/publish-npm.sh", - "publish:docker": "./ci/steps/docker-buildx-push.sh", - "fmt": "npm run prettier && ./ci/dev/doctoc.sh", - "lint:scripts": "./ci/dev/lint-scripts.sh", - "lint:ts": "eslint --max-warnings=0 --fix $(git ls-files '*.ts' '*.js' | grep -v 'lib/vscode')", - "test": "echo 'Run npm run test:unit or npm run test:e2e' && exit 1", - "watch": "VSCODE_DEV=1 VSCODE_IPC_HOOK_CLI= NODE_OPTIONS='--max_old_space_size=32384 --trace-warnings' ts-node ./ci/dev/watch.ts", - "icons": "./ci/dev/gen_icons.sh" - }, - "main": "out/node/entry.js", - "devDependencies": { - "@eslint/compat": "^1.2.0", - "@eslint/eslintrc": "^3.1.0", - "@eslint/js": "^9.12.0", - "@types/compression": "^1.7.3", - "@types/cookie-parser": "^1.4.4", - "@types/eslint__js": "^8.42.3", - "@types/express": "^5.0.0", - "@types/http-proxy": "1.17.7", - "@types/js-yaml": "^4.0.6", - "@types/node": "24.x", - "@types/pem": "^1.14.1", - "@types/proxy-from-env": "^1.0.1", - "@types/safe-compare": "^1.1.0", - "@types/semver": "^7.5.2", - "@types/trusted-types": "^2.0.4", - "@types/ws": "^8.5.5", - "doctoc": "^2.2.1", - "eslint": "^9.12.0", - "eslint-config-prettier": "^10.1.8", - "eslint-import-resolver-typescript": "^4.4.4", - "eslint-plugin-import": "^2.28.1", - "eslint-plugin-prettier": "^5.0.0", - "globals": "^17.6.0", - "prettier": "3.9.4", - "prettier-plugin-sh": "^0.18.0", - "ts-node": "^10.9.1", - "typescript": "^5.6.2", - "typescript-eslint": "^8.8.0" + "sync": "npx cap sync android", + "open": "npx cap open android" }, "dependencies": { - "@coder/logger": "^3.0.1", - "argon2": "^0.44.0", - "compression": "^1.7.4", - "cookie": "^1.1.1", - "cookie-parser": "^1.4.6", - "env-paths": "^2.2.1", - "express": "^5.0.1", - "http-proxy": "^1.18.1", - "httpolyglot": "^0.1.2", - "i18next": "^26.3.1", - "js-yaml": "^5.2.3", - "limiter": "^2.1.0", - "pem": "^1.14.8", - "proxy-agent": "^6.3.1", - "qs": "^6.15.0", - "rotating-file-stream": "^3.1.1", - "safe-compare": "^1.1.4", - "semver": "^7.5.4", - "ws": "^8.14.2", - "xdg-basedir": "^4.0.0" - }, - "resolutions": { - "@types/node": "24.x" + "@capacitor/core": "^6.0.0", + "@capacitor/android": "^6.0.0" }, - "bin": { - "code-server": "out/node/entry.js" - }, - "keywords": [ - "vscode", - "development", - "ide", - "coder", - "vscode-remote", - "browser-ide", - "remote-development" - ], - "engines": { - "node": "24" - }, - "jest": { - "transform": { - "^.+\\.ts$": "/test/node_modules/ts-jest" - }, - "testEnvironment": "node", - "testPathIgnorePatterns": [ - "/node_modules/", - "/lib/", - "/out/", - "test/e2e" - ], - "collectCoverage": true, - "collectCoverageFrom": [ - "/src/**/*.ts" - ], - "coverageDirectory": "/coverage", - "coverageReporters": [ - "json", - "json-summary", - "text", - "clover" - ], - "coveragePathIgnorePatterns": [ - "/out" - ], - "coverageThreshold": { - "global": { - "lines": 60 - } - }, - "modulePathIgnorePatterns": [ - "/release-packages", - "/release", - "/release-standalone", - "/release-npm-package", - "/release-gcp", - "/release-images", - "/lib" - ], - "moduleNameMapper": { - "^.+\\.(css|less)$": "/test/utils/cssStub.ts" - }, - "globalSetup": "/test/utils/globalUnitSetup.ts" + "devDependencies": { + "@capacitor/cli": "^6.0.0" } } diff --git a/www/index.html b/www/index.html new file mode 100644 index 000000000000..df68cd526e3b --- /dev/null +++ b/www/index.html @@ -0,0 +1,17 @@ + + + + + + MyCode + + + +

Loading MyCode...

+ + From 8b9cd7df1d0a25e63b52a7077a1060bba68e987f Mon Sep 17 00:00:00 2001 From: bhawan-kawinda / <223249222+bhawan-kavinda@users.noreply.github.com> Date: Sun, 27 Sep 2026 01:06:17 +0530 Subject: [PATCH 2/8] Add files via upload --- .github/workflows/build-apk.yaml | 52 ++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 .github/workflows/build-apk.yaml diff --git a/.github/workflows/build-apk.yaml b/.github/workflows/build-apk.yaml new file mode 100644 index 000000000000..3e0271b82195 --- /dev/null +++ b/.github/workflows/build-apk.yaml @@ -0,0 +1,52 @@ +name: Build MyCode APK + +# Manual trigger - Actions tab එකෙන් "Run workflow" click කරන්න +on: + workflow_dispatch: + +jobs: + build-apk: + runs-on: ubuntu-latest + steps: + - name: Checkout repo + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: Setup Java (Gradle/Android build සඳහා) + uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: '17' + + - name: Setup Android SDK + uses: android-actions/setup-android@v3 + + # Capacitor project එක repo root එකේ මේ files තියෙනවා + # (capacitor.config.ts, www/index.html) කියලා assume කරනවා + - name: Install Capacitor dependencies + run: | + npm install @capacitor/core @capacitor/cli @capacitor/android + + - name: Add Android platform + run: npx cap add android + + - name: Sync Capacitor + run: npx cap sync android + + - name: Grant execute permission for gradlew + run: chmod +x android/gradlew + + - name: Build debug APK + run: | + cd android + ./gradlew assembleDebug + + - name: Upload APK artifact + uses: actions/upload-artifact@v4 + with: + name: mycode-debug-apk + path: android/app/build/outputs/apk/debug/app-debug.apk From 017587fda69c355573bcef88dbfb96ea4568eb7f Mon Sep 17 00:00:00 2001 From: bhawan-kawinda / <223249222+bhawan-kavinda@users.noreply.github.com> Date: Sun, 27 Sep 2026 01:09:31 +0530 Subject: [PATCH 3/8] Simplify workflow names and comments in build-apk.yaml --- .github/workflows/build-apk.yaml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/build-apk.yaml b/.github/workflows/build-apk.yaml index 3e0271b82195..c30711819f66 100644 --- a/.github/workflows/build-apk.yaml +++ b/.github/workflows/build-apk.yaml @@ -1,6 +1,5 @@ name: Build MyCode APK -# Manual trigger - Actions tab එකෙන් "Run workflow" click කරන්න on: workflow_dispatch: @@ -16,7 +15,7 @@ jobs: with: node-version: '20' - - name: Setup Java (Gradle/Android build සඳහා) + - name: Setup Java uses: actions/setup-java@v4 with: distribution: 'temurin' @@ -25,8 +24,6 @@ jobs: - name: Setup Android SDK uses: android-actions/setup-android@v3 - # Capacitor project එක repo root එකේ මේ files තියෙනවා - # (capacitor.config.ts, www/index.html) කියලා assume කරනවා - name: Install Capacitor dependencies run: | npm install @capacitor/core @capacitor/cli @capacitor/android From ece5928c8808fcd1004b6718523637549a80006b Mon Sep 17 00:00:00 2001 From: bhawan-kawinda / <223249222+bhawan-kavinda@users.noreply.github.com> Date: Sun, 27 Sep 2026 01:24:38 +0530 Subject: [PATCH 4/8] Delete .github/workflows/build-apk.yaml --- .github/workflows/build-apk.yaml | 49 -------------------------------- 1 file changed, 49 deletions(-) delete mode 100644 .github/workflows/build-apk.yaml diff --git a/.github/workflows/build-apk.yaml b/.github/workflows/build-apk.yaml deleted file mode 100644 index c30711819f66..000000000000 --- a/.github/workflows/build-apk.yaml +++ /dev/null @@ -1,49 +0,0 @@ -name: Build MyCode APK - -on: - workflow_dispatch: - -jobs: - build-apk: - runs-on: ubuntu-latest - steps: - - name: Checkout repo - uses: actions/checkout@v4 - - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: '20' - - - name: Setup Java - uses: actions/setup-java@v4 - with: - distribution: 'temurin' - java-version: '17' - - - name: Setup Android SDK - uses: android-actions/setup-android@v3 - - - name: Install Capacitor dependencies - run: | - npm install @capacitor/core @capacitor/cli @capacitor/android - - - name: Add Android platform - run: npx cap add android - - - name: Sync Capacitor - run: npx cap sync android - - - name: Grant execute permission for gradlew - run: chmod +x android/gradlew - - - name: Build debug APK - run: | - cd android - ./gradlew assembleDebug - - - name: Upload APK artifact - uses: actions/upload-artifact@v4 - with: - name: mycode-debug-apk - path: android/app/build/outputs/apk/debug/app-debug.apk From 359de751a579f0ed1599ec4d75e4a8ac1025d2e5 Mon Sep 17 00:00:00 2001 From: bhawan-kawinda / <223249222+bhawan-kavinda@users.noreply.github.com> Date: Sun, 27 Sep 2026 01:25:01 +0530 Subject: [PATCH 5/8] Add files via upload --- .github/workflows/build-apk.yaml | 58 ++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 .github/workflows/build-apk.yaml diff --git a/.github/workflows/build-apk.yaml b/.github/workflows/build-apk.yaml new file mode 100644 index 000000000000..adca2201280e --- /dev/null +++ b/.github/workflows/build-apk.yaml @@ -0,0 +1,58 @@ +name: Build MyCode APK + +# Manual trigger - Actions tab එකෙන් "Run workflow" click කරන්න +on: + workflow_dispatch: + +jobs: + build-apk: + runs-on: ubuntu-latest + steps: + - name: Checkout repo + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: Setup Java (Gradle/Android build සඳහා) + uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: '17' + + # ubuntu-latest runner එකේ Android SDK දැනටමත් install වෙලා තියෙනවා, + # ඒ නිසා android-actions/setup-android එක ඕන නෑ (ඒක 'tools' කියන + # ඉවත් කරපු legacy package එකක් හොයන්න try කරලා fail වුනා). + # SDK path එක export කරනවා විතරයි. + - name: Set Android SDK env + run: | + echo "ANDROID_SDK_ROOT=$ANDROID_HOME" >> $GITHUB_ENV + echo "ANDROID_HOME=$ANDROID_HOME" >> $GITHUB_ENV + + # Capacitor project එක repo root එකේ මේ files තියෙනවා + # (capacitor.config.ts, www/index.html) කියලා assume කරනවා + - name: Install Capacitor dependencies + run: | + npm install @capacitor/core @capacitor/cli @capacitor/android + + - name: Add Android platform + run: npx cap add android + + - name: Sync Capacitor + run: npx cap sync android + + - name: Grant execute permission for gradlew + run: chmod +x android/gradlew + + - name: Build debug APK + run: | + cd android + ./gradlew assembleDebug + + - name: Upload APK artifact + uses: actions/upload-artifact@v4 + with: + name: mycode-debug-apk + path: android/app/build/outputs/apk/debug/app-debug.apk From 6da84b139f9416291a7aa21af822d76be44aca2b Mon Sep 17 00:00:00 2001 From: bhawan-kawinda / <223249222+bhawan-kavinda@users.noreply.github.com> Date: Sun, 27 Sep 2026 01:32:40 +0530 Subject: [PATCH 6/8] Delete .github/workflows/build-apk.yaml --- .github/workflows/build-apk.yaml | 58 -------------------------------- 1 file changed, 58 deletions(-) delete mode 100644 .github/workflows/build-apk.yaml diff --git a/.github/workflows/build-apk.yaml b/.github/workflows/build-apk.yaml deleted file mode 100644 index adca2201280e..000000000000 --- a/.github/workflows/build-apk.yaml +++ /dev/null @@ -1,58 +0,0 @@ -name: Build MyCode APK - -# Manual trigger - Actions tab එකෙන් "Run workflow" click කරන්න -on: - workflow_dispatch: - -jobs: - build-apk: - runs-on: ubuntu-latest - steps: - - name: Checkout repo - uses: actions/checkout@v4 - - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: '20' - - - name: Setup Java (Gradle/Android build සඳහා) - uses: actions/setup-java@v4 - with: - distribution: 'temurin' - java-version: '17' - - # ubuntu-latest runner එකේ Android SDK දැනටමත් install වෙලා තියෙනවා, - # ඒ නිසා android-actions/setup-android එක ඕන නෑ (ඒක 'tools' කියන - # ඉවත් කරපු legacy package එකක් හොයන්න try කරලා fail වුනා). - # SDK path එක export කරනවා විතරයි. - - name: Set Android SDK env - run: | - echo "ANDROID_SDK_ROOT=$ANDROID_HOME" >> $GITHUB_ENV - echo "ANDROID_HOME=$ANDROID_HOME" >> $GITHUB_ENV - - # Capacitor project එක repo root එකේ මේ files තියෙනවා - # (capacitor.config.ts, www/index.html) කියලා assume කරනවා - - name: Install Capacitor dependencies - run: | - npm install @capacitor/core @capacitor/cli @capacitor/android - - - name: Add Android platform - run: npx cap add android - - - name: Sync Capacitor - run: npx cap sync android - - - name: Grant execute permission for gradlew - run: chmod +x android/gradlew - - - name: Build debug APK - run: | - cd android - ./gradlew assembleDebug - - - name: Upload APK artifact - uses: actions/upload-artifact@v4 - with: - name: mycode-debug-apk - path: android/app/build/outputs/apk/debug/app-debug.apk From 6a7321f220133ad19b83dfe13cf4c2b9c62ab92c Mon Sep 17 00:00:00 2001 From: bhawan-kawinda / <223249222+bhawan-kavinda@users.noreply.github.com> Date: Sun, 27 Sep 2026 01:33:00 +0530 Subject: [PATCH 7/8] Add files via upload --- .github/workflows/build-apk.yaml | 58 ++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 .github/workflows/build-apk.yaml diff --git a/.github/workflows/build-apk.yaml b/.github/workflows/build-apk.yaml new file mode 100644 index 000000000000..bceb7159e8cb --- /dev/null +++ b/.github/workflows/build-apk.yaml @@ -0,0 +1,58 @@ +name: Build MyCode APK + +# Manual trigger - Actions tab එකෙන් "Run workflow" click කරන්න +on: + workflow_dispatch: + +jobs: + build-apk: + runs-on: ubuntu-latest + steps: + - name: Checkout repo + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: Setup Java (Gradle/Android build සඳහා) + uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: '17' + + # ubuntu-latest runner එකේ Android SDK දැනටමත් install වෙලා තියෙනවා, + # ඒ නිසා android-actions/setup-android එක ඕන නෑ (ඒක 'tools' කියන + # ඉවත් කරපු legacy package එකක් හොයන්න try කරලා fail වුනා). + # SDK path එක export කරනවා විතරයි. + - name: Set Android SDK env + run: | + echo "ANDROID_SDK_ROOT=$ANDROID_HOME" >> $GITHUB_ENV + echo "ANDROID_HOME=$ANDROID_HOME" >> $GITHUB_ENV + + # Capacitor project එක repo root එකේ මේ files තියෙනවා + # (capacitor.config.ts, www/index.html) කියලා assume කරනවා + - name: Install Capacitor dependencies + run: | + npm install @capacitor/core @capacitor/cli @capacitor/android typescript + + - name: Add Android platform + run: npx cap add android + + - name: Sync Capacitor + run: npx cap sync android + + - name: Grant execute permission for gradlew + run: chmod +x android/gradlew + + - name: Build debug APK + run: | + cd android + ./gradlew assembleDebug + + - name: Upload APK artifact + uses: actions/upload-artifact@v4 + with: + name: mycode-debug-apk + path: android/app/build/outputs/apk/debug/app-debug.apk From 844ea280bec7a85ee0bb3e8f6f15a30512cea821 Mon Sep 17 00:00:00 2001 From: podda2006 <223249222+bhawan-kavinda@users.noreply.github.com> Date: Sun, 11 Oct 2026 02:28:20 +0530 Subject: [PATCH 8/8] Move Android WebView app to ci/android --- .github/workflows/android-webview.yaml | 65 ++++++++ .github/workflows/build-apk.yaml | 58 ------- .../AndroidManifest-changes.xml | 20 --- capacitor.config.ts | 16 -- ci/android/.gitignore | 3 + ci/android/README.md | 28 ++++ ci/android/capacitor.config.ts | 19 +++ ci/android/package.json | 19 +++ ci/android/www/index.html | 16 ++ docs/android-webview.md | 27 +++ package.json | 154 +++++++++++++++++- www/index.html | 17 -- 12 files changed, 322 insertions(+), 120 deletions(-) create mode 100644 .github/workflows/android-webview.yaml delete mode 100644 .github/workflows/build-apk.yaml delete mode 100644 android-manifest-ref/AndroidManifest-changes.xml delete mode 100644 capacitor.config.ts create mode 100644 ci/android/.gitignore create mode 100644 ci/android/README.md create mode 100644 ci/android/capacitor.config.ts create mode 100644 ci/android/package.json create mode 100644 ci/android/www/index.html create mode 100644 docs/android-webview.md delete mode 100644 www/index.html diff --git a/.github/workflows/android-webview.yaml b/.github/workflows/android-webview.yaml new file mode 100644 index 000000000000..ff10cdece271 --- /dev/null +++ b/.github/workflows/android-webview.yaml @@ -0,0 +1,65 @@ +name: Build Android WebView APK + +on: + workflow_dispatch: + pull_request: + paths: + - "ci/android/**" + - ".github/workflows/android-webview.yaml" + +permissions: + contents: read + +jobs: + build-apk: + runs-on: ubuntu-latest + defaults: + run: + working-directory: ci/android + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6 + - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v6 + with: + node-version-file: .node-version + # TODO: pin these two actions to commit SHAs like the rest of this repo. + - uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: "17" + + # The Android SDK is preinstalled on ubuntu-latest runners. + - name: Set Android SDK env + run: | + echo "ANDROID_SDK_ROOT=$ANDROID_HOME" >> "$GITHUB_ENV" + + - name: Install dependencies + run: npm install + + - name: Add Android platform + run: npx cap add android + + - name: Sync Capacitor + run: npx cap sync android + + # Cleartext traffic is needed because code-server is served over plain + # HTTP on localhost. Capacitor may already set this from + # `server.cleartext`; only patch the manifest if it did not. + - name: Ensure cleartext traffic and INTERNET permission + run: | + manifest=android/app/src/main/AndroidManifest.xml + grep -q 'usesCleartextTraffic' "$manifest" || \ + sed -i 's/# \n#' "$manifest" + grep -n 'usesCleartextTraffic\|INTERNET' "$manifest" + + - name: Build debug APK + run: | + chmod +x android/gradlew + cd android + ./gradlew assembleDebug + + - uses: actions/upload-artifact@v4 # TODO: pin to a commit SHA + with: + name: code-server-android-webview-debug + path: ci/android/android/app/build/outputs/apk/debug/app-debug.apk diff --git a/.github/workflows/build-apk.yaml b/.github/workflows/build-apk.yaml deleted file mode 100644 index bceb7159e8cb..000000000000 --- a/.github/workflows/build-apk.yaml +++ /dev/null @@ -1,58 +0,0 @@ -name: Build MyCode APK - -# Manual trigger - Actions tab එකෙන් "Run workflow" click කරන්න -on: - workflow_dispatch: - -jobs: - build-apk: - runs-on: ubuntu-latest - steps: - - name: Checkout repo - uses: actions/checkout@v4 - - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: '20' - - - name: Setup Java (Gradle/Android build සඳහා) - uses: actions/setup-java@v4 - with: - distribution: 'temurin' - java-version: '17' - - # ubuntu-latest runner එකේ Android SDK දැනටමත් install වෙලා තියෙනවා, - # ඒ නිසා android-actions/setup-android එක ඕන නෑ (ඒක 'tools' කියන - # ඉවත් කරපු legacy package එකක් හොයන්න try කරලා fail වුනා). - # SDK path එක export කරනවා විතරයි. - - name: Set Android SDK env - run: | - echo "ANDROID_SDK_ROOT=$ANDROID_HOME" >> $GITHUB_ENV - echo "ANDROID_HOME=$ANDROID_HOME" >> $GITHUB_ENV - - # Capacitor project එක repo root එකේ මේ files තියෙනවා - # (capacitor.config.ts, www/index.html) කියලා assume කරනවා - - name: Install Capacitor dependencies - run: | - npm install @capacitor/core @capacitor/cli @capacitor/android typescript - - - name: Add Android platform - run: npx cap add android - - - name: Sync Capacitor - run: npx cap sync android - - - name: Grant execute permission for gradlew - run: chmod +x android/gradlew - - - name: Build debug APK - run: | - cd android - ./gradlew assembleDebug - - - name: Upload APK artifact - uses: actions/upload-artifact@v4 - with: - name: mycode-debug-apk - path: android/app/build/outputs/apk/debug/app-debug.apk diff --git a/android-manifest-ref/AndroidManifest-changes.xml b/android-manifest-ref/AndroidManifest-changes.xml deleted file mode 100644 index 773ad8d41fb4..000000000000 --- a/android-manifest-ref/AndroidManifest-changes.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - diff --git a/capacitor.config.ts b/capacitor.config.ts deleted file mode 100644 index 1169669f672f..000000000000 --- a/capacitor.config.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { CapacitorConfig } from '@capacitor/cli'; - -const config: CapacitorConfig = { - appId: 'com.mycoder.bk', - appName: 'BKCode', - webDir: 'www', - server: { - url: 'http://127.0.0.1:8080', - cleartext: true - }, - android: { - allowMixedContent: true - } -}; - -export default config; diff --git a/ci/android/.gitignore b/ci/android/.gitignore new file mode 100644 index 000000000000..f214a4e22d01 --- /dev/null +++ b/ci/android/.gitignore @@ -0,0 +1,3 @@ +node_modules +# Generated by `npx cap add android`. +android diff --git a/ci/android/README.md b/ci/android/README.md new file mode 100644 index 000000000000..9f58ea113fd5 --- /dev/null +++ b/ci/android/README.md @@ -0,0 +1,28 @@ +# Android WebView wrapper + +A minimal [Capacitor](https://capacitorjs.com) app that opens a code-server +instance running on the same device (for example in +[Termux](../../docs/termux.md)) inside a WebView. + +It does **not** bundle Node.js or code-server, so none of the Node.js Mobile +API limitations apply. code-server runs as a normal process in Termux and +terminals, language servers, and sockets behave as they do on any Linux system. + +See [docs/android-webview.md](../../docs/android-webview.md) for usage. + +## Build locally + +Requires Node.js, JDK 17, and the Android SDK. + +```shell +cd ci/android +npm install +npx cap add android +npx cap sync android +cd android +./gradlew assembleDebug +``` + +The APK is written to `android/app/build/outputs/apk/debug/app-debug.apk`. + +The same steps run in the `Build Android WebView APK` GitHub workflow. diff --git a/ci/android/capacitor.config.ts b/ci/android/capacitor.config.ts new file mode 100644 index 000000000000..3fa3b4cded24 --- /dev/null +++ b/ci/android/capacitor.config.ts @@ -0,0 +1,19 @@ +import { CapacitorConfig } from "@capacitor/cli" + +// This app is a thin WebView wrapper. It does not bundle code-server or Node. +// It loads a code-server instance that is already running on the device +// (for example in Termux) at http://127.0.0.1:8080. +const config: CapacitorConfig = { + appId: "com.coder.codeserver", + appName: "code-server", + webDir: "www", + server: { + url: "http://127.0.0.1:8080", + cleartext: true, + }, + android: { + allowMixedContent: true, + }, +} + +export default config diff --git a/ci/android/package.json b/ci/android/package.json new file mode 100644 index 000000000000..f58423ef63cd --- /dev/null +++ b/ci/android/package.json @@ -0,0 +1,19 @@ +{ + "name": "code-server-android-webview", + "private": true, + "version": "0.0.0", + "license": "MIT", + "description": "Android WebView wrapper that connects to a code-server instance running on the device", + "scripts": { + "sync": "cap sync android", + "open": "cap open android" + }, + "dependencies": { + "@capacitor/android": "^6.0.0", + "@capacitor/core": "^6.0.0" + }, + "devDependencies": { + "@capacitor/cli": "^6.0.0", + "typescript": "^5.6.2" + } +} diff --git a/ci/android/www/index.html b/ci/android/www/index.html new file mode 100644 index 000000000000..44a5b9857cd6 --- /dev/null +++ b/ci/android/www/index.html @@ -0,0 +1,16 @@ + + + + + + code-server + + + +

Loading code-server...

+ + diff --git a/docs/android-webview.md b/docs/android-webview.md new file mode 100644 index 000000000000..4f321eea900b --- /dev/null +++ b/docs/android-webview.md @@ -0,0 +1,27 @@ +# Android WebView app + +A small Android app that opens a locally running code-server in a WebView, so +you get a full-screen app instead of a browser tab. + +The app does **not** bundle code-server or Node.js (it does not use Node.js +Mobile). You run code-server on the device yourself, normally in +[Termux](./termux.md), where terminals, language servers, and sockets work as +on any Linux system. The app only displays `http://127.0.0.1:8080`. + +## Usage + +1. Install code-server in Termux by following the [Termux guide](./termux.md). + code-server requires Node.js 24; check with `node -v`. +2. Set a password in `~/.config/code-server/config.yaml` and keep + `auth: password`. Any app on the device can reach `127.0.0.1:8080`, so do not + disable authentication. +3. Start code-server in Termux: `code-server`. +4. Open the app. It loads `http://127.0.0.1:8080`. + +If you change the port in `bind-addr`, rebuild the app with the matching +`server.url` in [`ci/android/capacitor.config.ts`](../ci/android/capacitor.config.ts). + +## Building + +See [`ci/android/README.md`](../ci/android/README.md). The `Build Android +WebView APK` workflow builds a debug APK and uploads it as an artifact. diff --git a/package.json b/package.json index 8c017c204aa5..ad493780f36e 100644 --- a/package.json +++ b/package.json @@ -1,16 +1,152 @@ { - "name": "mycode-app", - "version": "1.0.0", - "description": "code-server backend එකට connect වෙන WebView APK", + "name": "code-server", + "license": "MIT", + "version": "0.0.0", + "description": "Run VS Code on a remote server.", + "homepage": "https://github.com/coder/code-server", + "bugs": { + "url": "https://github.com/coder/code-server/issues" + }, + "repository": "https://github.com/coder/code-server", "scripts": { - "sync": "npx cap sync android", - "open": "npx cap open android" + "clean": "./ci/build/clean.sh", + "build": "./ci/build/build-code-server.sh", + "build:vscode": "./ci/build/build-vscode.sh", + "doctoc": "./ci/dev/doctoc.sh", + "release": "./ci/build/build-release.sh", + "release:prep": "./ci/build/release-prep.sh", + "test:e2e": "VSCODE_IPC_HOOK_CLI= ./ci/dev/test-e2e.sh", + "test:e2e:proxy": "USE_PROXY=1 ./ci/dev/test-e2e.sh", + "test:unit": "./ci/dev/test-unit.sh --forceExit --detectOpenHandles", + "test:integration": "./ci/dev/test-integration.sh", + "test:native": "./ci/dev/test-native.sh", + "test:scripts": "./ci/dev/test-scripts.sh", + "package": "./ci/build/build-packages.sh", + "prettier": "prettier --write --log-level=warn --cache .", + "preinstall": "node ./ci/dev/preinstall.js", + "postinstall": "./ci/dev/postinstall.sh", + "publish:npm": "./ci/steps/publish-npm.sh", + "publish:docker": "./ci/steps/docker-buildx-push.sh", + "fmt": "npm run prettier && ./ci/dev/doctoc.sh", + "lint:scripts": "./ci/dev/lint-scripts.sh", + "lint:ts": "eslint --max-warnings=0 --fix $(git ls-files '*.ts' '*.js' | grep -v 'lib/vscode')", + "test": "echo 'Run npm run test:unit or npm run test:e2e' && exit 1", + "watch": "VSCODE_DEV=1 VSCODE_IPC_HOOK_CLI= NODE_OPTIONS='--max_old_space_size=32384 --trace-warnings' ts-node ./ci/dev/watch.ts", + "icons": "./ci/dev/gen_icons.sh" + }, + "main": "out/node/entry.js", + "devDependencies": { + "@eslint/compat": "^1.2.0", + "@eslint/eslintrc": "^3.1.0", + "@eslint/js": "^9.12.0", + "@types/compression": "^1.7.3", + "@types/cookie-parser": "^1.4.4", + "@types/eslint__js": "^8.42.3", + "@types/express": "^5.0.0", + "@types/http-proxy": "1.17.7", + "@types/js-yaml": "^4.0.6", + "@types/node": "24.x", + "@types/pem": "^1.14.1", + "@types/proxy-from-env": "^1.0.1", + "@types/safe-compare": "^1.1.0", + "@types/semver": "^7.5.2", + "@types/trusted-types": "^2.0.4", + "@types/ws": "^8.5.5", + "doctoc": "^2.2.1", + "eslint": "^9.12.0", + "eslint-config-prettier": "^10.1.8", + "eslint-import-resolver-typescript": "^4.4.4", + "eslint-plugin-import": "^2.28.1", + "eslint-plugin-prettier": "^5.0.0", + "globals": "^17.6.0", + "prettier": "3.9.4", + "prettier-plugin-sh": "^0.20.2", + "ts-node": "^10.9.1", + "typescript": "^5.6.2", + "typescript-eslint": "^8.8.0" }, "dependencies": { - "@capacitor/core": "^6.0.0", - "@capacitor/android": "^6.0.0" + "@coder/logger": "^3.0.1", + "argon2": "^0.44.0", + "compression": "^1.7.4", + "cookie": "^1.1.1", + "cookie-parser": "^1.4.6", + "env-paths": "^2.2.1", + "express": "^5.0.1", + "http-proxy": "^1.18.1", + "httpolyglot": "^0.1.2", + "i18next": "^26.3.1", + "js-yaml": "^5.2.3", + "limiter": "^4.1.0", + "pem": "^1.14.8", + "proxy-agent": "^6.3.1", + "qs": "^6.15.0", + "rotating-file-stream": "^3.1.1", + "safe-compare": "^1.1.4", + "semver": "^7.5.4", + "ws": "^8.14.2", + "xdg-basedir": "^4.0.0" }, - "devDependencies": { - "@capacitor/cli": "^6.0.0" + "resolutions": { + "@types/node": "24.x" + }, + "bin": { + "code-server": "out/node/entry.js" + }, + "keywords": [ + "vscode", + "development", + "ide", + "coder", + "vscode-remote", + "browser-ide", + "remote-development" + ], + "engines": { + "node": "24" + }, + "jest": { + "transform": { + "^.+\\.ts$": "/test/node_modules/ts-jest" + }, + "testEnvironment": "node", + "testPathIgnorePatterns": [ + "/node_modules/", + "/lib/", + "/out/", + "test/e2e" + ], + "collectCoverage": true, + "collectCoverageFrom": [ + "/src/**/*.ts" + ], + "coverageDirectory": "/coverage", + "coverageReporters": [ + "json", + "json-summary", + "text", + "clover" + ], + "coveragePathIgnorePatterns": [ + "/out" + ], + "coverageThreshold": { + "global": { + "lines": 60 + } + }, + "modulePathIgnorePatterns": [ + "/release-packages", + "/release", + "/release-standalone", + "/release-npm-package", + "/release-gcp", + "/release-images", + "/lib" + ], + "moduleNameMapper": { + "^.+\\.(css|less)$": "/test/utils/cssStub.ts" + }, + "globalSetup": "/test/utils/globalUnitSetup.ts" } } diff --git a/www/index.html b/www/index.html deleted file mode 100644 index df68cd526e3b..000000000000 --- a/www/index.html +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - MyCode - - - -

Loading MyCode...

- -