Skip to content
This repository has been archived by the owner on Jul 14, 2024. It is now read-only.

Commit

Permalink
第一次Push
Browse files Browse the repository at this point in the history
第一次Push
  • Loading branch information
ArcticFoxPro committed Jul 27, 2023
0 parents commit 6dc01dd
Show file tree
Hide file tree
Showing 45 changed files with 1,475 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

.DS_Store
*.properties
129 changes: 129 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
# 在 Android 平板上使用 VS Code([`code-server`](https://coder.com/docs/code-server/)

<center>![](/ReadmeImageZhCN.png)</center>

## English

[README_EN.md](/README_EN.md)(Translated by ChatGPT 3.5)

## 这个仓库是什么?

这个仓库实际上是一个套壳 Android WebView 的应用程序源码,网站指向了 http://127.0.0.1:8080/

其实做这个项目是因为是我觉得截止目前的主流通过在 Android 本地模拟 Linux 服务器并在此基础上运行 [`code-server`](https://coder.com/docs/code-server/) 的方案的界面并不是很好看,于是我做了一个适配异形屏,隐藏导航栏但不隐藏状态栏的 Android WebView 套壳软件来弥补这个问题。可以为有相同需求者节省时间。

如果你对此仓库有相关建议,欢迎提交 issue(s) 或 PR。

## 如何使用?

以下内容均需要非中国大陆网络环境。

### 初次配置

在 F-Droid 中下载 termux 软件:[https://f-droid.org/zh_Hans/packages/com.termux/](https://f-droid.org/zh_Hans/packages/com.termux/)

[![](https://gitlab.com/fdroid/artwork/-/raw/master/badge/get-it-on-zh-hans.png)](https://f-droid.org/zh_Hans/packages/com.termux/)

在本仓库的发行版中下载 8080 软件,也可自行编译。

下载完成后,打开 termux 软件,输入此命令以选择 termux 所在镜像:

```bash
termux-change-repo
```

然后输入下列命令安装 OpenSSL 和 Ubuntu 环境

```bash
pkg install wget openssl-tool proot -y
```

```bash
hash -r
```

```bash
wget https://raw.githubusercontent.com/EXALAB/AnLinux-Resources/master/Scripts/Installer/Ubuntu/ubuntu.sh
```

```bash
bash ubuntu.sh
```

然后,输入此命令以启动 Ubuntu 环境:

```bash
./start-ubuntu.sh
```

进入 Ubuntu 环境后,输入下列命令下载并解压 `code-server`

```bash
apt update && apt upgrade
```

> 请注意替换尖括号及其内容为相应版本号,例如:`wget https://github.com/coder/code-server/releases/download/v4.15.0/code-server-4.15.0-linux-arm64.tar.gz`
```bash
wget https://github.com/cdr/code-server/releases/download/<VERSION>/code-server-<VERSION>-linux-arm64.tar.gz
```

> 请注意替换尖括号及其内容为相应版本号,例如:`tar -xvf ./code-server-4.15.0-linux-arm64.tar.gz`
```bash
tar -xvf ./code-server-<VERSION>-linux-arm64.tar.gz
```

移动的解压后目录:

> 请注意替换尖括号及其内容为相应版本号,例如:`cd code-server-4.15.0-linux-arm64/bin`
```bash
cd code-server-<VERSION>-linux-arm64/bin
```

输入以下命令设置进入 `code-server` 的临时密码:

> 请注意替换尖括号及其内容为你设置的密码。
```bash
export PASSWORD="<PASSWORD>"
```

启动 `code-server`:

```bash
./code-server
```

打开从本仓库下载的 8080 软件,输入你设置的密码,即可进入 `code-server`

### 日后使用

打开 termux,依次运行以下命令:

```bash
./start-ubuntu.sh
```

> 请注意替换尖括号及其内容为相应版本号。
```bash
cd code-server-<VERSION>-linux-arm64/bin
```

> 请注意替换尖括号及其内容为你设置的密码。
```bash
export PASSWORD="<PASSWORD>"
```

```bash
./code-server
```

然后打开 8080 软件即可。

### 更多

由于 termux 的文件保存在私有目录(data/data)中,非 root 设备无法进入,因此可以通过在 Ubuntu 环境下安装各种使用 SSH、Web 等方式的服务器管理工具进行文件管理。
129 changes: 129 additions & 0 deletions README_EN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
> Translated from Chinese Simplified by ChatGPT 3.5.
# Use VS Code on Your Android Tablet([`code-server`](https://coder.com/docs/code-server/)

<center>![](/ReadmeImageEN.png)</center>

## 简体中文

[README简体中文.md](/README.md)

## What is this repository?

This repository is actually the source code of an Android WebView application with a shell, which points to http://127.0.0.1:8080/.

I created this project because I felt that the existing solutions for running [`code-server`](https://coder.com/docs/code-server/) on Android tablets, which involve emulating a local Linux server and running `code-server` on top of it, had interfaces that were not very appealing. Therefore, I created an Android WebView shell application that adapts to unconventional screen sizes, hides the navigation bar but not the status bar, to address this issue. This can save time for those with the same requirement.

If you have any suggestions or feedback regarding this repository, please feel free to submit issue(s) or PR.

## How to use?

### Initial Configuration

Download the `termux` app from F-Droid: [https://f-droid.org/packages/com.termux/](https://f-droid.org/packages/com.termux/)

[![](https://gitlab.com/fdroid/artwork/-/raw/master/badge/get-it-on-en-us.png)](https://f-droid.org/en/packages/com.termux/)

In the Releases section of this repository, download the 8080 app, or you can compile it yourself.

After the download is complete, open the `termux` app and enter the following command to select the mirror for `termux`:

```bash
termux-change-repo
```

Then enter the following commands to install OpenSSL and the Ubuntu environment:

```bash
pkg install wget openssl-tool proot -y
```

```bash
hash -r
```

```bash
wget https://raw.githubusercontent.com/EXALAB/AnLinux-Resources/master/Scripts/Installer/Ubuntu/ubuntu.sh
```

```bash
bash ubuntu.sh
```

Then, enter the following command to start the Ubuntu environment:

```bash
./start-ubuntu.sh
```

Once inside the Ubuntu environment, enter the following command to download and extract `code-server`:

```bash
apt update && apt upgrade
```

> Please note to replace the angle brackets and their contents with the corresponding version number, for example: `wget https://github.com/coder/code-server/releases/download/v4.15.0/code-server-4.15.0-linux-arm64.tar.gz`.
```bash
wget https://github.com/cdr/code-server/releases/download/<VERSION>/code-server-<VERSION>-linux-arm64.tar.gz
```

> Please note to replace the angle brackets and their contents with the corresponding version number, for example: `tar -xvf ./code-server-4.15.0-linux-arm64.tar.gz`.
```bash
tar -xvf ./code-server-<VERSION>-linux-arm64.tar.gz
```

Move to the extracted directory:

> Please note to replace the angle brackets and their contents with the corresponding version number, for example: `cd code-server-4.15.0-linux-arm64/bin`.
```bash
cd code-server-<VERSION>-linux-arm64/bin
```

Enter the following command to set a temporary password for accessing `code-server`:

> Please note to replace the angle brackets and their contents with your desired password.
```bash
export PASSWORD="<PASSWORD>"
```

Start `code-server`:

```bash
./code-server
```

Open the 8080 app that you downloaded from this repository and enter the password you set to access `code-server`.

### Subsequent Usage

Open `termux` and execute the following commands:

```bash
./start-ubuntu.sh
```

> Please note to replace the angle brackets and their contents with the corresponding version number.
```bash
cd code-server-<VERSION>-linux-arm64/bin
```

> Please note to replace the angle brackets and their contents with your set password.
```bash
export PASSWORD="<PASSWORD>"
```

```bash
./code-server
```

Then open the 8080 app.

### Additional Notes

Since termux stores files in a private directory (data/data), non-root devices cannot access it. Therefore, you can install various server management tools in the Ubuntu environment, such as SSH or web-based tools, to manage files.
Binary file added ReadmeImageEN.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ReadmeImageZhCN.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
54 changes: 54 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
}

android {
namespace 'com.dev.a8080'
compileSdk 33

defaultConfig {
applicationId "com.dev.a8080"
minSdk 26
targetSdk 33
versionCode 1
versionName "1.0"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

}

splits {
abi{
enable true
reset()
include 'arm64-v8a','armeabi-v7a','x86','x86_64'
universalApk true
}
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
}

dependencies {

implementation 'androidx.core:core-ktx:1.10.1'
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.9.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
}
21 changes: 21 additions & 0 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
22 changes: 22 additions & 0 deletions app/src/androidTest/java/com/dev/a8080/ExampleInstrumentedTest.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.dev.a8080

import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.platform.app.InstrumentationRegistry
import org.junit.Assert.*
import org.junit.Test
import org.junit.runner.RunWith

/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
@Test
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("com.dev.a8080", appContext.packageName)
}
}
Loading

0 comments on commit 6dc01dd

Please sign in to comment.