Compare commits

...

19 Commits

Author SHA1 Message Date
Caten
938745036d Update code to v1.0.12+2
wakelock, modified proot with binfmt-like feature, more wine scripts
2023-12-11 15:07:07 +08:00
Caten
b3428555c6 box and wine initial support 2023-11-30 15:57:56 +08:00
Caten
2a19c5eb78 Audio fix, more install scripts 2023-11-25 08:20:12 +08:00
Caten
54a941da63 update readme 2023-11-11 21:28:48 +08:00
Caten
87beedef68 adjust readme 2023-11-11 18:05:11 +08:00
Caten
c6afc4d468 virgl support 2023-11-11 11:23:16 +08:00
Caten
6dbe710fdc getifaddrs fix 2023-11-10 21:29:07 +08:00
Caten
cf8ce47662 Organize the code 2023-11-09 12:48:55 +08:00
Caten
86ce2315d4 Add signal 9 info, adjust readme 2023-11-07 17:29:49 +08:00
Caten
6e51e5b2d2 fix tab key eaten 2023-10-19 23:45:33 +08:00
Caten
0971059111 backup 2023-10-10 18:16:56 +08:00
Caten
2cf19179f9 Fix keyboard plug in, streaming don't close 2023-10-09 06:47:57 +08:00
Caten
b6d4d2f11b Adjust ads watch settings, add saf documents provider, camera stream, more permission 2023-10-08 16:40:51 +08:00
Caten
5a6f04d094 Update help message 2023-10-03 21:50:59 +08:00
Caten
195a2f50a3 Fix boot options 2023-10-03 20:51:29 +08:00
Caten
16a14c8a3e Adjust help message 2023-10-03 13:15:11 +08:00
Caten
f15899be95 Fix enter and sticky key 2023-10-02 19:06:41 +08:00
Caten
27a5073551 Fix enter (pty) key, add broken stick key support 2023-10-02 15:44:52 +08:00
Caten
b4ca9ae4f7 Add font scale, terminal max line, vip skip ads feature 2023-10-02 05:47:08 +08:00
28 changed files with 2718 additions and 602 deletions

View File

@@ -2,54 +2,70 @@
<img decoding="async" src="readme/cover0.png" width="50%">
即开即用的类PC环境内置火狐浏览器和fcitx输入法等常用软件
给所有安卓arm64设备的“PC应用引擎”平替
Click-to-run debian bookworm xfce on android for Chinese users, with fcitx pinyin input method preinstalled. No termux required.
## 特点
- 一键安装,即开即用
- 来自kali-undercover的win10主题(仅xfce版本),友好的界面
<img decoding="async" src="readme/img1.png" width="50%">
- 提供常用软件的一键安装指令
<img decoding="async" src="readme/img2.png" width="50%">
- 可方便地改变屏幕缩放,不用担心屏幕过大或过小
<img decoding="async" src="readme/img3.gif" width="50%">
- 便捷访问设备文件或通过设备SAF访问软件文件
<img decoding="async" src="readme/img4.png" width="50%">
- 提供终端和众多可调节参数供高级用户使用
<img decoding="async" src="readme/img5.png" width="50%">
## 原理
使用proot运行debian环境
内置[noVNC](https://github.com/novnc/noVNC)显示图形界面
初次启动由于解压的缘故要点时间
以后点开就能用
只支持arm64安卓
## 项目结构
assets的文件来源如下:
assets的文件来源信息可以在[这里](extra/readme.md)找到。
- [proot](https://github.com/Cateners/proot), 使用[build-proot-android](https://github.com/green-green-avk/build-proot-android)脚本编译
- [busybox](https://github.com/meefik/busybox)
- [tar](https://github.com/Rprop/tar-android-static)
- [Xserver XSDL, pulseaudio相关文件](https://github.com/pelya/commandergenius/tree/sdl_android/project/jni/application/xserver)
- [Tmoe Linux, debian包来源](https://github.com/2moe/tmoe)
其中tar、busybox和pulseaudio相关文件都是直接用了二进制文件。
对debian容器进行了如下修改
- 使用tmoe安装了xfce环境和全套VNC
- 使用kali-undercover提供的Win10主题美化xfce
- (使用tmoe)安装了fcitx输入法和云拼音组件。按<Ctrl+空格>切换输入法。
- 强烈建议**不要**使用安卓中文输入法直接输入中文,而是使用英文键盘通过容器的输入法输入中文,避免丢字错字。
- 对noVNC进行[修改](https://github.com/Cateners/noVNC)添加了scale factor滑块控制缩放(scale_factor分支)添加了上下左右shift等按键(arrow_key分支)
- 在主目录下可以方便地访问手机存储(如果提供了存储权限的话)
- 启动时会尝试挂载手机的一些字体目录(AppFiles/Fonts、Fonts和/system/fonts), 如果这些目录下有字体文件的话会一并加载到系统中,无需额外安装
- 最后采用tar.xz压缩用split命令分成了xa*等多个文件
完整的容器制作过程可以在[这里](extra/build-tiny-rootfs.md)看到。
数据包不再在assets中更新而是随releases提供主要是为了避免git越来越大
lib目录
- main.dart文件页面布局老实说已经有点乱
- main.dart文件页面布局有点乱
- workflow.dart文件逻辑部分目前也还可以理解
- Util 工具类
- TermPty 一个终端
- G 全局变量类
- Workflow 从软件点开到容器启动的所有步骤
## 编译
你需要配置好flutter和安卓sdk然后克隆此项目。
在编译之前需要在release中下载系统rootfs(或者[自行制作](extra/build-tiny-rootfs.md))之后使用split命令分割拷贝到assets。一般我将其分为98MB。
`split -b 98M debian.tar.xz`
然后修改workflow的代码找到复制资源的部分把生成的xa\*名字写进去(我还不知道怎么写代码识别有多少个xa*文件)
接下来就可以编译了。我使用的命令如下:
`flutter build apk --target-platform android-arm64 --split-per-abi --obfuscate --split-debug-info=tiny_computer/sdi`
## 目前已知bug
多用户/分身情形无法sudo, 其它见issue

View File

@@ -38,6 +38,7 @@ android {
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
main.java.srcDirs += 'src/main/java'
}
defaultConfig {
@@ -45,7 +46,7 @@ android {
applicationId "com.fct.tiny"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
minSdkVersion flutter.minSdkVersion
minSdkVersion 24 //ffmpeg_kit; flutter.minSdkVersion
targetSdkVersion 28 //https://github.com/termux/termux-app/issues/1072; native; linker; flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
@@ -63,6 +64,13 @@ android {
//checkReleaseBuilds false
abortOnError false
}
packagingOptions {
pickFirst 'lib/arm64-v8a/libc++_shared.so'
pickFirst 'lib/x86_64/libc++_shared.so'
pickFirst 'lib/armeabi-v7a/libc++_shared.so'
pickFirst 'lib/arm64-v8a/libc++_shared.so'
}
}
flutter {

View File

@@ -2,6 +2,9 @@
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<application
android:label="小小电脑"
android:name="${applicationName}"
@@ -12,7 +15,7 @@
android:exported="true"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:configChanges="navigation|orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
<!-- Specifies an Android theme to apply to this Activity as soon as
@@ -28,6 +31,16 @@
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<provider
android:name="com.example.tiny_computer.filepicker.TinyDocumentsProvider"
android:authorities="com.example.tiny_computer.documents"
android:exported="true"
android:grantUriPermissions="true"
android:permission="android.permission.MANAGE_DOCUMENTS">
<intent-filter>
<action android:name="android.content.action.DOCUMENTS_PROVIDER" />
</intent-filter>
</provider>
<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
<meta-data

View File

@@ -0,0 +1,270 @@
package com.example.tiny_computer.filepicker;
import android.annotation.TargetApi;
import android.content.res.AssetFileDescriptor;
import android.database.Cursor;
import android.database.MatrixCursor;
import android.graphics.Point;
import android.os.Build;
import android.os.CancellationSignal;
import android.os.ParcelFileDescriptor;
import android.provider.DocumentsContract.Document;
import android.provider.DocumentsContract.Root;
import android.provider.DocumentsProvider;
import android.webkit.MimeTypeMap;
import com.example.tiny_computer.R;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Collections;
import java.util.LinkedList;
//This file is mainly copied from Termux :P
/**
* A document provider for the Storage Access Framework which exposes the files in the
* $HOME/ directory to other apps.
* <p/>
* Note that this replaces providing an activity matching the ACTION_GET_CONTENT intent:
* <p/>
* "A document provider and ACTION_GET_CONTENT should be considered mutually exclusive. If you
* support both of them simultaneously, your app will appear twice in the system picker UI,
* offering two different ways of accessing your stored data. This would be confusing for users."
* - http://developer.android.com/guide/topics/providers/document-provider.html#43
*/
public class TinyDocumentsProvider extends DocumentsProvider {
private static final String ALL_MIME_TYPES = "*/*";
// The default columns to return information about a root if no specific
// columns are requested in a query.
private static final String[] DEFAULT_ROOT_PROJECTION = new String[]{
Root.COLUMN_ROOT_ID,
Root.COLUMN_MIME_TYPES,
Root.COLUMN_FLAGS,
Root.COLUMN_ICON,
Root.COLUMN_TITLE,
Root.COLUMN_SUMMARY,
Root.COLUMN_DOCUMENT_ID,
Root.COLUMN_AVAILABLE_BYTES
};
// The default columns to return information about a document if no specific
// columns are requested in a query.
private static final String[] DEFAULT_DOCUMENT_PROJECTION = new String[]{
Document.COLUMN_DOCUMENT_ID,
Document.COLUMN_MIME_TYPE,
Document.COLUMN_DISPLAY_NAME,
Document.COLUMN_LAST_MODIFIED,
Document.COLUMN_FLAGS,
Document.COLUMN_SIZE
};
@Override
public Cursor queryRoots(String[] projection) {
final MatrixCursor result = new MatrixCursor(projection != null ? projection : DEFAULT_ROOT_PROJECTION);
final String applicationName = "小小电脑";
final File BASE_DIR = new File(getContext().getFilesDir(), "containers");
final MatrixCursor.RowBuilder row = result.newRow();
row.add(Root.COLUMN_ROOT_ID, getDocIdForFile(BASE_DIR));
row.add(Root.COLUMN_DOCUMENT_ID, getDocIdForFile(BASE_DIR));
row.add(Root.COLUMN_SUMMARY, null);
row.add(Root.COLUMN_FLAGS, Root.FLAG_SUPPORTS_CREATE | Root.FLAG_SUPPORTS_SEARCH | Root.FLAG_SUPPORTS_IS_CHILD);
row.add(Root.COLUMN_TITLE, applicationName);
row.add(Root.COLUMN_MIME_TYPES, ALL_MIME_TYPES);
row.add(Root.COLUMN_AVAILABLE_BYTES, BASE_DIR.getFreeSpace());
row.add(Root.COLUMN_ICON, R.mipmap.ic_launcher);
return result;
}
@Override
public Cursor queryDocument(String documentId, String[] projection) throws FileNotFoundException {
final MatrixCursor result = new MatrixCursor(projection != null ? projection : DEFAULT_DOCUMENT_PROJECTION);
includeFile(result, documentId, null);
return result;
}
@Override
public Cursor queryChildDocuments(String parentDocumentId, String[] projection, String sortOrder) throws FileNotFoundException {
final MatrixCursor result = new MatrixCursor(projection != null ? projection : DEFAULT_DOCUMENT_PROJECTION);
final File parent = getFileForDocId(parentDocumentId);
for (File file : parent.listFiles()) {
includeFile(result, null, file);
}
return result;
}
@Override
public ParcelFileDescriptor openDocument(final String documentId, String mode, CancellationSignal signal) throws FileNotFoundException {
final File file = getFileForDocId(documentId);
final int accessMode = ParcelFileDescriptor.parseMode(mode);
return ParcelFileDescriptor.open(file, accessMode);
}
@Override
public AssetFileDescriptor openDocumentThumbnail(String documentId, Point sizeHint, CancellationSignal signal) throws FileNotFoundException {
final File file = getFileForDocId(documentId);
final ParcelFileDescriptor pfd = ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY);
return new AssetFileDescriptor(pfd, 0, file.length());
}
@Override
public boolean onCreate() {
return true;
}
@Override
public String createDocument(String parentDocumentId, String mimeType, String displayName) throws FileNotFoundException {
File newFile = new File(parentDocumentId, displayName);
int noConflictId = 2;
while (newFile.exists()) {
newFile = new File(parentDocumentId, displayName + " (" + noConflictId++ + ")");
}
try {
boolean succeeded;
if (Document.MIME_TYPE_DIR.equals(mimeType)) {
succeeded = newFile.mkdir();
} else {
succeeded = newFile.createNewFile();
}
if (!succeeded) {
throw new FileNotFoundException("Failed to create document with id " + newFile.getPath());
}
} catch (IOException e) {
throw new FileNotFoundException("Failed to create document with id " + newFile.getPath());
}
return newFile.getPath();
}
@Override
public void deleteDocument(String documentId) throws FileNotFoundException {
File file = getFileForDocId(documentId);
if (!file.delete()) {
throw new FileNotFoundException("Failed to delete document with id " + documentId);
}
}
@Override
public String getDocumentType(String documentId) throws FileNotFoundException {
File file = getFileForDocId(documentId);
return getMimeType(file);
}
@Override
public Cursor querySearchDocuments(String rootId, String query, String[] projection) throws FileNotFoundException {
final MatrixCursor result = new MatrixCursor(projection != null ? projection : DEFAULT_DOCUMENT_PROJECTION);
final File parent = getFileForDocId(rootId);
// This example implementation searches file names for the query and doesn't rank search
// results, so we can stop as soon as we find a sufficient number of matches. Other
// implementations might rank results and use other data about files, rather than the file
// name, to produce a match.
final LinkedList<File> pending = new LinkedList<>();
pending.add(parent);
final int MAX_SEARCH_RESULTS = 50;
while (!pending.isEmpty() && result.getCount() < MAX_SEARCH_RESULTS) {
final File file = pending.removeFirst();
// Avoid directories outside the $HOME directory linked with symlinks (to avoid e.g. search
// through the whole SD card).
boolean isInsideHome;
try {
isInsideHome = file.getCanonicalPath().startsWith(new File(getContext().getFilesDir(), "containers").getAbsolutePath());
} catch (IOException e) {
isInsideHome = true;
}
if (isInsideHome) {
if (file.isDirectory()) {
Collections.addAll(pending, file.listFiles());
} else {
if (file.getName().toLowerCase().contains(query)) {
includeFile(result, null, file);
}
}
}
}
return result;
}
@Override
public boolean isChildDocument(String parentDocumentId, String documentId) {
return documentId.startsWith(parentDocumentId);
}
/**
* Get the document id given a file. This document id must be consistent across time as other
* applications may save the ID and use it to reference documents later.
* <p/>
* The reverse of @{link #getFileForDocId}.
*/
private static String getDocIdForFile(File file) {
return file.getAbsolutePath();
}
/**
* Get the file given a document id (the reverse of {@link #getDocIdForFile(File)}).
*/
private static File getFileForDocId(String docId) throws FileNotFoundException {
final File f = new File(docId);
if (!f.exists()) throw new FileNotFoundException(f.getAbsolutePath() + " not found");
return f;
}
private static String getMimeType(File file) {
if (file.isDirectory()) {
return Document.MIME_TYPE_DIR;
} else {
final String name = file.getName();
final int lastDot = name.lastIndexOf('.');
if (lastDot >= 0) {
final String extension = name.substring(lastDot + 1).toLowerCase();
final String mime = MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension);
if (mime != null) return mime;
}
return "application/octet-stream";
}
}
/**
* Add a representation of a file to a cursor.
*
* @param result the cursor to modify
* @param docId the document ID representing the desired file (may be null if given file)
* @param file the File object representing the desired file (may be null if given docID)
*/
private void includeFile(MatrixCursor result, String docId, File file)
throws FileNotFoundException {
if (docId == null) {
docId = getDocIdForFile(file);
} else {
file = getFileForDocId(docId);
}
int flags = 0;
if (file.isDirectory()) {
if (file.canWrite()) flags |= Document.FLAG_DIR_SUPPORTS_CREATE;
} else if (file.canWrite()) {
flags |= Document.FLAG_SUPPORTS_WRITE;
}
if (file.getParentFile().canWrite()) flags |= Document.FLAG_SUPPORTS_DELETE;
final String displayName = file.getName();
final String mimeType = getMimeType(file);
if (mimeType.startsWith("image/")) flags |= Document.FLAG_SUPPORTS_THUMBNAIL;
final MatrixCursor.RowBuilder row = result.newRow();
row.add(Document.COLUMN_DOCUMENT_ID, docId);
row.add(Document.COLUMN_DISPLAY_NAME, displayName);
row.add(Document.COLUMN_SIZE, file.length());
row.add(Document.COLUMN_MIME_TYPE, mimeType);
row.add(Document.COLUMN_LAST_MODIFIED, file.lastModified());
row.add(Document.COLUMN_FLAGS, flags);
row.add(Document.COLUMN_ICON, R.mipmap.ic_launcher);
}
}

View File

@@ -6,7 +6,7 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:7.3.0'
classpath 'com.android.tools.build:gradle:7.3.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}

Binary file not shown.

BIN
assets/patch.tar.gz Normal file

Binary file not shown.

196
extra/build-tiny-rootfs.md Normal file
View File

@@ -0,0 +1,196 @@
# build-tiny-rootfs
对小小电脑项目rootfs制作的说明
### 为什么不直接制作一个脚本呢?
因为我不会,所以只能用自然语言记录一下制作步骤。
## 制作步骤
### 安装Debian容器
- 安装Termux
- 在Termux内安装tmoe
- 在tmoe内安装Debian Bookworm的proot容器
- 是否新建sudo用户-是-用户名tiny-密码tiny
- 是否设置tiny为默认用户-是
- 是否为root配置zsh-否
- 是否删除zsh.sh等-是
- 是否启动tmoe tools-是
- 其余对话框默认直接按回车
- 来到tmoe tool界面时取消退出
### 安装其他软件
安装xfce部分是根据记忆写的如果有误请指出。
桌面环境只安装一个。
#### 安装桌面环境(lxqt)
- 输入debian-i进入tmoe tools
- 图形界面-rootless-lxqt-core
- 不安装electron apps
- 不安装chromium
- 按需调整
#### 安装桌面环境(xfce)
前面的部分和lxqt一致只是选桌面环境时选了xfce-lite。
下面是额外的美化部分。推荐先安装软件再做这个因为使用kali-undercover时可能有依赖报错但我忘记是哪些依赖了。但后面安装的某个软件会帮我们把依赖补上。
- xfce美化
- 前往kali源下载kali-undercover包并apt install安装
- 修改kali-undercover脚本中检测xfce环境的地方强制允许
- 即注释第一个if里的exit 1
- 执行kali-undercover
- 按需调整
- 注释.bashrc中把bash风格改为windows风格的语句
- 调整状态栏
- ......
#### 安装VNC
安装桌面环境后会自动进行这一步使用tmoe tools全部安装即可。
- 选择tigervnc
- 密码12345678
安装完成后输入debian-i回到tmoe继续修改一些参数主要目的是避免与termux的容器端口一致产生冲突
- 修改显示端口到5904
- 远程桌面-tigervnc-显示端口-4
- 修改novnc端口到36082
- 远程桌面-novnc-端口-36082
- 修改startnovnc启动脚本(避免每次启动novnc时打开浏览器虽然不是windows)
- 注释start_win10_edge_novnc_addr(大概在倒数第五行)
接下来对novnc应用补丁以添加"通过滑块修改分辨率"等功能
- [下载novnc.patch](https://github.com/Cateners/noVNC/releases/tag/1.2)
- 切换目录到/usr/local/etc/tmoe-linux/novnc
- `patch -p1 < novnc.patch`
- ```bash
find . '(' \
-name \*-baseline -o \
-name \*-merge -o \
-name \*-original -o \
-name \*.orig -o \
-name \*.rej \
')' -delete
```
#### 修复tmoe不能下载软件
在我发布的xfce版本中我给每个aria2c调用都添加了--async-dns=false参数。
先切换到tmoe目录`/usr/local/etc/tmoe-linux/git/share`,然后执行脚本`./replace.sh old-version`
```shell
#!/bin/bash
# 用法: ./replace.sh 目录
# 该脚本会递归地在给定目录下的所有文件中替换文本
# 原文本: aria2c --console-log-level
# 新文本: aria2c --async-dns=false --console-log-level
# 检查参数是否正确
if [ $# -ne 1 ]; then
echo "错误: 需要一个目录作为参数"
exit 1
fi
# 检查目录是否存在
if [ ! -d "$1" ]; then
echo "错误: 目录 $1 不存在"
exit 2
fi
# 遍历目录下的所有文件
find "$1" -type f | while read file; do
# 使用sed命令替换文本
sed -i 's/aria2c --console-log-level/aria2c --async-dns=false --console-log-level/g' "$file"
echo
done
```
用完后删除replace.sh
另外现在tmoe官方给出了[解决办法](https://gitee.com/mo2/linux/issues/I8BQG3),不过我测试似乎还是不行,所以就先这样了
#### 修改apt源
按需修改/etc/apt/sources.list另外把non-free改为non-free-firmware
#### 安装火狐浏览器
`sudo apt install firefox-esr firefox-esr-l10n-zh-cn`
#### 安装输入法
- debian-i
- 03秘密花园-10输入法-fcitx4-安装4libpinyin和6云拼音模块
- 在图形界面应用找到fcitx配置-附加组件-云拼音-配置-云拼音来源把Google改为百度确认
- 启动图形界面输入startnovnc会出现一个类似xxx.xxx.xxx.xxx:36082/vnc.html的网址复制到本机的浏览器中输入vnc密码12345678就可以访问了。
#### 安装gdebi
这个软件包能使用户通过图形界面安装deb安装包
安装:`sudo apt install gdebi`
修改启动器:在/usr/share/applications/gdebi.desktop的Exec=后加上sudo
#### 安装VSCode
VSCode使用tmoe安装正好测试一下不能下载软件的问题是否存在
- 2软件-2开发-1VSCode-1Official
tmoe还会安装gnome-keyring由于之前我做xfce包时会造成VSCode反复弹窗更新密钥环所以被我卸载了这个按需决定是否保留吧
#### 安装ffmpeg
这个是为了预览推流用的,按需安装
`sudo apt install ffmpeg`
### 其他修补
#### cmatrix
这个是给快捷指令的彩蛋。下载cmatrix的包并将cmatrix文件提取放到/home/tiny/.local/bin里即可记得添加执行权限
#### WPS
- 软件设置修改
- 从官网下载WPS linux arm64 deb安装包直接在图形界面点开用gdebi安装(正好测试一下gdebi是否能用)
- 打开WPS-右上角设置-其他-切换窗口管理模式-整合模式改为多组件模式(否则一些设备在新建文档等操作时卡死,目前原因不明)
- 使用gdebi(或自行)卸载WPS
- 字体修补
- 在你的Windows电脑里的C:\Windows\Fonts文件夹找到symbol.ttf、webdings.ttf、wingding.ttf、WINGDNG2.TTF、WINGDNG3.TTF、MTEXTRA.TTF字体并放到容器/usr/share/fonts的某个文件夹下(我新建了extra文件夹并把这些字体放到里面)
- libtiff.so.5库修补
- 切换到/lib/aarch64-linux-gnu文件夹创建软链把libtiff.so.6链接到libtiff.so.5
- 或者找libtiff.so.5的包并安装,这样可能更好一些
### 打包
- 首先退出容器在容器挂载选项里取消对sd和termux的挂载之后进入容器删除termux软连接
- 在后面使用tar打包时即使指定了excludetar也会尝试把它们打包进去
- 这个很可能因为我自己没用对参数,如果你非常自信的话就不需要这么做,自行打包即可=v=
- 在[这里](https://github.com/meefik/busybox/releases)下载提取busybox的可执行文件并放到系统根目录
- 我使用busybox的tar来打包而不是容器自带的tar原因是容器自带的tar会把硬链接打包成单独的文件导致打包解包后占用多出1GB
- 这个也很可能是我自己没用对参数,如果你非常自信就不用这么做......
- 尽可能多地删除使用痕迹,包括但不限于
- apt clean
- /tmp下的文件退出容器后删
- tiny和root目录下的
- .cache
- .vnc/vnc.log, .vnc/x.log
- .bash_history
- .ICEauthority
- .Xauthority
- 等等
- 切换到root用户切换到根目录`/busybox tar -Jcpvf /debian.tar.xz --exclude=debian.tar.xz --exclude=dev --exclude=proc --exclude=system --exclude=storage --exclude=apex --exclude=sys --exclude=media/sd --exclude=busybox --exclude=".l2s.*" /`

56
extra/cross/install-box Normal file
View File

@@ -0,0 +1,56 @@
#!/bin/bash
sudo dpkg --add-architecture armhf
sudo apt update
sudo apt upgrade -y
sudo apt install -y cmake gcc-arm-linux-gnueabihf libc6:armhf
sudo apt reinstall -y libc6-dev
mkdir $HOME/.local/share/tiny/cross
rm -rf $HOME/.local/share/tiny/tmp
mkdir $HOME/.local/share/tiny/tmp
cd $HOME/.local/share/tiny/tmp
git clone https://mirror.ghproxy.com/https://github.com/ptitSeb/box86
if [ $? -ne 0 ]; then
git clone https://github.com/ptitSeb/box86
if [ $? -ne 0 ]; then
rm -rf $HOME/.local/share/tiny/tmp
echo '仓库克隆失败...退出安装...'
exit
fi
fi
git clone https://mirror.ghproxy.com/https://github.com/ptitSeb/box64
if [ $? -ne 0 ]; then
git clone https://github.com/ptitSeb/box64
if [ $? -ne 0 ]; then
rm -rf $HOME/.local/share/tiny/tmp
echo '仓库克隆失败...退出安装...'
exit
fi
fi
cd box86
mkdir build
cd build
cmake .. -DARM64=1 -DBAD_SIGNAL=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo
make -j
cd ../..
mv box86/build/box86 ../cross
mv box86/x86lib ../cross
cd box64
mkdir build
cd build
cmake .. -DARM64=1 -DBAD_SIGNAL=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo
make -j
cd ../..
mv box64/build/box64 ../cross
mv box64/x64lib ../cross
cd ..
rm -rf tmp
echo '安装完成'

35
extra/cross/install-dxvk Normal file
View File

@@ -0,0 +1,35 @@
#!/bin/bash
rm -rf $HOME/.local/share/tiny/tmp
mkdir $HOME/.local/share/tiny/tmp
cd $HOME/.local/share/tiny/tmp
MIRROR_SITE=https://mirror.ghproxy.com
RELEASE_PAGE=https://github.com/doitsujin/dxvk/releases
LATEST_DXVK_TAG=$(curl -L $RELEASE_PAGE | grep -oP 'Version \K[^"]*</h2>' | cut -d "<" -f 1 | head -n 1)
if [ -z "$LATEST_DXVK_TAG" ]
then
LATEST_DXVK_TAG="2.3"
fi
LATEST_DXVK_NAME="dxvk-$LATEST_DXVK_TAG.tar.gz"
LATEST_DXVK_LINK="https://github.com/doitsujin/dxvk/releases/download/v$LATEST_DXVK_TAG/$LATEST_DXVK_NAME"
wget $MIRROR_SITE/$LATEST_DXVK_LINK
if [ $? -ne 0 ]; then
wget $LATEST_DXVK_LINK
if [ $? -ne 0 ]; then
rm -rf $HOME/.local/share/tiny/tmp
echo '下载失败...退出安装...'
exit
fi
fi
wineboot
tar xvf $LATEST_DXVK_NAME
mv dxvk-$LATEST_DXVK_TAG/x32/* ~/.wine/drive_c/windows/syswow64
mv dxvk-$LATEST_DXVK_TAG/x64/* ~/.wine/drive_c/windows/system32
cd ~
rm -rf $HOME/.local/share/tiny/tmp
echo '安装完成建议前往wine配置更新配置。'

70
extra/cross/install-wine Normal file
View File

@@ -0,0 +1,70 @@
#!/bin/bash
sudo apt update
sudo apt upgrade -y
# Wine的64位依赖。box64会将amd64调用转换为arm64所以只需安装arm64库即可
# 依赖来自 dpkg-deb -I wine-stable-amd64_8.0.2~bookworm-1_amd64.deb
sudo apt install -y libasound2:arm64 libc6:arm64 libglib2.0-0:arm64 libgphoto2-6:arm64 libgphoto2-port12:arm64 \
libgstreamer-plugins-base1.0-0:arm64 libgstreamer1.0-0:arm64 libpcap0.8:arm64 libpulse0:arm64 libsane1:arm64 \
libudev1:arm64 libunwind8:arm64 libusb-1.0-0:arm64 libx11-6:arm64 libxext6:arm64 ocl-icd-libopencl1:arm64 \
libasound2-plugins:arm64 libncurses6:arm64 libcapi20-3:arm64 libcups2:arm64 libdbus-1-3:arm64 libfontconfig1:arm64 \
libfreetype6:arm64 libglu1-mesa:arm64 libgnutls30:arm64 libgsm1:arm64 libgssapi-krb5-2:arm64 libjpeg62-turbo:arm64 \
libkrb5-3:arm64 libodbc1:arm64 libosmesa6:arm64 libpng16-16:arm64 libsdl2-2.0-0:arm64 libv4l-0:arm64 \
libxcomposite1:arm64 libxcursor1:arm64 libxfixes3:arm64 libxi6:arm64 libxinerama1:arm64 libxrandr2:arm64 \
libxrender1:arm64 libxslt1.1:arm64 libxxf86vm1:arm64
# Wine的32位依赖。同理安装armhf而不是i386
# 依赖来自 dpkg-deb -I wine-stable-i386_8.0.2~bookworm-1_i386.deb
sudo apt install -y libasound2:armhf libc6:armhf libglib2.0-0:armhf libgphoto2-6:armhf libgphoto2-port12:armhf \
libgstreamer-plugins-base1.0-0:armhf libgstreamer1.0-0:armhf libpcap0.8:armhf libpulse0:armhf libsane1:armhf \
libudev1:armhf libusb-1.0-0:armhf libx11-6:armhf libxext6:armhf ocl-icd-libopencl1:armhf libasound2-plugins:armhf \
libncurses6:armhf libcapi20-3:armhf libcups2:armhf libdbus-1-3:armhf libfontconfig1:armhf libfreetype6:armhf \
libglu1-mesa:armhf libgnutls30:armhf libgsm1:armhf libgssapi-krb5-2:armhf libjpeg62-turbo:armhf libkrb5-3:armhf \
libodbc1:armhf libosmesa6:armhf libpng16-16:armhf libsdl2-2.0-0:armhf libv4l-0:armhf libxcomposite1:armhf \
libxcursor1:armhf libxfixes3:armhf libxi6:armhf libxinerama1:armhf libxrandr2:armhf libxrender1:armhf libxslt1.1:armhf \
libxxf86vm1:armhf
# 其他测试时认为可能需要的依赖
sudo apt install -y libvulkan1 libvulkan1:armhf
rm -rf $HOME/.local/share/tiny/tmp
mkdir $HOME/.local/share/tiny/tmp
cd $HOME/.local/share/tiny/tmp
MIRROR_SITE=https://mirror.ghproxy.com
RELEASE_PAGE=https://github.com/Kron4ek/Wine-Builds/releases
LATEST_WINE_TAG=proton-$(curl -L $RELEASE_PAGE | grep -oP 'Proton \K[^"]*</h2>' | cut -d "<" -f 1 | head -n 1) #proton
#LATEST_WINE_TAG=$(curl -L $RELEASE_PAGE | grep -oP 'Wine \K[^"]*</h2>' | cut -d "<" -f 1 | head -n 1) #vanilla
if [ -z "$LATEST_WINE_TAG" ] || [ "$LATEST_WINE_TAG" == "proton-" ]
then
LATEST_WINE_TAG=proton-8.0-4
fi
LATEST_WINE_NAME=wine-$LATEST_WINE_TAG-amd64.tar.xz
LATEST_WINE_LINK=$RELEASE_PAGE/download/$LATEST_WINE_TAG/$LATEST_WINE_NAME
wget $MIRROR_SITE/$LATEST_WINE_LINK
if [ $? -ne 0 ]; then
wget $LATEST_WINE_LINK
if [ $? -ne 0 ]; then
rm -rf $HOME/.local/share/tiny/tmp
echo '下载失败...退出安装...'
exit
fi
fi
tar xvf $LATEST_WINE_NAME
mv wine-$LATEST_WINE_TAG-amd64 ../cross/wine
cd ..
rm -rf tmp
echo '[Desktop Entry]
Name=Wine 启动器
Exec=wine64 start /unix %f
Icon=wine
Type=Application' > $HOME/.local/share/tiny/cross/wine.desktop
chmod +x $HOME/.local/share/tiny/cross/wine.desktop
echo '安装完成在启用wine后可以点击exe文件选择用wine启动。'
echo '初次运行时会自动进行一段时间的初始化工作。'
echo '程序的运行可能依赖一些配置或组件。比如一些使用directx的游戏可能需要安装dxvk。'

83
extra/cross/install-wine2 Normal file
View File

@@ -0,0 +1,83 @@
#!/bin/bash
sudo apt update
sudo apt upgrade -y
# Wine的64位依赖。box64会将amd64调用转换为arm64所以只需安装arm64库即可
# 依赖来自 dpkg-deb -I wine-stable-amd64_8.0.2~bookworm-1_amd64.deb
sudo apt install -y libasound2:arm64 libc6:arm64 libglib2.0-0:arm64 libgphoto2-6:arm64 libgphoto2-port12:arm64 \
libgstreamer-plugins-base1.0-0:arm64 libgstreamer1.0-0:arm64 libpcap0.8:arm64 libpulse0:arm64 libsane1:arm64 \
libudev1:arm64 libunwind8:arm64 libusb-1.0-0:arm64 libx11-6:arm64 libxext6:arm64 ocl-icd-libopencl1:arm64 \
libasound2-plugins:arm64 libncurses6:arm64 libcapi20-3:arm64 libcups2:arm64 libdbus-1-3:arm64 libfontconfig1:arm64 \
libfreetype6:arm64 libglu1-mesa:arm64 libgnutls30:arm64 libgsm1:arm64 libgssapi-krb5-2:arm64 libjpeg62-turbo:arm64 \
libkrb5-3:arm64 libodbc1:arm64 libosmesa6:arm64 libpng16-16:arm64 libsdl2-2.0-0:arm64 libv4l-0:arm64 \
libxcomposite1:arm64 libxcursor1:arm64 libxfixes3:arm64 libxi6:arm64 libxinerama1:arm64 libxrandr2:arm64 \
libxrender1:arm64 libxslt1.1:arm64 libxxf86vm1:arm64
# Wine的32位依赖。同理安装armhf而不是i386
# 依赖来自 dpkg-deb -I wine-stable-i386_8.0.2~bookworm-1_i386.deb
sudo apt install -y libasound2:armhf libc6:armhf libglib2.0-0:armhf libgphoto2-6:armhf libgphoto2-port12:armhf \
libgstreamer-plugins-base1.0-0:armhf libgstreamer1.0-0:armhf libpcap0.8:armhf libpulse0:armhf libsane1:armhf \
libudev1:armhf libusb-1.0-0:armhf libx11-6:armhf libxext6:armhf ocl-icd-libopencl1:armhf libasound2-plugins:armhf \
libncurses6:armhf libcapi20-3:armhf libcups2:armhf libdbus-1-3:armhf libfontconfig1:armhf libfreetype6:armhf \
libglu1-mesa:armhf libgnutls30:armhf libgsm1:armhf libgssapi-krb5-2:armhf libjpeg62-turbo:armhf libkrb5-3:armhf \
libodbc1:armhf libosmesa6:armhf libpng16-16:armhf libsdl2-2.0-0:armhf libv4l-0:armhf libxcomposite1:armhf \
libxcursor1:armhf libxfixes3:armhf libxi6:armhf libxinerama1:armhf libxrandr2:armhf libxrender1:armhf libxslt1.1:armhf \
libxxf86vm1:armhf
rm -rf $HOME/.local/share/tiny/tmp
mkdir $HOME/.local/share/tiny/tmp
cd $HOME/.local/share/tiny/tmp
LNKA="https://mirrors.tuna.tsinghua.edu.cn/wine-builds/debian/dists/bookworm/main/binary-amd64/"
DEB_A1="wine-stable-amd64_8.0.2~bookworm-1_amd64.deb"
DEB_A2="wine-stable_8.0.2~bookworm-1_amd64.deb"
LNKB="https://mirrors.tuna.tsinghua.edu.cn/wine-builds/debian/dists/bookworm/main/binary-i386/"
DEB_B1="wine-stable-i386_8.0.2~bookworm-1_i386.deb"
# Install amd64-wine (64-bit) alongside i386-wine (32-bit)
echo -e "下载wine..."
wget ${LNKA}${DEB_A1}
wget ${LNKA}${DEB_A2}
wget ${LNKB}${DEB_B1}
wget https://mirror.ghproxy.com/https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks
if [ $? -ne 0 ]; then
wget https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks
if [ $? -ne 0 ]; then
rm -rf $HOME/.local/share/tiny/tmp
echo '下载失败...退出安装...'
exit
fi
fi
echo -e "解压wine..."
dpkg-deb -x ${DEB_A1} wine-installer
dpkg-deb -x ${DEB_A2} wine-installer
dpkg-deb -x ${DEB_B1} wine-installer
echo -e "安装wine..."
mv wine-installer/opt/wine* ../cross/wine
mv winetricks ../cross
chmod +x $HOME/.local/share/tiny/cross/winetricks
cd ..
rm -rf tmp
echo '[Desktop Entry]
Name=Wine 启动器
Exec=wine start /unix %f
Icon=wine
Type=Application' > $HOME/.local/share/tiny/cross/wine.desktop
chmod +x $HOME/.local/share/tiny/cross/wine.desktop
echo '[Desktop Entry]
Name=winetricks 实用工具
Exec=winetricks
Icon=wine
Type=Application' > $HOME/.local/share/tiny/cross/winetricks.desktop
chmod +x $HOME/.local/share/tiny/cross/winetricks.desktop
echo '安装完成在启用wine后可以点击exe文件选择用wine启动。'
echo '程序的运行可能依赖一些配置或组件。比如一些使用directx的游戏可能需要安装dxvk。'
echo '如果缺失可以尝试使用winetricks安装。请务必保持耐心。'

View File

@@ -0,0 +1,243 @@
// getifaddrs_bridge_client_lib.c -- This file is part of tiny_computer.
// Copyright (C) 2023 Caten Hu
// Tiny Computer is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published
// by the Free Software Foundation, either version 3 of the License,
// or any later version.
// Tiny Computer is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program. If not, see http://www.gnu.org/licenses/.
/* this file is mainly generated by Bing */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <ifaddrs.h>
#include <sys/ioctl.h>
#include <net/if.h>
#include <sys/un.h>
#define BUFSIZE 1024 // 定义缓冲区大小
// 定义一个反序列化函数将字节数组转换为ifaddrs结构体
int TINY_deserialize_ifaddrs(char *buf, int size, struct ifaddrs **ifap) {
int len = 0; // 记录已经读取的字节数
struct ifaddrs *head = NULL; // 链表头指针
struct ifaddrs *tail = NULL; // 链表尾指针
while (len < size) {
// 为当前接口分配内存
struct ifaddrs *ifa = (struct ifaddrs *)malloc(sizeof(struct ifaddrs));
if (ifa == NULL) {
// 分配失败,释放已分配的内存
freeifaddrs(head);
return -1; // 返回错误
}
// 读取接口名称
int namelen = strlen(buf + len) + 1; // 包括结束符
if (len + namelen > size) break; // 缓冲区不足
ifa->ifa_name = (char *)malloc(namelen); // 为名称分配内存
if (ifa->ifa_name == NULL) {
// 分配失败,释放已分配的内存
free(ifa);
freeifaddrs(head);
return -1; // 返回错误
}
memcpy(ifa->ifa_name, buf + len, namelen); // 复制名称
len += namelen;
// 读取接口标志
if (len + sizeof(unsigned int) > size) break; // 缓冲区不足
memcpy(&ifa->ifa_flags, buf + len, sizeof(unsigned int)); // 复制标志
len += sizeof(unsigned int);
// 读取接口地址
if (buf[len] != '\0') {
// 如果有地址
int addrlen = sizeof(struct sockaddr); // 地址结构体长度
if (len + addrlen > size) break; // 缓冲区不足
ifa->ifa_addr = (struct sockaddr *)malloc(addrlen); // 为地址分配内存
if (ifa->ifa_addr == NULL) {
// 分配失败,释放已分配的内存
free(ifa->ifa_name);
free(ifa);
freeifaddrs(head);
return -1; // 返回错误
}
memcpy(ifa->ifa_addr, buf + len, addrlen); // 复制地址
len += addrlen;
} else {
// 如果没有地址,跳过一个空字节
ifa->ifa_addr = NULL;
len += 1;
}
// 读取接口掩码
if (buf[len] != '\0') {
// 如果有掩码
int masklen = sizeof(struct sockaddr); // 掩码结构体长度
if (len + masklen > size) break; // 缓冲区不足
ifa->ifa_netmask = (struct sockaddr *)malloc(masklen); // 为掩码分配内存
if (ifa->ifa_netmask == NULL) {
// 分配失败,释放已分配的内存
free(ifa->ifa_addr);
free(ifa->ifa_name);
free(ifa);
freeifaddrs(head);
return -1; // 返回错误
}
memcpy(ifa->ifa_netmask, buf + len, masklen); // 复制
len += masklen;
} else {
// 如果没有掩码,跳过一个空字节
ifa->ifa_netmask = NULL;
len += 1;
}
// 读取接口广播地址或点对点地址
if (ifa->ifa_flags & IFF_BROADCAST) {
// 如果有广播地址
if (buf[len] != '\0') {
// 如果有广播地址
int broadlen = sizeof(struct sockaddr); // 广播地址结构体长度
if (len + broadlen > size) break; // 缓冲区不足
ifa->ifa_broadaddr = (struct sockaddr *)malloc(broadlen); // 为广播地址分配内存
if (ifa->ifa_broadaddr == NULL) {
// 分配失败,释放已分配的内存
free(ifa->ifa_netmask);
free(ifa->ifa_addr);
free(ifa->ifa_name);
free(ifa);
freeifaddrs(head);
return -1; // 返回错误
}
memcpy(ifa->ifa_broadaddr, buf + len, broadlen); // 复制广播地址
len += broadlen;
} else {
// 如果没有广播地址,跳过一个空字节
ifa->ifa_broadaddr = NULL;
len += 1;
}
} else if (ifa->ifa_flags & IFF_POINTOPOINT) {
// 如果有点对点地址
if (buf[len] != '\0') {
// 如果有点对点地址
int dstlen = sizeof(struct sockaddr); // 点对点地址结构体长度
if (len + dstlen > size) break; // 缓冲区不足
ifa->ifa_dstaddr = (struct sockaddr *)malloc(dstlen); // 为点对点地址分配内存
if (ifa->ifa_dstaddr == NULL) {
// 分配失败,释放已分配的内存
free(ifa->ifa_netmask);
free(ifa->ifa_addr);
free(ifa->ifa_name);
free(ifa);
freeifaddrs(head);
return -1; // 返回错误
}
memcpy(ifa->ifa_dstaddr, buf + len, dstlen); // 复制点对点地址
len += dstlen;
} else {
// 如果没有点对点地址,跳过一个空字节
ifa->ifa_dstaddr = NULL;
len += 1;
}
} else {
// 如果没有广播地址或点对点地址,跳过两个空字节
ifa->ifa_broadaddr = NULL;
ifa->ifa_dstaddr = NULL;
len += 2;
}
// 读取接口数据
if (buf[len] != '\0') {
// 如果有数据
// TODO: 根据不同的地址族,读取不同的数据
// 这里暂时省略,只跳过一个空字节
ifa->ifa_data = NULL;
len += 1;
} else {
// 如果没有数据,跳过一个空字节
ifa->ifa_data = NULL;
len += 1;
}
// 将当前接口插入链表
ifa->ifa_next = NULL;
if (head == NULL) {
// 如果是第一个接口,设置头指针
head = ifa;
} else {
// 如果不是第一个接口,设置尾指针的下一个指针
tail->ifa_next = ifa;
}
// 更新尾指针
tail = ifa;
}
*ifap = head; // 返回链表头指针
return len; // 返回读取的总字节数
}
// 定义一个发送信号的函数,向服务器发送一个信号
int TINY_send_signal(int sockfd) {
char sig = 'S'; // 定义信号为一个字符S
int n = write(sockfd, &sig, 1); // 向套接字写入一个字节
if (n < 0) {
perror("write");
return -1; // 返回错误
}
return 0; // 返回成功
}
// 定义一个接收数据的函数,从服务器接收数据并反序列化
int TINY_receive_data(int sockfd, struct ifaddrs **ifap) {
char buf[BUFSIZE]; // 定义缓冲区
int n = read(sockfd, buf, BUFSIZE); // 从套接字读取数据
if (n < 0) {
perror("read");
return -1; // 返回错误
}
int len = TINY_deserialize_ifaddrs(buf, n, ifap); // 反序列化数据
if (len < 0) {
fprintf(stderr, "deserialize_ifaddrs failed\n");
return -1; // 返回错误
}
return 0; // 返回成功
}
// 主函数
int getifaddrs(struct ifaddrs **ifap) {
// 创建一个套接字
int sockfd = socket(PF_UNIX, SOCK_STREAM, 0);
if (sockfd < 0) {
perror("socket");
exit(1);
}
// 定义服务器地址结构体
struct sockaddr_un un;
memset(&un, 0, sizeof(un));
un.sun_family = AF_UNIX;
snprintf(un.sun_path, sizeof(un.sun_path), "%s", "/tmp/.getifaddrs-bridge");
// 连接到服务器
if (connect(sockfd, (struct sockaddr *)&un, sizeof(un)) < 0) {
perror("connect");
exit(1);
}
// 发送信号给服务器
if (TINY_send_signal(sockfd) < 0) {
fprintf(stderr, "send_signal failed\n");
exit(1);
}
// 接收数据并反序列化
if (TINY_receive_data(sockfd, ifap) < 0) {
fprintf(stderr, "receive_data failed\n");
exit(1);
}
// 关闭套接字
close(sockfd);
return 0;
}

View File

@@ -0,0 +1,222 @@
// getifaddrs_bridge_server.c -- This file is part of tiny_computer.
// Copyright (C) 2023 Caten Hu
// Tiny Computer is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published
// by the Free Software Foundation, either version 3 of the License,
// or any later version.
// Tiny Computer is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program. If not, see http://www.gnu.org/licenses/.
/* this file is mainly generated by Bing */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <ifaddrs.h>
#include <sys/ioctl.h>
#include <net/if.h>
#include <sys/un.h>
#define BUFSIZE 1024 // 定义缓冲区大小
// 定义一个序列化函数将ifaddrs结构体转换为字节数组
int serialize_ifaddrs(struct ifaddrs *ifa, char *buf, int size) {
int len = 0; // 记录已经写入的字节数
while (ifa != NULL && len < size) {
// 写入接口名称
int namelen = strlen(ifa->ifa_name) + 1; // 包括结束符
if (len + namelen > size) break; // 缓冲区不足
memcpy(buf + len, ifa->ifa_name, namelen);
len += namelen;
// 写入接口标志
if (len + sizeof(unsigned int) > size) break; // 缓冲区不足
memcpy(buf + len, &ifa->ifa_flags, sizeof(unsigned int));
len += sizeof(unsigned int);
// 写入接口地址
if (ifa->ifa_addr != NULL) {
int addrlen = sizeof(struct sockaddr); // 地址结构体长度
if (len + addrlen > size) break; // 缓冲区不足
memcpy(buf + len, ifa->ifa_addr, addrlen);
len += addrlen;
} else {
// 如果没有地址,写入一个空字节
if (len + 1 > size) break; // 缓冲区不足
buf[len] = '\0';
len += 1;
}
// 写入接口掩码
if (ifa->ifa_netmask != NULL) {
int masklen = sizeof(struct sockaddr); // 掩码结构体长度
if (len + masklen > size) break; // 缓冲区不足
memcpy(buf + len, ifa->ifa_netmask, masklen);
len += masklen;
} else {
// 如果没有掩码,写入一个空字节
if (len + 1 > size) break; // 缓冲区不足
buf[len] = '\0';
len += 1;
}
// 写入接口广播地址或点对点地址
if (ifa->ifa_flags & IFF_BROADCAST) {
// 如果有广播地址
if (ifa->ifa_broadaddr != NULL) {
int broadlen = sizeof(struct sockaddr); // 广播地址结构体长度
if (len + broadlen > size) break; // 缓冲区不足
memcpy(buf + len, ifa->ifa_broadaddr, broadlen);
len += broadlen;
} else {
// 如果没有广播地址,写入一个空字节
if (len + 1 > size) break; // 缓冲区不足
buf[len] = '\0';
len += 1;
}
} else if (ifa->ifa_flags & IFF_POINTOPOINT) {
// 如果有点对点地址
if (ifa->ifa_dstaddr != NULL) {
int dstlen = sizeof(struct sockaddr); // 点对点地址结构体长度
if (len + dstlen > size) break; // 缓冲区不足
memcpy(buf + len, ifa->ifa_dstaddr, dstlen);
len += dstlen;
} else {
// 如果没有点对点地址,写入一个空字节
if (len + 1 > size) break; // 缓冲区不足
buf[len] = '\0';
len += 1;
}
} else {
// 如果没有广播地址或点对点地址,写入两个空字节
if (len + 2 > size) break; // 缓冲区不足
buf[len] = '\0';
buf[len + 1] = '\0';
len += 2;
}
// 写入接口数据
if (ifa->ifa_data != NULL) {
// TODO: 根据不同的地址族,写入不同的数据
// 这里暂时省略,只写入一个空字节
if (len + 1 > size) break; // 缓冲区不足
buf[len] = '\0';
len += 1;
} else {
// 如果没有数据,写入一个空字节
if (len + 1 > size) break; // 缓冲区不足
buf[len] = '\0';
len += 1;
}
// 跳到下一个接口
ifa = ifa->ifa_next;
}
return len; // 返回写入的总字节数
}
// 定义一个接收信号的函数,从客户端接收一个信号
int receive_signal(int sockfd) {
char sig; // 定义信号变量
int n = read(sockfd, &sig, 1); // 从套接字读取一个字节
if (n < 0) {
perror("read");
return -1; // 返回错误
}
if (sig == 'S') {
// 如果收到信号S表示客户端需要数据
return 0; // 返回成功
} else {
// 如果收到其他信号,表示无效信号
fprintf(stderr, "invalid signal: %c\n", sig);
return -1; // 返回错误
}
}
// 定义一个发送数据的函数,向客户端发送数据并序列化
int send_data(int sockfd) {
struct ifaddrs *ifap = NULL; // 定义ifaddrs结构体指针
// 调用getifaddrs函数获取本地接口信息
if (getifaddrs(&ifap) < 0) {
perror("getifaddrs");
return -1; // 返回错误
}
char buf[BUFSIZE]; // 定义缓冲区
// 调用序列化函数将ifaddrs结构体转换为字节数组
int len = serialize_ifaddrs(ifap, buf, BUFSIZE);
if (len < 0) {
fprintf(stderr, "serialize_ifaddrs failed\n");
return -1; // 返回错误
}
// 向套接字写入数据
int n = write(sockfd, buf, len);
if (n < 0) {
perror("write");
return -1; // 返回错误
}
// 释放ifaddrs结构体
freeifaddrs(ifap);
return 0; // 返回成功
}
// 主函数
int main(int argc, char *argv[]) {
if (argc != 2) {
printf("usage: %s <socket_path>\n", argv[0]);
return 0;
}
// 创建一个套接字
int sockfd = socket(PF_UNIX, SOCK_STREAM, 0);
if (sockfd < 0) {
perror("socket");
exit(1);
}
// 定义服务器地址结构体
struct sockaddr_un un;
memset(&un, 0, sizeof(un));
un.sun_family = AF_UNIX;
snprintf(un.sun_path, sizeof(un.sun_path), "%s", argv[1]);
unlink(un.sun_path);
// 绑定套接字到服务器地址
if (bind(sockfd, (struct sockaddr *)&un, sizeof(un)) < 0) {
perror("bind");
exit(1);
}
// 监听套接字
if (listen(sockfd, 5) < 0) {
perror("listen");
exit(1);
}
// 循环接受客户端连接
while (1) {
int connfd = accept(sockfd, NULL, NULL);
if (connfd < 0) {
perror("accept");
continue; // 如果接受失败,继续循环
}
// 循环接收和发送数据
while (1) {
// 接收信号
if (receive_signal(connfd) < 0) {
fprintf(stderr, "receive_signal failed\n");
close(connfd); // 如果接收失败,关闭连接套接字
break; // 跳出循环
}
// 发送数据
if (send_data(connfd) < 0) {
fprintf(stderr, "send_data failed\n");
close(connfd); // 如果发送失败,关闭连接套接字
break; // 跳出循环
}
}
}
// 关闭监听套接字
close(sockfd);
return 0;
}

View File

@@ -0,0 +1,19 @@
### 编译
使用NDK编译getifaddrs_bridge_server.c:
`aarch64-linux-android-clang getifaddrs_bridge_server.c -o getifaddrs_bridge_server`
在小小电脑上编译getifaddrs_bridge_client_lib.c:
`gcc getifaddrs_bridge_client_lib.c -o getifaddrs_bridge_client_lib.so -shared`
### 使用
在安卓端:
`getifaddrs_bridge_server /path/to/container/tmp/.getifaddrs-bridge`
在proot容器
`LD_PRELOAD=/path/to/getifaddrs_bridge_client_lib.so <your_program>`

43
extra/readme.md Normal file
View File

@@ -0,0 +1,43 @@
## 这个readme介绍assets文件夹中文件的制作方式。
### assets.zip中的文件
- [busybox](https://github.com/meefik/busybox)
- [mediamtx相关](https://github.com/bluenviron/mediamtx)
- [tar](https://github.com/Rprop/tar-android-static)
- [Xserver XSDL, pulseaudio相关文件](https://github.com/pelya/commandergenius/tree/sdl_android/project/jni/application/xserver)
- [virgl](https://github.com/termux/termux-packages/tree/master/x11-packages/virglrenderer-android)
以上文件没有经过更改。
一般是使用了仓库直接提供的二进制文件或者是使用了仓库提供的patch编译而来。
- [proot](https://github.com/Cateners/proot), 使用[build-proot-android](https://github.com/green-green-avk/build-proot-android)脚本编译
- [Tmoe Linux, debian包来源](https://github.com/2moe/tmoe),制作了[容器文件xa*](build-tiny-rootfs.md)
- getifaddrs_bridge_server见下面的介绍和getifaddrs_bridge子文件夹
### patch.tar.gz中的文件
#### extra/getifaddrs_bridge_client_lib.so:
在安卓13以上的系统中proot容器无权使用默认的getifaddrs而这个库包含了一个getifaddrs实现。
linux在需要数据时使用socket通知位于安卓的getifaddrs_bridge_server让getifaddrs_bridge_server执行getifaddrs函数并将结构体数据序列化后发送回linux端这边接收数据并反序列化还原成指针结构体。简单来说就是用安卓的getifaddrs代替linux的getifaddrs。
源码和编译信息在getifaddrs_bridge文件夹查看。
#### extra/install-box, extra/install-wine:
这些是用于跨架构/跨系统支持的box86/box64和wine安装脚本。
#### caj, edraw
这些分别是cajviewer亿图图示的补丁
- 亿图图示补丁的库文件是在小小电脑上下载了Qt对应版本源码后编译得到的
- 编译进行了两次第一次直接编译可以得到Gui和Widgets两个库。第二次编译带上XcbQpa虽然会编译失败但在这之前就可以得到XcbQpa的库。
#### wechat
微信的补丁。license, uos-lsb和uos-release来自星火的微信包或arch的wechat-uos打包我忘记到底是哪的了。不过都差不多
libssl1.1来自debian官方源。deepin-elf-verifier是我打的空包。

Binary file not shown.

Before

Width:  |  Height:  |  Size: 168 KiB

After

Width:  |  Height:  |  Size: 163 KiB

File diff suppressed because it is too large Load Diff

View File

@@ -43,6 +43,8 @@ import 'package:unity_ads_plugin/unity_ads_plugin.dart';
import 'package:clipboard/clipboard.dart';
import 'package:wakelock_plus/wakelock_plus.dart';
class Util {
static Future<void> copyAsset(String src, String dst) async {
@@ -56,28 +58,92 @@ class Util {
Directory.fromRawPath(const Utf8Encoder().convert(dir)).createSync(recursive: true);
}
static Future<void> execute(String str) async {
static Future<int> execute(String str) async {
Pty pty = Pty.start(
"/system/bin/sh"
);
pty.write(const Utf8Encoder().convert("$str\nexit\n"));
await pty.exitCode;
pty.write(const Utf8Encoder().convert("$str\nexit \$?\n"));
return await pty.exitCode;
}
static void termWrite(String str) {
G.termPtys[G.currentContainer]!.pty.write(const Utf8Encoder().convert("$str\n"));
}
//所有key
//int defaultContainer = 0: 默认启动第0个容器
//int defaultAudioPort = 4718: 默认pulseaudio端口(为了避免和其它软件冲突改成4718了原默认4713)
//bool autoLaunchVnc = true: 是否自动启动VNC并跳转
//String lastDate: 上次启动软件的日期yyyy-MM-dd
//int adsWatchedToday: 今日视频广告观看数量
//int adsWatchedTotal: 视频广告观看数量
//bool isBannerAdsClosed = false
//bool isTerminalWriteEnabled = false
//bool isTerminalCommandsEnabled = false
//int termMaxLines = 4095 终端最大行数
//double termFontScale = 1 终端字体大小
//int vip = 0 用户等级vip免广告你要改吗(ToT)
//bool isStickyKey = true 终端ctrl, shift, alt键是否粘滞
//String defaultFFmpegCommand 默认推流命令
//String defaultVirglCommand 默认virgl参数
//String defaultVirglOpt 默认virgl环境变量
//bool reinstallBootstrap = false 下次启动是否重装引导包
//bool getifaddrsBridge = false 下次启动是否桥接getifaddrsBridge
//bool uos = false 下次启动是否伪装UOS
//bool isBoxEnabled = false 下次启动是否开启box86/box64
//bool isWineEnabled = false 下次启动是否开启wine
//bool virgl = false 下次启动是否启用virgl
//bool wakelock = false 屏幕常亮
//? int bootstrapVersion: 启动包版本
//String[] containersInfo: 所有容器信息(json)
//{name, boot:"\$DATA_DIR/bin/proot ...", vnc:"startnovnc", vncUrl:"...", commands:[{name:"更新和升级", command:"apt update -y && apt upgrade -y"},
// bind:[{name:"U盘", src:"/storage/xxxx", dst:"/media/meow"}]...]}
//String[] adsBonus: 观看广告获取的奖励(json)
//{name: "xxx", amount: xxx}
//TODO: 这么写还是不对劲,有空改成类试试?
static dynamic getGlobal(String key) {
bool b = G.prefs.containsKey(key);
switch (key) {
case "defaultContainer" : return b ? G.prefs.getInt(key)! : (value){G.prefs.setInt(key, value); return value;}(0);
case "defaultAudioPort" : return b ? G.prefs.getInt(key)! : (value){G.prefs.setInt(key, value); return value;}(4718);
case "autoLaunchVnc" : return b ? G.prefs.getBool(key)! : (value){G.prefs.setBool(key, value); return value;}(true);
case "lastDate" : return b ? G.prefs.getString(key)! : (value){G.prefs.setString(key, value); return value;}("1970-01-01");
case "adsWatchedToday" : return b ? G.prefs.getInt(key)! : (value){G.prefs.setInt(key, value); return value;}(0);
case "adsWatchedTotal" : return b ? G.prefs.getInt(key)! : (value){G.prefs.setInt(key, value); return value;}(0);
case "isBannerAdsClosed" : return b ? G.prefs.getBool(key)! : (value){G.prefs.setBool(key, value); return value;}(false);
case "isTerminalWriteEnabled" : return b ? G.prefs.getBool(key)! : (value){G.prefs.setBool(key, value); return value;}(false);
case "isTerminalCommandsEnabled" : return b ? G.prefs.getBool(key)! : (value){G.prefs.setBool(key, value); return value;}(false);
case "termMaxLines" : return b ? G.prefs.getInt(key)! : (value){G.prefs.setInt(key, value); return value;}(4095);
case "termFontScale" : return b ? G.prefs.getDouble(key)! : (value){G.prefs.setDouble(key, value); return value;}(1.0);
case "vip" : return b ? G.prefs.getInt(key)! : (value){G.prefs.setInt(key, value); return value;}(0);
case "isStickyKey" : return b ? G.prefs.getBool(key)! : (value){G.prefs.setBool(key, value); return value;}(true);
case "reinstallBootstrap" : return b ? G.prefs.getBool(key)! : (value){G.prefs.setBool(key, value); return value;}(false);
case "getifaddrsBridge" : return b ? G.prefs.getBool(key)! : (value){G.prefs.setBool(key, value); return value;}(false);
case "uos" : return b ? G.prefs.getBool(key)! : (value){G.prefs.setBool(key, value); return value;}(false);
case "isBoxEnabled" : return b ? G.prefs.getBool(key)! : (value){G.prefs.setBool(key, value); return value;}(false);
case "isWineEnabled" : return b ? G.prefs.getBool(key)! : (value){G.prefs.setBool(key, value); return value;}(false);
case "virgl" : return b ? G.prefs.getBool(key)! : (value){G.prefs.setBool(key, value); return value;}(false);
case "wakelock" : return b ? G.prefs.getBool(key)! : (value){G.prefs.setBool(key, value); return value;}(false);
case "defaultFFmpegCommand" : return b ? G.prefs.getString(key)! : (value){G.prefs.setString(key, value); return value;}("-hide_banner -an -max_delay 1000000 -r 30 -f android_camera -camera_index 0 -i 0:0 -vf scale=iw/2:-1 -rtsp_transport udp -f rtsp rtsp://127.0.0.1:8554/stream");
case "defaultVirglCommand" : return b ? G.prefs.getString(key)! : (value){G.prefs.setString(key, value); return value;}("--socket-path=\$CONTAINER_DIR/tmp/.virgl_test");
case "defaultVirglOpt" : return b ? G.prefs.getString(key)! : (value){G.prefs.setString(key, value); return value;}("GALLIUM_DRIVER=virpipe MESA_GL_VERSION_OVERRIDE=4.0");
case "containersInfo" : return G.prefs.getStringList(key)!;
case "adsBonus" : return b ? G.prefs.getStringList(key)! : (value){G.prefs.setStringList(key, value); return value;}([].cast<String>());
}
}
static dynamic getCurrentProp(String key) {
return jsonDecode(G.prefs.getStringList("containersInfo")![G.currentContainer])[key];
return jsonDecode(Util.getGlobal("containersInfo")[G.currentContainer])[key];
}
//用来设置name, boot, vnc, vncUrl等
static Future<void> setCurrentProp(String key, dynamic value) async {
await G.prefs.setStringList("containersInfo",
G.prefs.getStringList("containersInfo")!..setAll(G.currentContainer,
Util.getGlobal("containersInfo")..setAll(G.currentContainer,
[jsonEncode((jsonDecode(
G.prefs.getStringList("containersInfo")![G.currentContainer]
Util.getGlobal("containersInfo")[G.currentContainer]
))..update(key, (v) => value))]
)
);
@@ -86,37 +152,60 @@ class Util {
//返回单个G.bonusTable定义的item
static Map<String, dynamic> getRandomBonus() {
final random = Random();
final totalWeight = G.bonusTable.fold(0.0, (sum, item) => sum + item['weight']);
final totalWeight = D.bonusTable.fold(0.0, (sum, item) => sum + item['weight']);
final randomIndex = random.nextDouble() * totalWeight;
var cumulativeWeight = 0.0;
for (final item in G.bonusTable) {
for (final item in D.bonusTable) {
cumulativeWeight += item['weight'];
if (randomIndex <= cumulativeWeight) {
return item;
}
}
return G.bonusTable[0];
return D.bonusTable[0];
}
//由getRandomBonus返回的数据
static Future<void> applyBonus(Map<String, dynamic> bonus) async {
bool flag = false;
List<String> ret = G.prefs.getStringList("adsBonus")!.map((e) {
List<String> ret = Util.getGlobal("adsBonus").map((e) {
Map<String, dynamic> item = jsonDecode(e);
return (item["name"] == bonus["name"])?
jsonEncode(item..update("amount", (v) {
flag = true;
return v + bonus["amount"];
})):e;
}).toList();
}).toList().cast<String>();
if (!flag) {
ret.add("""{"name": "${bonus["name"]}", "amount": ${bonus["amount"]}}""");
}
await G.prefs.setStringList("adsBonus", ret);
}
//根据已看广告量判断是否应该继续看广告
static bool shouldWatchAds(int expectNum) {
return ((Util.getGlobal("adsWatchedTotal") as int) < expectNum) && ((Util.getGlobal("vip") as int) < 1) && ((Util.getGlobal("adsWatchedToday") as int) < D.adsRequired["unlockToday"]!) && (G.adsWatchedThisTime < D.adsRequired["unlockOnce"]!);
}
//限定字符串在min和max之间, 给文本框的validator
static String? validateBetween(String? value, int min, int max, Function opr) {
if (value == null || value.isEmpty) {
return "请输入数字";
}
int? parsedValue = int.tryParse(value);
if (parsedValue == null) {
return "请输入有效的数字";
}
if (parsedValue < min || parsedValue > max) {
return "请输入$min到$max之间的数字";
}
opr();
return null;
}
}
//来自xterms关于操作ctrl, shift, alt键的示例
//这个类应该只能有一个实例G.keyboard
class VirtualKeyboard extends TerminalInputHandler with ChangeNotifier {
final TerminalInputHandler _inputHandler;
@@ -157,11 +246,18 @@ class VirtualKeyboard extends TerminalInputHandler with ChangeNotifier {
@override
String? call(TerminalKeyboardEvent event) {
return _inputHandler.call(event.copyWith(
final ret = _inputHandler.call(event.copyWith(
ctrl: event.ctrl || _ctrl,
shift: event.shift || _shift,
alt: event.alt || _alt,
));
G.maybeCtrlJ = event.key.name == "keyJ"; //这个是为了稍后区分按键到底是Enter还是Ctrl+J
if (!(Util.getGlobal("isStickyKey") as bool)) {
G.keyboard.ctrl = false;
G.keyboard.shift = false;
G.keyboard.alt = false;
}
return ret;
}
}
@@ -171,7 +267,7 @@ class TermPty {
late final Pty pty;
TermPty() {
terminal = Terminal(inputHandler: G.keyboard);
terminal = Terminal(inputHandler: G.keyboard, maxLines: Util.getGlobal("termMaxLines") as int);
pty = Pty.start(
"/system/bin/sh",
workingDirectory: G.dataPath,
@@ -192,12 +288,13 @@ class TermPty {
Navigator.push(G.homePageStateContext, MaterialPageRoute(builder: (context) {
const TextStyle ts = TextStyle(fontSize: 16, color: Colors.white, fontWeight: FontWeight.normal);
const String helperLink = "https://www.vmos.cn/zhushou.htm";
const String helperLink2 = "https://b23.tv/WwqOqW6";
return Scaffold(backgroundColor: Colors.deepPurple,
body: Center(
child: Scrollbar(child:
SingleChildScrollView(
child: Column(children: [
const Text(":(\n发生了什么?", textScaleFactor: 2, style: ts, textAlign: TextAlign.center,),
const Text(":(\n发生了什么?", textScaler: TextScaler.linear(2), style: ts, textAlign: TextAlign.center,),
const Text("终端异常退出, 返回错误码9\n此错误通常是高版本安卓系统(12+)限制进程造成的, \n可以使用以下工具修复:", style: ts, textAlign: TextAlign.center),
const SelectableText(helperLink, style: ts, textAlign: TextAlign.center),
const Text("(复制链接到浏览器查看)", style: ts, textAlign: TextAlign.center),
@@ -210,7 +307,18 @@ class TermPty {
},))
);
});
}, child: const Text("复制", style: ts, textAlign: TextAlign.center))
}, child: const Text("复制", style: ts, textAlign: TextAlign.center)),
const Text("如果不能解决请参考此教程: ", style: ts, textAlign: TextAlign.center),
OutlinedButton(onPressed: () {
FlutterClipboard.copy(helperLink2).then(( value ) {
ScaffoldMessenger.of(context).hideCurrentSnackBar();
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: const Text("已复制"), action: SnackBarAction(label: "跳转", onPressed: () {
launchUrl(Uri.parse(helperLink2), mode: LaunchMode.externalApplication);
},))
);
});
}, child: const Text("查看", style: ts, textAlign: TextAlign.center))
]),
)
)
@@ -219,9 +327,18 @@ class TermPty {
}
});
terminal.onOutput = (data) {
if (G.prefs.getBool("isTerminalWriteEnabled")!) {
pty.write(const Utf8Encoder().convert(data));
if (!(Util.getGlobal("isTerminalWriteEnabled") as bool)) {
return;
}
//由于对回车的处理似乎存在问题,所以拿出来单独处理
data.split("").forEach((element) {
if (element == "\n" && !G.maybeCtrlJ) {
terminal.keyInput(TerminalKey.enter);
return;
}
G.maybeCtrlJ = false;
pty.write(const Utf8Encoder().convert(element));
});
};
terminal.onResize = (w, h, pw, ph) {
pty.resize(h, w);
@@ -230,17 +347,78 @@ class TermPty {
}
// Global variables
class G {
static late final String dataPath;
static Pty? audioPty;
static late WebViewController controller;
static late BuildContext homePageStateContext;
static late int currentContainer; //目前运行第几个容器
static late Map<int, TermPty> termPtys; //为容器<int>存放TermPty数据
static late AdManager ads;//广告实例
static late VirtualKeyboard keyboard;
//default values
class D {
//默认快捷指令
static const commands = [{"name":"检查更新并升级", "command":"sudo apt update && sudo apt upgrade -y"},
{"name":"查看系统信息", "command":"neofetch -L && neofetch --off"},
{"name":"清屏", "command":"clear"},
{"name":"查看IP", "command":"hostname -I | awk '{print \$NF}' # 如果显示无权限(Permission denied)请在全局设置里开启getifaddrs桥接"},
{"name":"中断任务", "command":"\x03"},
{"name":"安装图形处理软件Krita", "command":"sudo apt update && sudo apt install -y krita krita-l10n"},
{"name":"卸载Krita", "command":"sudo apt autoremove --purge -y krita krita-l10n"},
{"name":"安装视频剪辑软件Kdenlive", "command":"sudo apt update && sudo apt install -y kdenlive"},
{"name":"卸载Kdenlive", "command":"sudo apt autoremove --purge -y kdenlive"},
{"name":"安装科学计算软件Octave", "command":"sudo apt update && sudo apt install -y octave"},
{"name":"卸载Octave", "command":"sudo apt autoremove --purge -y octave"},
{"name":"安装WPS", "command":"""wget \$(curl -L https://linux.wps.cn/ | grep -oP 'href="\\K[^"]*arm64\\.deb' | head -n 1) -O /tmp/wps.deb && sudo apt update && sudo apt install -y /tmp/wps.deb; rm /tmp/wps.deb"""},
{"name":"卸载WPS", "command":"sudo apt autoremove --purge -y wps-office"},
{"name":"安装CAJViewer", "command":"wget https://download.cnki.net/net.cnki.cajviewer_1.3.20-1_arm64.deb -O /tmp/caj.deb && sudo apt update && sudo apt install -y /tmp/caj.deb && bash /home/tiny/.local/share/tiny/caj/postinst; rm /tmp/caj.deb"},
{"name":"卸载CAJViewer", "command":"sudo apt autoremove --purge -y net.cnki.cajviewer && bash /home/tiny/.local/share/tiny/caj/postrm"},
{"name":"安装亿图图示", "command":"wget https://www.edrawsoft.cn/2download/aarch64/edrawmax_11.5.6-3_arm64.deb -O /tmp/edraw.deb && sudo apt update && sudo apt install -y /tmp/edraw.deb && bash /home/tiny/.local/share/tiny/edraw/postinst; rm /tmp/edraw.deb"},
{"name":"卸载亿图图示", "command":"sudo apt autoremove --purge -y edrawmax libldap-2.4-2"},
{"name":"安装QQ", "command":"""wget \$(curl -L https://cdn-go.cn/qq-web/im.qq.com_new/latest/rainbow/linuxQQDownload.js | grep -oP 'deb":"\\K[^"]*arm64\\.deb' | head -n 1) -O /tmp/qq.deb && sudo apt update && sudo apt install -y /tmp/qq.deb && sed -i 's#Exec=/opt/QQ/qq %U#Exec=/opt/QQ/qq --no-sandbox %U#g' /usr/share/applications/qq.desktop; rm /tmp/qq.deb"""},
{"name":"卸载QQ", "command":"sudo apt autoremove --purge -y linuxqq"},
{"name":"安装UOS微信", "command":"wget https://home-store-packages.uniontech.com/appstore/pool/appstore/c/com.tencent.weixin/com.tencent.weixin_2.1.9_arm64.deb -O /tmp/wechat.deb && sudo apt update && sudo apt install -y /tmp/wechat.deb /home/tiny/.local/share/tiny/wechat/deepin-elf-verify_all.deb /home/tiny/.local/share/tiny/wechat/libssl1.1_1.1.1n-0+deb10u6_arm64.deb && sed -i 's#/opt/apps/com.tencent.weixin/files/weixin/weixin#/opt/apps/com.tencent.weixin/files/weixin/weixin --no-sandbox#g' /opt/apps/com.tencent.weixin/files/weixin/weixin.sh && echo '该微信为UOS特供版只有账号实名且在UOS系统上运行时可用。在使用前请前往全局设置开启UOS伪装。\n如果你使用微信只是为了传输文件那么可以考虑使用支持SAF的文件管理器质感文件直接访问小小电脑所有文件。'; rm /tmp/wechat.deb"},
{"name":"卸载UOS微信", "command":"sudo apt autoremove --purge -y com.tencent.weixin libssl1.1 deepin-elf-verify"},
{"name":"安装钉钉", "command":"""wget \$(curl -L https://g.alicdn.com/dingding/h5-home-download/0.2.4/js/index.js | grep -oP 'url:"\\K[^"]*arm64\\.deb' | head -n 1) -O /tmp/dingtalk.deb && sudo apt update && sudo apt install -y /tmp/dingtalk.deb && sed -i 's#\\./com.alibabainc.dingtalk#\\./com.alibabainc.dingtalk --no-sandbox#g' /opt/apps/com.alibabainc.dingtalk/files/Elevator.sh; rm /tmp/dingtalk.deb"""},
{"name":"卸载钉钉", "command":"sudo apt autoremove --purge -y com.alibabainc.dingtalk"},
{"name":"修复无法编译C语言程序", "command":"sudo apt update && sudo apt reinstall -y libc6-dev"},
{"name":"修复系统语言到中文", "command":"sudo localedef -c -i zh_CN -f UTF-8 zh_CN.UTF-8"},
{"name":"启用回收站", "command":"sudo apt update && sudo apt install -y gvfs && echo '安装完成, 重启软件即可使用回收站。'"},
{"name":"拉流测试", "command":"ffplay rtsp://127.0.0.1:8554/stream &"},
{"name":"关机", "command":"stopvnc\nexit\nexit"},
{"name":"???", "command":"timeout 8 cmatrix"}];
//默认wine快捷指令
static const wineCommands = [{"name":"wine配置", "command":"wine64 winecfg"},
{"name":"我的电脑", "command":"wine64 explorer"},
{"name":"记事本", "command":"wine64 notepad"},
{"name":"扫雷", "command":"wine64 winemine"},
{"name":"注册表", "command":"wine64 regedit"},
{"name":"控制面板", "command":"wine64 control"},
{"name":"文件管理器", "command":"wine64 winefile"},
{"name":"任务管理器", "command":"wine64 taskmgr"},
{"name":"ie浏览器", "command":"wine64 iexplore"},
{"name":"强制关闭wine", "command":"wineserver -k"}];
//默认小键盘
static const termCommands = [
{"name": "Esc", "key": TerminalKey.escape},
{"name": "Tab", "key": TerminalKey.tab},
{"name": "", "key": TerminalKey.arrowUp},
{"name": "", "key": TerminalKey.arrowDown},
{"name": "", "key": TerminalKey.arrowLeft},
{"name": "", "key": TerminalKey.arrowRight},
{"name": "Del", "key": TerminalKey.delete},
{"name": "PgUp", "key": TerminalKey.pageUp},
{"name": "PgDn", "key": TerminalKey.pageDown},
{"name": "Home", "key": TerminalKey.home},
{"name": "End", "key": TerminalKey.end},
{"name": "F1", "key": TerminalKey.f1},
{"name": "F2", "key": TerminalKey.f2},
{"name": "F3", "key": TerminalKey.f3},
{"name": "F4", "key": TerminalKey.f4},
{"name": "F5", "key": TerminalKey.f5},
{"name": "F6", "key": TerminalKey.f6},
{"name": "F7", "key": TerminalKey.f7},
{"name": "F8", "key": TerminalKey.f8},
{"name": "F9", "key": TerminalKey.f9},
{"name": "F10", "key": TerminalKey.f10},
{"name": "F11", "key": TerminalKey.f11},
{"name": "F12", "key": TerminalKey.f12},
];
//看广告可以获得的奖励。
//weight抽奖权重singleUse使用一次花费的数量amount抽中可以获得的数量
@@ -255,25 +433,71 @@ class G {
{"name": "Bonus Reward", "subtitle": "会有极好的事情发生", "description": "来自记忆空间的传说。\n使用后一天内必有极好的事情...\n就是你想象的那种事情...\n就会发生。\n不过, 大概只是个传说吧。", "weight": 1, "amount": 1, "singleUse": 1},
];
//所有key
//int defaultContainer = 0: 默认启动第0个容器
//String defaultAudioPort = 4713: 默认pulseaudio端口(为了避免和其它软件冲突改成4718了) !!!注意!这个值是String类型
//bool autoLaunchVnc = true: 是否自动启动VNC并跳转
//String lastDate: 上次启动软件的日期yyyy-MM-dd
//int adsWatchedToday: 今日视频广告观看数量
//int adsWatchedTotal: 视频广告观看数量
//bool isBannerAdsClosed = false
//bool bannerAdsCanBeClosed = false 看一次视频广告永久开启,历史遗留
//bool isTerminalWriteEnabled = false
//bool terminalWriteCanBeEnabled = false 看一次视频广告永久开启,历史遗留
//bool isTerminalCommandsEnabled = false
//? int bootstrapVersion: 启动包版本
//String[] containersInfo: 所有容器信息(json)
//{name, boot:"\$DATA_DIR/bin/proot ...", vnc:"startnovnc", vncUrl:"...", commands:[{name:"更新和升级", command:"apt update -y && apt upgrade -y"}, ...]}
//String[] adsBonus: 观看广告获取的奖励(json)
//{name: "xxx", amount: xxx}
static late SharedPreferences prefs;
//某项功能开启需要的广告数。
static const Map<String, int> adsRequired = {
"closeBannerAds" : 5,
"enableTerminalWrite" : 2,
"enableTerminalCommands" : 3,
"changeTermMaxLines" : 6,
"changeFFmpegCommand" : 8,
"enableVirgl" : 10,
"unlockOnce" : 1, //临时解锁需要看的广告数
"unlockToday" : 2, //当日解锁需要看的广告数
};
static const String boot = "\$DATA_DIR/bin/proot -H --change-id=1000:1000 --pwd=/home/tiny --rootfs=\$CONTAINER_DIR --mount=/system --mount=/apex --mount=/sys --kill-on-exit --mount=/storage:/storage --sysvipc -L --link2symlink --mount=/proc:/proc --mount=/dev:/dev --mount=\$CONTAINER_DIR/tmp:/dev/shm --mount=/dev/urandom:/dev/random --mount=/proc/self/fd:/dev/fd --mount=/proc/self/fd/0:/dev/stdin --mount=/proc/self/fd/1:/dev/stdout --mount=/proc/self/fd/2:/dev/stderr --mount=/dev/null:/dev/tty0 --mount=/dev/null:/proc/sys/kernel/cap_last_cap --mount=/storage/self/primary:/media/sd --mount=\$DATA_DIR/share:/home/tiny/公共 --mount=\$DATA_DIR/tiny:/home/tiny/.local/share/tiny --mount=/storage/self/primary/Fonts:/usr/share/fonts/wpsm --mount=/storage/self/primary/AppFiles/Fonts:/usr/share/fonts/yozom --mount=/system/fonts:/usr/share/fonts/androidm --mount=/storage/self/primary/Pictures:/home/tiny/图片 --mount=/storage/self/primary/Music:/home/tiny/音乐 --mount=/storage/self/primary/Movies:/home/tiny/视频 --mount=/storage/self/primary/Download:/home/tiny/下载 --mount=/storage/self/primary/DCIM:/home/tiny/照片 --mount=/storage/self/primary/Documents:/home/tiny/文档 --mount=\$CONTAINER_DIR/usr/local/etc/tmoe-linux/proot_proc/.tmoe-container.stat:/proc/stat --mount=\$CONTAINER_DIR/usr/local/etc/tmoe-linux/proot_proc/.tmoe-container.version:/proc/version --mount=\$CONTAINER_DIR/usr/local/etc/tmoe-linux/proot_proc/bus:/proc/bus --mount=\$CONTAINER_DIR/usr/local/etc/tmoe-linux/proot_proc/buddyinfo:/proc/buddyinfo --mount=\$CONTAINER_DIR/usr/local/etc/tmoe-linux/proot_proc/cgroups:/proc/cgroups --mount=\$CONTAINER_DIR/usr/local/etc/tmoe-linux/proot_proc/consoles:/proc/consoles --mount=\$CONTAINER_DIR/usr/local/etc/tmoe-linux/proot_proc/crypto:/proc/crypto --mount=\$CONTAINER_DIR/usr/local/etc/tmoe-linux/proot_proc/devices:/proc/devices --mount=\$CONTAINER_DIR/usr/local/etc/tmoe-linux/proot_proc/diskstats:/proc/diskstats --mount=\$CONTAINER_DIR/usr/local/etc/tmoe-linux/proot_proc/execdomains:/proc/execdomains --mount=\$CONTAINER_DIR/usr/local/etc/tmoe-linux/proot_proc/fb:/proc/fb --mount=\$CONTAINER_DIR/usr/local/etc/tmoe-linux/proot_proc/filesystems:/proc/filesystems --mount=\$CONTAINER_DIR/usr/local/etc/tmoe-linux/proot_proc/interrupts:/proc/interrupts --mount=\$CONTAINER_DIR/usr/local/etc/tmoe-linux/proot_proc/iomem:/proc/iomem --mount=\$CONTAINER_DIR/usr/local/etc/tmoe-linux/proot_proc/ioports:/proc/ioports --mount=\$CONTAINER_DIR/usr/local/etc/tmoe-linux/proot_proc/kallsyms:/proc/kallsyms --mount=\$CONTAINER_DIR/usr/local/etc/tmoe-linux/proot_proc/keys:/proc/keys --mount=\$CONTAINER_DIR/usr/local/etc/tmoe-linux/proot_proc/key-users:/proc/key-users --mount=\$CONTAINER_DIR/usr/local/etc/tmoe-linux/proot_proc/kpageflags:/proc/kpageflags --mount=\$CONTAINER_DIR/usr/local/etc/tmoe-linux/proot_proc/loadavg:/proc/loadavg --mount=\$CONTAINER_DIR/usr/local/etc/tmoe-linux/proot_proc/locks:/proc/locks --mount=\$CONTAINER_DIR/usr/local/etc/tmoe-linux/proot_proc/misc:/proc/misc --mount=\$CONTAINER_DIR/usr/local/etc/tmoe-linux/proot_proc/modules:/proc/modules --mount=\$CONTAINER_DIR/usr/local/etc/tmoe-linux/proot_proc/pagetypeinfo:/proc/pagetypeinfo --mount=\$CONTAINER_DIR/usr/local/etc/tmoe-linux/proot_proc/partitions:/proc/partitions --mount=\$CONTAINER_DIR/usr/local/etc/tmoe-linux/proot_proc/sched_debug:/proc/sched_debug --mount=\$CONTAINER_DIR/usr/local/etc/tmoe-linux/proot_proc/softirqs:/proc/softirqs --mount=\$CONTAINER_DIR/usr/local/etc/tmoe-linux/proot_proc/timer_list:/proc/timer_list --mount=\$CONTAINER_DIR/usr/local/etc/tmoe-linux/proot_proc/uptime:/proc/uptime --mount=\$CONTAINER_DIR/usr/local/etc/tmoe-linux/proot_proc/vmallocinfo:/proc/vmallocinfo --mount=\$CONTAINER_DIR/usr/local/etc/tmoe-linux/proot_proc/vmstat:/proc/vmstat --mount=\$CONTAINER_DIR/usr/local/etc/tmoe-linux/proot_proc/zoneinfo:/proc/zoneinfo \$EXTRA_MOUNT /usr/bin/env -i HOSTNAME=TINY HOME=/home/tiny USER=tiny TERM=xterm-256color SDL_IM_MODULE=fcitx XMODIFIERS=@im=fcitx QT_IM_MODULE=fcitx GTK_IM_MODULE=fcitx TMOE_CHROOT=false TMOE_PROOT=true TMPDIR=/tmp MOZ_FAKE_NO_SANDBOX=1 DISPLAY=:4 PULSE_SERVER=tcp:127.0.0.1:4718 LANG=zh_CN.UTF-8 SHELL=/bin/bash PATH=/usr/local/sbin:/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/games:/usr/local/games \$EXTRA_OPT /bin/bash -l";
static final ButtonStyle commandButtonStyle = OutlinedButton.styleFrom(
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
minimumSize: const Size(0, 0),
padding: const EdgeInsets.fromLTRB(4, 2, 4, 2)
);
static final ButtonStyle controlButtonStyle = OutlinedButton.styleFrom(
textStyle: const TextStyle(fontWeight: FontWeight.w400),
side: const BorderSide(color: Color(0x1F000000)),
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
minimumSize: const Size(0, 0),
padding: const EdgeInsets.fromLTRB(8, 4, 8, 4)
);
}
// Global variables
class G {
static late final String dataPath;
static Pty? audioPty;
static late WebViewController controller;
static late BuildContext homePageStateContext;
static late int currentContainer; //目前运行第几个容器
static late Map<int, TermPty> termPtys; //为容器<int>存放TermPty数据
static late AdManager ads; //广告实例
static late VirtualKeyboard keyboard; //存储ctrl, shift, alt状态
static bool maybeCtrlJ = false; //为了区分按下的ctrl+J和enter而准备的变量
static ValueNotifier<double> termFontScale = ValueNotifier(1); //终端字体大小存储为G.prefs的termFontScale
static int adsWatchedThisTime = 0; //本次启动应用看的广告数
static bool isStreamServerStarted = false;
static bool isStreaming = false;
//static int? streamingPid;
static String streamingOutput = "";
static late Pty streamServerPty;
static bool isVirglServerStarted = false;
static late Pty virglServerPty;
//static int? virglPid;
static ValueNotifier<int> pageIndex = ValueNotifier(0); //主界面索引
static ValueNotifier<bool> terminalPageChange = ValueNotifier(true); //更改值,用于刷新小键盘
static ValueNotifier<bool> bannerAdsChange = ValueNotifier(true); //更改值用于刷新banner广告
static ValueNotifier<bool> bootTextChange = ValueNotifier(true); //更改值,用于刷新启动命令
static ValueNotifier<String> updateText = ValueNotifier("小小电脑"); //加载界面的说明文字
static bool wasBoxEnabled = false; //本次启动时是否启用了box86/64
static bool wasWineEnabled = false; //本次启动时是否启用了wine
static late SharedPreferences prefs;
}
class AdManager {
@@ -302,7 +526,7 @@ class AdManager {
static void showAd(String placementId, Function completeExtra, Function full) {
if (G.prefs.getInt("adsWatchedToday")!>=5) {
if ((Util.getGlobal("adsWatchedToday") as int) >= 5) {
full();
return;
}
@@ -313,8 +537,9 @@ class AdManager {
onComplete: (placementId) async {
debugPrint('Video Ad $placementId completed');
loadAd(placementId);
await G.prefs.setInt("adsWatchedTotal", G.prefs.getInt("adsWatchedTotal")!+1);
await G.prefs.setInt("adsWatchedToday", G.prefs.getInt("adsWatchedToday")!+1);
G.adsWatchedThisTime++;
await G.prefs.setInt("adsWatchedTotal", (Util.getGlobal("adsWatchedTotal") as int)+1);
await G.prefs.setInt("adsWatchedToday", (Util.getGlobal("adsWatchedToday") as int)+1);
completeExtra();
},
onFailed: (placementId, error, message) {
@@ -351,7 +576,7 @@ class Workflow {
static Future<void> grantPermissions() async {
Permission.storage.request();
Permission.manageExternalStorage.request();
//Permission.manageExternalStorage.request();
}
static Future<void> setupBootstrap() async {
@@ -361,13 +586,21 @@ class Workflow {
Util.createDirFromString("${G.dataPath}/tmp");
//给proot的tmp文件夹虽然我不知道为什么proot要这个
Util.createDirFromString("${G.dataPath}/proot_tmp");
//给pulseaudio的tmp文件夹
Util.createDirFromString("${G.dataPath}/pulseaudio_tmp");
//解压后得到bin文件夹和libexec文件夹
//bin存放了prootpulseaudio
//bin存放了proot, pulseaudio, tar等
//libexec存放了proot loader
await Util.copyAsset(
"assets/assets.zip",
"${G.dataPath}/assets.zip",
);
//patch.tar.gz存放了tiny文件夹
//里面是一些补丁,会被挂载到~/.local/share/tiny
await Util.copyAsset(
"assets/patch.tar.gz",
"${G.dataPath}/patch.tar.gz",
);
//dddd
await Util.copyAsset(
"assets/busybox",
@@ -378,33 +611,40 @@ class Workflow {
export DATA_DIR=${G.dataPath}
cd \$DATA_DIR
chmod +x busybox
\$DATA_DIR/busybox unzip assets.zip
\$DATA_DIR/busybox unzip -o assets.zip
chmod -R +x bin/*
chmod -R +x libexec/proot/*
chmod 1777 tmp
ln -s \$DATA_DIR/busybox \$DATA_DIR/bin/xz
\$DATA_DIR/busybox rm -rf assets.zip
ln -sf \$DATA_DIR/busybox \$DATA_DIR/bin/xz
ln -sf \$DATA_DIR/busybox \$DATA_DIR/bin/gzip
\$DATA_DIR/bin/tar zxf patch.tar.gz
\$DATA_DIR/busybox rm -rf assets.zip patch.tar.gz
""");
}
//初次启动要做的事情
static Future<void> initForFirstTime() async {
//首先设置bootstrap
G.updateText.value = "正在安装引导包";
await setupBootstrap();
G.updateText.value = "正在复制容器系统";
//存放容器的文件夹0和存放硬链接的文件夹.l2s
Util.createDirFromString("${G.dataPath}/containers/0/.l2s");
//这个是容器rootfs被split命令分成了xa*
//首次启动,就用这个,别让用户另选了
//TODO: 这个字符串列表太丑陋了
for (String name in ["xaa", "xab", "xac", "xad", "xae", "xaf", "xag", "xah", "xai"]) {
for (String name in ["xaa", "xab", "xac", "xad", "xae", "xaf", "xag", "xah", "xai", "xaj"]) {
//for (String name in ["xaa", "xab", "xac", "xad", "xae", "xaf", "xag", "xah", "xai", "xaj", "xak", "xal", "xam", "xan", "xao", "xap", "xaq"]) {
await Util.copyAsset("assets/$name", "${G.dataPath}/$name");
}
//-J
G.updateText.value = "正在安装容器系统";
await Util.execute(
"""
export DATA_DIR=${G.dataPath}
export CONTAINER_DIR=\$DATA_DIR/containers/0
export EXTRA_OPT=""
cd \$DATA_DIR
export PATH=\$DATA_DIR/bin:\$PATH
export PROOT_TMP_DIR=\$DATA_DIR/proot_tmp
@@ -432,34 +672,12 @@ done
//$DATA_DIR是数据文件夹, $CONTAINER_DIR是容器根目录
await G.prefs.setStringList("containersInfo", ["""{
"name":"Debian Bookworm",
"boot":"\$DATA_DIR/bin/proot --change-id=1000:1000 --pwd=/home/tiny --rootfs=\$CONTAINER_DIR --mount=/system --mount=/apex --kill-on-exit --mount=/storage:/storage --sysvipc -L --link2symlink --mount=/proc:/proc --mount=/dev:/dev --mount=\$CONTAINER_DIR/tmp:/dev/shm --mount=/dev/urandom:/dev/random --mount=/proc/self/fd:/dev/fd --mount=/proc/self/fd/0:/dev/stdin --mount=/proc/self/fd/1:/dev/stdout --mount=/proc/self/fd/2:/dev/stderr --mount=/dev/null:/dev/tty0 --mount=/dev/null:/proc/sys/kernel/cap_last_cap --mount=/storage/self/primary:/media/sd --mount=\$DATA_DIR/share:/home/tiny/公共 --mount=/storage/self/primary/Fonts:/usr/share/fonts/wpsm --mount=/storage/self/primary/AppFiles/Fonts:/usr/share/fonts/yozom --mount=/system/fonts:/usr/share/fonts/androidm --mount=/storage/self/primary/Pictures:/home/tiny/图片 --mount=/storage/self/primary/Music:/home/tiny/音乐 --mount=/storage/self/primary/Movies:/home/tiny/视频 --mount=/storage/self/primary/Download:/home/tiny/下载 --mount=/storage/self/primary/DCIM:/home/tiny/照片 --mount=/storage/self/primary/Documents:/home/tiny/文档 --mount=\$CONTAINER_DIR/usr/local/etc/tmoe-linux/proot_proc/.tmoe-container.stat:/proc/stat --mount=\$CONTAINER_DIR/usr/local/etc/tmoe-linux/proot_proc/.tmoe-container.version:/proc/version --mount=\$CONTAINER_DIR/usr/local/etc/tmoe-linux/proot_proc/bus:/proc/bus --mount=\$CONTAINER_DIR/usr/local/etc/tmoe-linux/proot_proc/buddyinfo:/proc/buddyinfo --mount=\$CONTAINER_DIR/usr/local/etc/tmoe-linux/proot_proc/cgroups:/proc/cgroups --mount=\$CONTAINER_DIR/usr/local/etc/tmoe-linux/proot_proc/consoles:/proc/consoles --mount=\$CONTAINER_DIR/usr/local/etc/tmoe-linux/proot_proc/crypto:/proc/crypto --mount=\$CONTAINER_DIR/usr/local/etc/tmoe-linux/proot_proc/devices:/proc/devices --mount=\$CONTAINER_DIR/usr/local/etc/tmoe-linux/proot_proc/diskstats:/proc/diskstats --mount=\$CONTAINER_DIR/usr/local/etc/tmoe-linux/proot_proc/execdomains:/proc/execdomains --mount=\$CONTAINER_DIR/usr/local/etc/tmoe-linux/proot_proc/fb:/proc/fb --mount=\$CONTAINER_DIR/usr/local/etc/tmoe-linux/proot_proc/filesystems:/proc/filesystems --mount=\$CONTAINER_DIR/usr/local/etc/tmoe-linux/proot_proc/interrupts:/proc/interrupts --mount=\$CONTAINER_DIR/usr/local/etc/tmoe-linux/proot_proc/iomem:/proc/iomem --mount=\$CONTAINER_DIR/usr/local/etc/tmoe-linux/proot_proc/ioports:/proc/ioports --mount=\$CONTAINER_DIR/usr/local/etc/tmoe-linux/proot_proc/kallsyms:/proc/kallsyms --mount=\$CONTAINER_DIR/usr/local/etc/tmoe-linux/proot_proc/keys:/proc/keys --mount=\$CONTAINER_DIR/usr/local/etc/tmoe-linux/proot_proc/key-users:/proc/key-users --mount=\$CONTAINER_DIR/usr/local/etc/tmoe-linuxproot_proc/kpageflags:/proc/kpageflags --mount=\$CONTAINER_DIR/usr/local/etc/tmoe-linux/proot_proc/loadavg:/proc/loadavg --mount=\$CONTAINER_DIR/usr/local/etc/tmoe-linux/proot_proc/locks:/proc/locks --mount=\$CONTAINER_DIR/usr/local/etc/tmoe-linux/proot_proc/misc:/proc/misc --mount=\$CONTAINER_DIR/usr/local/etc/tmoe-linux/proot_proc/modules:/proc/modules --mount=\$CONTAINER_DIR/usr/local/etc/tmoe-linux/proot_proc/pagetypeinfo:/proc/pagetypeinfo --mount=/data/data/com.termux/files/home/.local/share/tmoe-linux/containersproot/debian-bookworm_arm64/usr/local/etc/tmoe-linux/proot_proc/partitions:/proc/partitions --mount=\$CONTAINER_DIR/usr/local/etc/tmoe-linux/proot_proc/sched_debug:/proc/sched_debug --mount=\$CONTAINER_DIR/usr/local/etc/tmoe-linux/proot_proc/softirqs:/proc/softirqs --mount=\$CONTAINER_DIR/usr/local/etc/tmoe-linux/proot_proc/timer_list:/proc/timer_list --mount=\$CONTAINER_DIR/usr/local/etc/tmoe-linux/proot_proc/uptime:/proc/uptime --mount=\$CONTAINER_DIR/usr/local/etc/tmoe-linux/proot_proc/vmallocinfo:/proc/vmallocinfo --mount=\$CONTAINER_DIR/usr/local/etc/tmoe-linux/proot_proc/vmstat:/proc/vmstat --mount=\$CONTAINER_DIR/usr/local/etc/tmoe-linux/proot_proc/zoneinfo:/proc/zoneinfo /usr/bin/env -i HOSTNAME=TINY HOME=/home/tiny USER=tiny TERM=xterm-256color SDL_IM_MODULE=fcitx XMODIFIERS=@im=fcitx QT_IM_MODULE=fcitx GTK_IM_MODULE=fcitx TMOE_CHROOT=false TMOE_PROOT=true TMPDIR=/tmp MOZ_FAKE_NO_SANDBOX=1 DISPLAY=:4 PULSE_SERVER=tcp:127.0.0.1:4718 LANG=zh_CN.UTF-8 SHELL=/bin/bash PATH=/usr/local/sbin:/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/games:/usr/local/games /bin/bash -l",
"boot":"${D.boot}",
"vnc":"startnovnc &",
"vncUrl":"http://localhost:36082/vnc.html?host=localhost&port=36082&autoconnect=true&resize=remote&password=12345678",
"commands":[{"name":"检查更新并升级", "command":"sudo apt update && sudo apt upgrade -y"},
{"name":"查看系统信息", "command":"neofetch -L && neofetch --off"},
{"name":"清屏", "command":"clear"},
{"name":"安装图形处理软件Krita", "command":"sudo apt update && sudo apt install -y krita krita-l10n"},
{"name":"卸载图形处理软件Krita", "command":"sudo apt autoremove --purge -y krita krita-l10n"},
{"name":"安装视频剪辑软件Kdenlive", "command":"sudo apt update && sudo apt install -y kdenlive"},
{"name":"卸载视频剪辑软件Kdenlive", "command":"sudo apt autoremove --purge -y kdenlive"},
{"name":"安装科学计算软件Octave", "command":"sudo apt update && sudo apt install -y octave"},
{"name":"卸载科学计算软件Octave", "command":"sudo apt autoremove --purge -y octave"},
{"name":"安装WPS", "command":"wget https://wps-linux-personal.wpscdn.cn/wps/download/ep/Linux2019/11704/wps-office_11.1.0.11704_arm64.deb -O /tmp/wps.deb; sudo apt update; sudo apt install /tmp/wps.deb -y; rm /tmp/wps.deb"},
{"name":"卸载WPS", "command":"sudo apt autoremove --purge -y wps-office"},
{"name":"???", "command":"timeout 8 cmatrix"}]
"commands":${jsonEncode(D.commands)}
}"""]);
await G.prefs.setStringList("adsBonus", []);
await G.prefs.setInt("adsWatchedTotal", 0);
//await G.prefs.setBool("terminalWriteCanBeEnabled", false);
//G.prefs.setBool("isTerminalWriteEnabled", false);
await G.prefs.setBool("isTerminalCommandsEnabled", false);
await G.prefs.setBool("isTerminalWriteEnabled", false);
//await G.prefs.setBool("bannerAdsCanBeClosed", false);
await G.prefs.setBool("isBannerAdsClosed", false);
//G.prefs.setBool("autoLaunchVnc", true);
await G.prefs.setBool("autoLaunchVnc", true);
await G.prefs.setString("defaultAudioPort", "4718");
await G.prefs.setInt("defaultContainer", 0);
G.updateText.value = "安装完成";
}
static Future<void> initData() async {
@@ -474,7 +692,7 @@ done
//限制一天内观看视频广告不超过5次
final String currentDate = DateFormat("yyyy-MM-dd").format(DateTime.now());
if (currentDate != G.prefs.getString("lastDate")) {
if (currentDate != (Util.getGlobal("lastDate") as String)) {
await G.prefs.setString("lastDate", currentDate);
await G.prefs.setInt("adsWatchedToday", 0);
}
@@ -483,10 +701,41 @@ done
if (!G.prefs.containsKey("defaultContainer")) {
await initForFirstTime();
}
G.currentContainer = G.prefs.getInt("defaultContainer")!;
G.currentContainer = Util.getGlobal("defaultContainer") as int;
//是否需要重新安装引导包?
if (Util.getGlobal("reinstallBootstrap")) {
G.updateText.value = "正在重新安装引导包";
await setupBootstrap();
G.prefs.setBool("reinstallBootstrap", false);
}
G.termFontScale.value = Util.getGlobal("termFontScale") as double;
G.controller = WebViewController()..setJavaScriptMode(JavaScriptMode.unrestricted);
//恢复临时开启的功能
if (Util.shouldWatchAds(D.adsRequired["changeFFmpegCommand"]!)) {
await G.prefs.remove("defaultFFmpegCommand");
}
if (Util.shouldWatchAds(D.adsRequired["changeTermMaxLines"]!)) {
await G.prefs.setInt("termMaxLines", 4095);
}
if (Util.shouldWatchAds(D.adsRequired["closeBannerAds"]!)) {
await G.prefs.setBool("isBannerAdsClosed", false);
}
if (Util.shouldWatchAds(D.adsRequired["enableTerminalWrite"]!)) {
await G.prefs.setBool("isTerminalWriteEnabled", false);
}
if (Util.shouldWatchAds(D.adsRequired["enableTerminalCommands"]!)) {
await G.prefs.setBool("isTerminalCommandsEnabled", false);
}
if (Util.shouldWatchAds(D.adsRequired["enableVirgl"]!)) {
await G.prefs.setBool("virgl", false);
}
//设置屏幕常亮
WakelockPlus.toggle(enable: Util.getGlobal("wakelock"));
}
static Future<void> initTerminalForCurrent() async {
@@ -498,7 +747,7 @@ done
static Future<void> initAds() async {
UnityAds.init(
gameId: AdManager.gameId,
testMode: true,
testMode: false,
onComplete: () {
debugPrint('Initialization Complete');
AdManager.loadAds();
@@ -512,34 +761,73 @@ done
G.audioPty = Pty.start(
"/system/bin/sh"
);
//pulseaudio也需要一个tmp文件夹这里选择前面的cache没有什么特别的原因不行再换
//pulseaudio还需要一个文件夹放配置这里用share
G.audioPty!.write(const Utf8Encoder().convert("""
export DATA_DIR=${G.dataPath}
cd \$DATA_DIR/..
export TMPDIR=\$PWD/cache
cd \$DATA_DIR
export HOME=\$DATA_DIR/share
export LD_LIBRARY_PATH=\$DATA_DIR/bin
\$DATA_DIR/busybox sed "s/4713/${G.prefs.getString("defaultAudioPort")!}/g" \$DATA_DIR/bin/pulseaudio.conf > \$DATA_DIR/bin/pulseaudio.conf.tmp
\$DATA_DIR/bin/pulseaudio -F \$DATA_DIR/bin/pulseaudio.conf.tmp
\$DATA_DIR/busybox sed "s/4713/${Util.getGlobal("defaultAudioPort") as int}/g" \$DATA_DIR/bin/pulseaudio.conf > \$DATA_DIR/bin/pulseaudio.conf.tmp
rm -rf \$DATA_DIR/pulseaudio_tmp/*
TMPDIR=\$DATA_DIR/pulseaudio_tmp HOME=\$DATA_DIR/pulseaudio_tmp XDG_CONFIG_HOME=\$DATA_DIR/pulseaudio_tmp LD_LIBRARY_PATH=\$DATA_DIR/bin \$DATA_DIR/bin/pulseaudio -F \$DATA_DIR/bin/pulseaudio.conf.tmp
exit
"""));
await G.audioPty?.exitCode;
}
static Future<void> launchCurrentContainer() async {
String box86BinPath = "";
String box64BinPath = "";
String box86LibraryPath = "";
String box64LibraryPath = "";
String extraMount = ""; //mount options and other proot options
String extraOpt = "";
if (Util.getGlobal("getifaddrsBridge")) {
Util.execute("${G.dataPath}/bin/getifaddrs_bridge_server ${G.dataPath}/containers/${G.currentContainer}/tmp/.getifaddrs-bridge");
extraOpt += "LD_PRELOAD=/home/tiny/.local/share/tiny/extra/getifaddrs_bridge_client_lib.so ";
}
if (Util.getGlobal("uos")) {
extraMount += "--mount=\$DATA_DIR/tiny/wechat/uos-lsb:/etc/lsb-release --mount=\$DATA_DIR/tiny/wechat/uos-release:/usr/lib/os-release ";
extraMount += "--mount=\$DATA_DIR/tiny/wechat/license/var/uos:/var/uos --mount=\$DATA_DIR/tiny/wechat/license/var/lib/uos-license:/var/lib/uos-license ";
}
if (Util.getGlobal("virgl")) {
Util.execute("""
export DATA_DIR=${G.dataPath}
export CONTAINER_DIR=\$DATA_DIR/containers/${G.currentContainer}
${G.dataPath}/bin/virgl_test_server ${Util.getGlobal("defaultVirglCommand")}""");
extraOpt += "${Util.getGlobal("defaultVirglOpt")} ";
}
if (Util.getGlobal("isBoxEnabled")) {
G.wasBoxEnabled = true;
extraMount += "--x86=/home/tiny/.local/bin/box86 --x64=/home/tiny/.local/bin/box64 ";
extraMount += "--mount=\$DATA_DIR/tiny/cross/box86:/home/tiny/.local/bin/box86 --mount=\$DATA_DIR/tiny/cross/box64:/home/tiny/.local/bin/box64 ";
extraOpt += "BOX86_NOBANNER=1 BOX64_NOBANNER=1 ";
}
if (Util.getGlobal("isWineEnabled")) {
G.wasWineEnabled = true;
box86BinPath += "/home/tiny/.local/share/tiny/cross/wine/bin:";
box64BinPath += "/home/tiny/.local/share/tiny/cross/wine/bin:";
box86LibraryPath += "/home/tiny/.local/share/tiny/cross/wine/lib/wine/i386-unix:";
box64LibraryPath += "/home/tiny/.local/share/tiny/cross/wine/lib/wine/x86_64-unix:";
extraMount += "--wine=/home/tiny/.local/bin/wine64 ";
extraMount += "--mount=\$DATA_DIR/tiny/cross/wine.desktop:/usr/share/applications/wine.desktop ";
//extraMount += "--mount=\$DATA_DIR/tiny/cross/winetricks:/home/tiny/.local/bin/winetricks --mount=\$DATA_DIR/tiny/cross/winetricks.desktop:/usr/share/applications/winetricks.desktop ";
}
if (G.wasBoxEnabled) {
extraOpt += "BOX86_PATH=$box86BinPath/home/tiny/.local/share/tiny/cross/bin ";
extraOpt += "BOX64_PATH=$box64BinPath/home/tiny/.local/share/tiny/cross/bin ";
extraOpt += "BOX86_LD_LIBRARY_PATH=$box86LibraryPath/home/tiny/.local/share/tiny/cross/x86lib ";
extraOpt += "BOX64_LD_LIBRARY_PATH=$box64LibraryPath/home/tiny/.local/share/tiny/cross/x64lib ";
}
Util.termWrite(
"""
export DATA_DIR=${G.dataPath}
export CONTAINER_DIR=\$DATA_DIR/containers/${G.currentContainer}
export EXTRA_MOUNT="$extraMount"
export EXTRA_OPT="$extraOpt"
#export PROOT_L2S_DIR=\$DATA_DIR/containers/0/.l2s
cd \$DATA_DIR
export PROOT_TMP_DIR=\$DATA_DIR/proot_tmp
export PROOT_LOADER=\$DATA_DIR/libexec/proot/loader
export PROOT_LOADER_32=\$DATA_DIR/libexec/proot/loader32
${Util.getCurrentProp("boot")}
${G.prefs.getBool("autoLaunchVnc")!?Util.getCurrentProp("vnc"):""}
${(Util.getGlobal("autoLaunchVnc") as bool)?Util.getCurrentProp("vnc"):""}
clear""");
}
@@ -571,14 +859,16 @@ clear""");
LogicalKeyboardKey.arrowLeft,
LogicalKeyboardKey.arrowRight,
LogicalKeyboardKey.arrowUp,
LogicalKeyboardKey.arrowDown
LogicalKeyboardKey.arrowDown,
LogicalKeyboardKey.tab
}.contains(event.logicalKey)) {
return KeyEventResult.skipRemainingHandlers;
}
}
return KeyEventResult.ignored;
},
child: WebViewWidget(controller: G.controller),
child: GestureDetector(onSecondaryTap: () {
}, child: WebViewWidget(controller: G.controller))
);
}));
}
@@ -590,7 +880,7 @@ clear""");
await initTerminalForCurrent();
setupAudio();
launchCurrentContainer();
if (G.prefs.getBool("autoLaunchVnc")!) {
if (Util.getGlobal("autoLaunchVnc") as bool) {
waitForConnection().then((value) => launchBrowser());
}
}

View File

@@ -5,12 +5,18 @@
import FlutterMacOS
import Foundation
import ffmpeg_kit_flutter_full_gpl
import package_info_plus
import path_provider_foundation
import shared_preferences_foundation
import url_launcher_macos
import wakelock_plus
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
FFmpegKitFlutterPlugin.register(with: registry.registrar(forPlugin: "FFmpegKitFlutterPlugin"))
FPPPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FPPPackageInfoPlusPlugin"))
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin"))
WakelockPlusMacosPlugin.register(with: registry.registrar(forPlugin: "WakelockPlusMacosPlugin"))
}

View File

@@ -1,6 +1,14 @@
# Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile
packages:
args:
dependency: transitive
description:
name: args
sha256: eef6c46b622e0494a36c5a12d10d77fb4e855501a91c1b9ef9339326e58f0596
url: "https://pub.dev"
source: hosted
version: "2.4.2"
async:
dependency: transitive
description:
@@ -45,10 +53,10 @@ packages:
dependency: transitive
description:
name: collection
sha256: f092b211a4319e98e5ff58223576de6c2803db36221657b46c82574721240687
sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a
url: "https://pub.dev"
source: hosted
version: "1.17.2"
version: "1.18.0"
convert:
dependency: transitive
description:
@@ -57,6 +65,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "3.1.1"
dbus:
dependency: transitive
description:
name: dbus
sha256: "365c771ac3b0e58845f39ec6deebc76e3276aa9922b0cc60840712094d9047ac"
url: "https://pub.dev"
source: hosted
version: "0.7.10"
equatable:
dependency: transitive
description:
@@ -81,14 +97,30 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.1.0"
ffmpeg_kit_flutter_full_gpl:
dependency: "direct main"
description:
name: ffmpeg_kit_flutter_full_gpl
sha256: "4f269bcb636bfcb544e5b4d65c706a3d311839970cb42638e72406410c1b5b7b"
url: "https://pub.dev"
source: hosted
version: "6.0.3"
ffmpeg_kit_flutter_platform_interface:
dependency: transitive
description:
name: ffmpeg_kit_flutter_platform_interface
sha256: addf046ae44e190ad0101b2fde2ad909a3cd08a2a109f6106d2f7048b7abedee
url: "https://pub.dev"
source: hosted
version: "0.2.1"
file:
dependency: transitive
description:
name: file
sha256: "1b92bec4fc2a72f59a8e15af5f52cd441e4a7860b49499d69dfa817af20e925d"
sha256: "5fc22d7c25582e38ad9a8515372cd9a93834027aacf1801cf01164dac0ffa08c"
url: "https://pub.dev"
source: hosted
version: "6.1.4"
version: "7.0.0"
flutter:
dependency: "direct main"
description: flutter
@@ -98,10 +130,10 @@ packages:
dependency: "direct dev"
description:
name: flutter_lints
sha256: "2118df84ef0c3ca93f96123a616ae8540879991b8b57af2f81b76a7ada49b2a4"
sha256: e2a421b7e59244faef694ba7b30562e489c2b489866e505074eb005cd7060db7
url: "https://pub.dev"
source: hosted
version: "2.0.2"
version: "3.0.1"
flutter_pty:
dependency: "direct main"
description:
@@ -124,10 +156,10 @@ packages:
dependency: "direct main"
description:
name: http
sha256: "759d1a329847dd0f39226c688d3e06a6b8679668e350e2891a6474f8b4bb8525"
sha256: d4872660c46d929f6b8a9ef4e7a7eff7e49bbf0c4ec3f385ee32df5119175139
url: "https://pub.dev"
source: hosted
version: "1.1.0"
version: "1.1.2"
http_parser:
dependency: transitive
description:
@@ -144,14 +176,22 @@ packages:
url: "https://pub.dev"
source: hosted
version: "0.18.1"
js:
dependency: transitive
description:
name: js
sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3
url: "https://pub.dev"
source: hosted
version: "0.6.7"
lints:
dependency: transitive
description:
name: lints
sha256: "0a217c6c989d21039f1498c3ed9f3ed71b354e69873f13a8dfc3c9fe76f1b452"
sha256: cbf8d4b858bb0134ef3ef87841abdf8d63bfc255c266b7bf6b39daa1085c4290
url: "https://pub.dev"
source: hosted
version: "2.1.1"
version: "3.0.0"
matcher:
dependency: transitive
description:
@@ -172,10 +212,26 @@ packages:
dependency: transitive
description:
name: meta
sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3"
sha256: a6e590c838b18133bb482a2745ad77c5bb7715fb0451209e1a7567d416678b8e
url: "https://pub.dev"
source: hosted
version: "1.9.1"
version: "1.10.0"
package_info_plus:
dependency: transitive
description:
name: package_info_plus
sha256: "88bc797f44a94814f2213db1c9bd5badebafdfb8290ca9f78d4b9ee2a3db4d79"
url: "https://pub.dev"
source: hosted
version: "5.0.1"
package_info_plus_platform_interface:
dependency: transitive
description:
name: package_info_plus_platform_interface
sha256: "9bc8ba46813a4cc42c66ab781470711781940780fd8beddd0c3da62506d3a6c6"
url: "https://pub.dev"
source: hosted
version: "2.0.1"
path:
dependency: transitive
description:
@@ -188,98 +244,114 @@ packages:
dependency: "direct main"
description:
name: path_provider
sha256: "909b84830485dbcd0308edf6f7368bc8fd76afa26a270420f34cabea2a6467a0"
sha256: a1aa8aaa2542a6bc57e381f132af822420216c80d4781f7aa085ca3229208aaa
url: "https://pub.dev"
source: hosted
version: "2.1.0"
version: "2.1.1"
path_provider_android:
dependency: transitive
description:
name: path_provider_android
sha256: "5d44fc3314d969b84816b569070d7ace0f1dea04bd94a83f74c4829615d22ad8"
sha256: e595b98692943b4881b219f0a9e3945118d3c16bd7e2813f98ec6e532d905f72
url: "https://pub.dev"
source: hosted
version: "2.1.0"
version: "2.2.1"
path_provider_foundation:
dependency: transitive
description:
name: path_provider_foundation
sha256: "1b744d3d774e5a879bb76d6cd1ecee2ba2c6960c03b1020cd35212f6aa267ac5"
sha256: "19314d595120f82aca0ba62787d58dde2cc6b5df7d2f0daf72489e38d1b57f2d"
url: "https://pub.dev"
source: hosted
version: "2.3.0"
version: "2.3.1"
path_provider_linux:
dependency: transitive
description:
name: path_provider_linux
sha256: ba2b77f0c52a33db09fc8caf85b12df691bf28d983e84cf87ff6d693cfa007b3
sha256: f7a1fe3a634fe7734c8d3f2766ad746ae2a2884abe22e241a8b301bf5cac3279
url: "https://pub.dev"
source: hosted
version: "2.2.0"
version: "2.2.1"
path_provider_platform_interface:
dependency: transitive
description:
name: path_provider_platform_interface
sha256: bced5679c7df11190e1ddc35f3222c858f328fff85c3942e46e7f5589bf9eb84
sha256: "94b1e0dd80970c1ce43d5d4e050a9918fce4f4a775e6142424c30a29a363265c"
url: "https://pub.dev"
source: hosted
version: "2.1.0"
version: "2.1.1"
path_provider_windows:
dependency: transitive
description:
name: path_provider_windows
sha256: ee0e0d164516b90ae1f970bdf29f726f1aa730d7cfc449ecc74c495378b705da
sha256: "8bc9f22eee8690981c22aa7fc602f5c85b497a6fb2ceb35ee5a5e5ed85ad8170"
url: "https://pub.dev"
source: hosted
version: "2.2.0"
version: "2.2.1"
permission_handler:
dependency: "direct main"
description:
name: permission_handler
sha256: "63e5216aae014a72fe9579ccd027323395ce7a98271d9defa9d57320d001af81"
sha256: "860c6b871c94c78e202dc69546d4d8fd84bd59faeb36f8fb9888668a53ff4f78"
url: "https://pub.dev"
source: hosted
version: "10.4.3"
version: "11.1.0"
permission_handler_android:
dependency: transitive
description:
name: permission_handler_android
sha256: "2ffaf52a21f64ac9b35fe7369bb9533edbd4f698e5604db8645b1064ff4cf221"
sha256: "2f1bec180ee2f5665c22faada971a8f024761f632e93ddc23310487df52dcfa6"
url: "https://pub.dev"
source: hosted
version: "10.3.3"
version: "12.0.1"
permission_handler_apple:
dependency: transitive
description:
name: permission_handler_apple
sha256: "99e220bce3f8877c78e4ace901082fb29fa1b4ebde529ad0932d8d664b34f3f5"
sha256: "1a816084338ada8d574b1cb48390e6e8b19305d5120fe3a37c98825bacc78306"
url: "https://pub.dev"
source: hosted
version: "9.1.4"
version: "9.2.0"
permission_handler_html:
dependency: transitive
description:
name: permission_handler_html
sha256: "11b762a8c123dced6461933a88ea1edbbe036078c3f9f41b08886e678e7864df"
url: "https://pub.dev"
source: hosted
version: "0.1.0+2"
permission_handler_platform_interface:
dependency: transitive
description:
name: permission_handler_platform_interface
sha256: "7c6b1500385dd1d2ca61bb89e2488ca178e274a69144d26bbd65e33eae7c02a9"
sha256: d87349312f7eaf6ce0adaf668daf700ac5b06af84338bd8b8574dfbd93ffe1a1
url: "https://pub.dev"
source: hosted
version: "3.11.3"
version: "4.0.2"
permission_handler_windows:
dependency: transitive
description:
name: permission_handler_windows
sha256: cc074aace208760f1eee6aa4fae766b45d947df85bc831cde77009cdb4720098
sha256: "1e8640c1e39121128da6b816d236e714d2cf17fac5a105dd6acdd3403a628004"
url: "https://pub.dev"
source: hosted
version: "0.1.3"
version: "0.2.0"
petitparser:
dependency: transitive
description:
name: petitparser
sha256: c15605cd28af66339f8eb6fbe0e541bfe2d1b72d5825efc6598f3e0a31b9ad27
url: "https://pub.dev"
source: hosted
version: "6.0.2"
platform:
dependency: transitive
description:
name: platform
sha256: "57c07bf82207aee366dfaa3867b3164e4f03a238a461a11b0e8a3a510d51203d"
sha256: "0a279f0707af40c890e80b1e9df8bb761694c074ba7e1d4ab1bc4b728e200b59"
url: "https://pub.dev"
source: hosted
version: "3.1.1"
version: "3.1.3"
platform_info:
dependency: transitive
description:
@@ -292,10 +364,10 @@ packages:
dependency: transitive
description:
name: plugin_platform_interface
sha256: "43798d895c929056255600343db8f049921cbec94d31ec87f1dc5c16c01935dd"
sha256: f4f88d4a900933e7267e2b353594774fc0d07fb072b47eedcd5b54e1ea3269f8
url: "https://pub.dev"
source: hosted
version: "2.1.5"
version: "2.1.7"
quiver:
dependency: transitive
description:
@@ -316,10 +388,10 @@ packages:
dependency: "direct main"
description:
name: shared_preferences
sha256: b7f41bad7e521d205998772545de63ff4e6c97714775902c199353f8bf1511ac
sha256: "81429e4481e1ccfb51ede496e916348668fd0921627779233bd24cc3ff6abd02"
url: "https://pub.dev"
source: hosted
version: "2.2.1"
version: "2.2.2"
shared_preferences_android:
dependency: transitive
description:
@@ -340,10 +412,10 @@ packages:
dependency: transitive
description:
name: shared_preferences_linux
sha256: c2eb5bf57a2fe9ad6988121609e47d3e07bb3bdca5b6f8444e4cf302428a128a
sha256: "9f2cbcf46d4270ea8be39fa156d86379077c8a5228d9dfdb1164ae0bb93f1faa"
url: "https://pub.dev"
source: hosted
version: "2.3.1"
version: "2.3.2"
shared_preferences_platform_interface:
dependency: transitive
description:
@@ -356,18 +428,18 @@ packages:
dependency: transitive
description:
name: shared_preferences_web
sha256: d762709c2bbe80626ecc819143013cc820fa49ca5e363620ee20a8b15a3e3daf
sha256: "7b15ffb9387ea3e237bb7a66b8a23d2147663d391cafc5c8f37b2e7b4bde5d21"
url: "https://pub.dev"
source: hosted
version: "2.2.1"
version: "2.2.2"
shared_preferences_windows:
dependency: transitive
description:
name: shared_preferences_windows
sha256: f763a101313bd3be87edffe0560037500967de9c394a714cd598d945517f694f
sha256: "841ad54f3c8381c480d0c9b508b89a34036f512482c407e6df7a9c4aa2ef8f59"
url: "https://pub.dev"
source: hosted
version: "2.3.1"
version: "2.3.2"
sky_engine:
dependency: transitive
description: flutter
@@ -385,18 +457,18 @@ packages:
dependency: transitive
description:
name: stack_trace
sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5
sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b"
url: "https://pub.dev"
source: hosted
version: "1.11.0"
version: "1.11.1"
stream_channel:
dependency: transitive
description:
name: stream_channel
sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8"
sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7
url: "https://pub.dev"
source: hosted
version: "2.1.1"
version: "2.1.2"
string_scanner:
dependency: transitive
description:
@@ -417,10 +489,10 @@ packages:
dependency: transitive
description:
name: test_api
sha256: "75760ffd7786fffdfb9597c35c5b27eaeec82be8edfb6d71d32651128ed7aab8"
sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b"
url: "https://pub.dev"
source: hosted
version: "0.6.0"
version: "0.6.1"
typed_data:
dependency: transitive
description:
@@ -433,74 +505,74 @@ packages:
dependency: "direct main"
description:
name: unity_ads_plugin
sha256: "2b19ff02089e5a0d1a6549a2cd9d2baf5f8733bdda296d947d411a293f0bffda"
sha256: "75b0b87697a9601971eacd2cd37458b88cf88f062af6f21c67c9fb28a11699d9"
url: "https://pub.dev"
source: hosted
version: "0.3.8"
version: "0.3.10"
url_launcher:
dependency: "direct main"
description:
name: url_launcher
sha256: "781bd58a1eb16069412365c98597726cd8810ae27435f04b3b4d3a470bacd61e"
sha256: e9aa5ea75c84cf46b3db4eea212523591211c3cf2e13099ee4ec147f54201c86
url: "https://pub.dev"
source: hosted
version: "6.1.12"
version: "6.2.2"
url_launcher_android:
dependency: transitive
description:
name: url_launcher_android
sha256: "3dd2388cc0c42912eee04434531a26a82512b9cb1827e0214430c9bcbddfe025"
sha256: "31222ffb0063171b526d3e569079cf1f8b294075ba323443fdc690842bfd4def"
url: "https://pub.dev"
source: hosted
version: "6.0.38"
version: "6.2.0"
url_launcher_ios:
dependency: transitive
description:
name: url_launcher_ios
sha256: "9af7ea73259886b92199f9e42c116072f05ff9bea2dcb339ab935dfc957392c2"
sha256: bba3373219b7abb6b5e0d071b0fe66dfbe005d07517a68e38d4fc3638f35c6d3
url: "https://pub.dev"
source: hosted
version: "6.1.4"
version: "6.2.1"
url_launcher_linux:
dependency: transitive
description:
name: url_launcher_linux
sha256: "207f4ddda99b95b4d4868320a352d374b0b7e05eefad95a4a26f57da413443f5"
sha256: "9f2d390e096fdbe1e6e6256f97851e51afc2d9c423d3432f1d6a02a8a9a8b9fd"
url: "https://pub.dev"
source: hosted
version: "3.0.5"
version: "3.1.0"
url_launcher_macos:
dependency: transitive
description:
name: url_launcher_macos
sha256: "1c4fdc0bfea61a70792ce97157e5cc17260f61abbe4f39354513f39ec6fd73b1"
sha256: b7244901ea3cf489c5335bdacda07264a6e960b1c1b1a9f91e4bc371d9e68234
url: "https://pub.dev"
source: hosted
version: "3.0.6"
version: "3.1.0"
url_launcher_platform_interface:
dependency: transitive
description:
name: url_launcher_platform_interface
sha256: bfdfa402f1f3298637d71ca8ecfe840b4696698213d5346e9d12d4ab647ee2ea
sha256: "980e8d9af422f477be6948bdfb68df8433be71f5743a188968b0c1b887807e50"
url: "https://pub.dev"
source: hosted
version: "2.1.3"
version: "2.2.0"
url_launcher_web:
dependency: transitive
description:
name: url_launcher_web
sha256: cc26720eefe98c1b71d85f9dc7ef0cada5132617046369d9dc296b3ecaa5cbb4
sha256: "7286aec002c8feecc338cc33269e96b73955ab227456e9fb2a91f7fab8a358e9"
url: "https://pub.dev"
source: hosted
version: "2.0.18"
version: "2.2.2"
url_launcher_windows:
dependency: transitive
description:
name: url_launcher_windows
sha256: "7967065dd2b5fccc18c653b97958fdf839c5478c28e767c61ee879f4e7882422"
sha256: "7754a1ad30ee896b265f8d14078b0513a4dba28d358eabb9d5f339886f4a1adc"
url: "https://pub.dev"
source: hosted
version: "3.0.7"
version: "3.1.0"
vector_math:
dependency: transitive
description:
@@ -509,62 +581,86 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.1.4"
wakelock_plus:
dependency: "direct main"
description:
name: wakelock_plus
sha256: f268ca2116db22e57577fb99d52515a24bdc1d570f12ac18bb762361d43b043d
url: "https://pub.dev"
source: hosted
version: "1.1.4"
wakelock_plus_platform_interface:
dependency: transitive
description:
name: wakelock_plus_platform_interface
sha256: "40fabed5da06caff0796dc638e1f07ee395fb18801fbff3255a2372db2d80385"
url: "https://pub.dev"
source: hosted
version: "1.1.0"
web:
dependency: transitive
description:
name: web
sha256: dc8ccd225a2005c1be616fe02951e2e342092edf968cf0844220383757ef8f10
sha256: afe077240a270dcfd2aafe77602b4113645af95d0ad31128cc02bce5ac5d5152
url: "https://pub.dev"
source: hosted
version: "0.1.4-beta"
version: "0.3.0"
webview_flutter:
dependency: "direct main"
description:
name: webview_flutter
sha256: "04a0782fb058b7c71f2048935583488f4d32e9147ca403abc4e58f1de9964629"
sha256: "42393b4492e629aa3a88618530a4a00de8bb46e50e7b3993fedbfdc5352f0dbf"
url: "https://pub.dev"
source: hosted
version: "4.2.3"
version: "4.4.2"
webview_flutter_android:
dependency: transitive
description:
name: webview_flutter_android
sha256: bca797abba472868655b5f1a6029c1132385685ee9db4713cb0e7f33076210c6
sha256: "8326ee235f87605a2bfc444a4abc897f4abc78d83f054ba7d3d1074ce82b4fbf"
url: "https://pub.dev"
source: hosted
version: "3.9.3"
version: "3.12.1"
webview_flutter_platform_interface:
dependency: transitive
description:
name: webview_flutter_platform_interface
sha256: "0ca3cfcc6781a7de701d580917af4a9efc4e3e129f8ead95a80587f0a749480a"
sha256: "68e86162aa8fc646ae859e1585995c096c95fc2476881fa0c4a8d10f56013a5a"
url: "https://pub.dev"
source: hosted
version: "2.5.0"
version: "2.8.0"
webview_flutter_wkwebview:
dependency: transitive
description:
name: webview_flutter_wkwebview
sha256: ed749f94ac9e814d04a258a9255cf69cfa4cc6006ff59542aea7fb4590144972
sha256: accdaaa49a2aca2dc3c3230907988954cdd23fed0a19525d6c9789d380f4dc76
url: "https://pub.dev"
source: hosted
version: "3.7.3"
version: "3.9.4"
win32:
dependency: transitive
description:
name: win32
sha256: "9e82a402b7f3d518fb9c02d0e9ae45952df31b9bf34d77baf19da2de03fc2aaa"
sha256: b0f37db61ba2f2e9b7a78a1caece0052564d1bc70668156cf3a29d676fe4e574
url: "https://pub.dev"
source: hosted
version: "5.0.7"
version: "5.1.1"
xdg_directories:
dependency: transitive
description:
name: xdg_directories
sha256: f0c26453a2d47aa4c2570c6a033246a3fc62da2fe23c7ffdd0a7495086dc0247
sha256: "589ada45ba9e39405c198fe34eb0f607cddb2108527e658136120892beac46d2"
url: "https://pub.dev"
source: hosted
version: "1.0.2"
version: "1.0.3"
xml:
dependency: transitive
description:
name: xml
sha256: b015a8ad1c488f66851d762d3090a21c600e479dc75e68328c52774040cf9226
url: "https://pub.dev"
source: hosted
version: "6.5.0"
xterm:
dependency: "direct main"
description:
@@ -574,5 +670,5 @@ packages:
source: hosted
version: "3.5.0"
sdks:
dart: ">=3.1.0 <4.0.0"
flutter: ">=3.10.0"
dart: ">=3.2.0 <4.0.0"
flutter: ">=3.16.0"

View File

@@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
version: 1.0.7+2
version: 1.0.12+2
environment:
sdk: '>=3.1.0 <4.0.0'
@@ -33,8 +33,8 @@ dependencies:
xterm: ^3.5.0
flutter_pty: ^0.4.0
path_provider: ^2.1.0
webview_flutter: ^4.2.3
permission_handler: ^10.4.3
webview_flutter: ^4.4.2
permission_handler: ^11.0.1
http: ^1.1.0
retry: ^3.1.2
url_launcher: ^6.1.12
@@ -42,6 +42,8 @@ dependencies:
intl: ^0.18.1 #日期字符串转换
unity_ads_plugin: ^0.3.8
clipboard: ^0.1.3
ffmpeg_kit_flutter_full_gpl: ^6.0.3
wakelock_plus: ^1.1.4
# The following adds the Cupertino Icons font to your application.
@@ -57,7 +59,7 @@ dev_dependencies:
# activated in the `analysis_options.yaml` file located at the root of your
# package. See that file for information about deactivating specific lint
# rules and activating additional ones.
flutter_lints: ^2.0.0
flutter_lints: ^3.0.1
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec

BIN
readme/img1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

BIN
readme/img2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 265 KiB

BIN
readme/img3.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 MiB

BIN
readme/img4.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 KiB

BIN
readme/img5.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 326 KiB

View File

@@ -10,6 +10,11 @@ include(${EPHEMERAL_DIR}/generated_config.cmake)
# https://github.com/flutter/flutter/issues/57146.
set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper")
# Set fallback configurations for older versions of the flutter tool.
if (NOT DEFINED FLUTTER_TARGET_PLATFORM)
set(FLUTTER_TARGET_PLATFORM "windows-x64")
endif()
# === Flutter Library ===
set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll")
@@ -92,7 +97,7 @@ add_custom_command(
COMMAND ${CMAKE_COMMAND} -E env
${FLUTTER_TOOL_ENVIRONMENT}
"${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat"
windows-x64 $<CONFIG>
${FLUTTER_TARGET_PLATFORM} $<CONFIG>
VERBATIM
)
add_custom_target(flutter_assemble DEPENDS