Skip to content

Commit

Permalink
feat(code-server): update code-server to 4.8.3
Browse files Browse the repository at this point in the history
  • Loading branch information
vhqtvn committed Nov 12, 2022
1 parent a38e8ed commit fae00a9
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 23 deletions.
10 changes: 5 additions & 5 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ f1b0486b404c03225e0870082a6e17d79650e7b92261e7c8cc983a320c2fcec7 bootstrap-arm.
dc1aec73f587228ff5e41b511c675cd47abcfcef17c361157b25c2cac10f5da4 bootstrap-i686.zip
db86eca36238cc0b6aeccf6b98768114fc035249b2a6d252c54987a6c7e167f6 bootstrap-x86_64.zip
""")
def csVersion = "cs-2022.07.31-r1"
def csVersion = "cs-2022.11.12-r1"
def csHashes = parseHashes("""
72326828536cf8af5392114d685f6384b7e1ac38e60d9f1434068e208810eac5 cs-aarch64.tgz
6b499ddb038f7bde85f8bf8fc5c42a707463e7cd378afec2e27887c6c71bc5e2 cs-arm.tgz
bb9365287652bc9afb6bd76cd9d46ba894f715652de3d42ac8998cce2991bb30 cs-x86.tgz
aa0711d3c4062c5f7d569b547a4bb5fa1d3cec8c0cd7995c69d89a73d0bf2192 cs-x86_64.tgz
69f36e469c018ecbd94811e7e148839480986c403bcabe2b58b75cb34cdfde75 cs-aarch64.tgz
3a3f97ceb9f68d810d500c2baabbba1f207243450da078b00ed778ac16c6947e cs-arm.tgz
9a06629ce8457508b7bfa89e7e6f47dfb09a8c5ae3862f5f6ad8b6e26d6496d0 cs-x86.tgz
0d8a7be13050e622c692a40bf8df2b6cf7c9d9f9f33f86c074f3df0811b25092 cs-x86_64.tgz
""")

def packageJsonFile = new File(projectDir, "../package.json")
Expand Down
31 changes: 22 additions & 9 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
Expand All @@ -8,27 +9,35 @@
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission
android:name="android.permission.WRITE_SETTINGS"
tools:ignore="ProtectedPermissions" />
<uses-permission
android:name="android.permission.WRITE_SECURE_SETTINGS"
tools:ignore="ProtectedPermissions" />

<uses-configuration android:reqTouchScreen="undefined" />
<uses-feature android:name="android.hardware.touchscreen" android:required="false" />
<uses-configuration android:reqTouchScreen="undefined" />
<uses-feature
android:name="android.hardware.touchscreen"
android:required="false" />

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:networkSecurityConfig="@xml/network_security_config"
android:roundIcon="@mipmap/ic_launcher_round"
android:resizeableActivity="true"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme"
android:usesCleartextTraffic="true">
<activity
android:name=".root.NewSessionActivity"
android:exported="false"
android:configChanges="orientation|screenSize|smallestScreenSize|screenLayout|keyboardHidden|keyboard|navigation|fontScale|uiMode"
android:exported="false"
android:launchMode="singleInstance"
android:resizeableActivity="true"
android:windowSoftInputMode="adjustResize"
android:launchMode="singleInstance" />
android:windowSoftInputMode="adjustResize" />
<activity
android:name=".root.EditorHostActivity"
android:configChanges="orientation|screenSize|smallestScreenSize|screenLayout|keyboardHidden|keyboard|navigation|fontScale|uiMode"
Expand All @@ -48,8 +57,12 @@
android:enabled="true"
android:exported="true" />

<meta-data android:name="com.samsung.android.keepalive.density" android:value="true"/>
<meta-data android:name="com.samsung.android.multidisplay.keep_process_alive" android:value="true"/>
<meta-data
android:name="com.samsung.android.keepalive.density"
android:value="true" />
<meta-data
android:name="com.samsung.android.multidisplay.keep_process_alive"
android:value="true" />
</application>

</manifest>
3 changes: 2 additions & 1 deletion app/src/main/java/vn/vhn/vhscode/CodeServerService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ class CodeServerService() : Service() {
}
}

fun buildEnv(): Array<String> {
fun buildEnv(vararg customEnvs: String): Array<String> {
val envHome = ROOT_PATH

val env = mutableListOf<String>()
Expand All @@ -264,6 +264,7 @@ class CodeServerService() : Service() {
env.add("PREFIX=${PREFIX_PATH}")
env.add("SHELL=${PREFIX_PATH}/usr/bin/bash")
env.add("TERMUX_PKG_NO_MIRROR_SELECT=1")
env.addAll(customEnvs)

Log.d(TAG, "env = " + env.toString())

Expand Down
3 changes: 1 addition & 2 deletions app/src/main/java/vn/vhn/vhscode/root/NewSessionActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import com.facebook.react.ReactRootView
import com.facebook.react.common.LifecycleState
import com.facebook.soloader.SoLoader
import com.google.android.material.textfield.TextInputEditText
import com.rnfs.RNFSPackage
import com.termux.app.TermuxInstaller
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
Expand All @@ -52,7 +51,7 @@ import java.net.URL
class NewSessionActivity : AppCompatActivity(), VHEApiModuleHandler {
companion object {
val TAG = "NewSessionActivity"
val kCurrentServerVersion = "4.5.1-" + BuildConfig.CS_VERSION
val kCurrentServerVersion = "4.8.3-" + BuildConfig.CS_VERSION

val kVersionCheckPeriodMilli = 24 * 60 * 60 * 1000; // 1 day

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ class CodeServerLocalService(
"--cert-key", "${CodeServerService.HOME_PATH}/cert.key"
) else arrayOf()) +
arrayOf(
"--app-name",
"VHEditor::code-server",
"--auth",
"none",
"--host",
Expand All @@ -139,7 +141,7 @@ class CodeServerLocalService(
mPort.toString(),
"--without-connection-token"
)
val env = CodeServerService.buildEnv()
val env = CodeServerService.buildEnv("VSCODE__WITHOUT_CONNECTION_TOKEN=1")
File("${CodeServerService.PREFIX_PATH}/run-vs-code.sh").bufferedWriter().use {
for (e in env) it.write("$e ")
for (c in cmd) it.write("$c ")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,8 @@ class VSCodeFragment : Fragment() {
_binding?.txtServerLog?.post {
_binding?.also {
var displayTxt =
if (txt.length > 1000)
txt.substring(txt.length - 1000)
if (txt.length > 10000)
"..." + txt.substring(txt.length - 10000)
else txt
it.txtServerLog.setTextKeepState(displayTxt)
if (it.txtServerLog.layout == null) return@post
Expand Down
10 changes: 7 additions & 3 deletions app/src/main/res/raw/boot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,18 @@ const fs = require("fs");
}
if(!p.hasOwnProperty("terminal.integrated.gpuAcceleration")) {
console.log("Setting default option for terminal.integrated.gpuAcceleration: off");
settings["terminal.integrated.gpuAcceleration"] = "off";
p["terminal.integrated.gpuAcceleration"] = "off";
needwrite = true;
}
if(needwrite) {
fs.mkdirSync("/data/data/vn.vhn.vsc/files/home/.local/share/code-server/User", {recursive: true});
try{
fs.mkdirSync("/data/data/vn.vhn.vsc/files/home/.local/share/code-server/User", {recursive: true});
}catch(e){}
fs.writeFileSync("/data/data/vn.vhn.vsc/files/home/.local/share/code-server/User/settings.json", JSON.stringify(p, null, 2));
}
}catch(e){}
}catch(e){
console.log("Error: ",e);
}
})();
(function() {
Expand Down
6 changes: 6 additions & 0 deletions app/src/main/res/raw/globalinject.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
(function(){
(function(){
const av = process.argv;
if(av.length>=2 && av[1].match(/release-standalone\/out\/node\/entry$/) && process.env.VSCODE__WITHOUT_CONNECTION_TOKEN)
av.push("--without-connection-token")
})();

const fs = require('fs');
const os = require('os');

Expand Down

0 comments on commit fae00a9

Please sign in to comment.