mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 07:14:28 +01:00
opt.: snippet result
This commit is contained in:
49
README.md
49
README.md
@@ -19,6 +19,15 @@ Especially thanks to <a href="https://github.com/TerminalStudio/dartssh2">dartss
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|
||||||
|
- [🔖 Feature](#-feature)
|
||||||
|
- [🏙️ ScreenShots](#️-screenshots)
|
||||||
|
- [⬇️ Download](#️-download)
|
||||||
|
- [🆘 Help](#-help)
|
||||||
|
- [🧱 Contribution](#-contribution)
|
||||||
|
- [🌍 l10n](#-l10n)
|
||||||
|
- [📝 License](#-license)
|
||||||
|
|
||||||
|
|
||||||
## 🔖 Feature
|
## 🔖 Feature
|
||||||
- [x] Functions
|
- [x] Functions
|
||||||
- [x] `SSH` Terminal, `SFTP`, `Docker & Pkg & Process`, Status chart, Code editor...
|
- [x] `SSH` Terminal, `SFTP`, `Docker & Pkg & Process`, Status chart, Code editor...
|
||||||
@@ -27,25 +36,6 @@ Especially thanks to <a href="https://github.com/TerminalStudio/dartssh2">dartss
|
|||||||
- [x] Platform support: `iOS / Android / macOS / Windows / Linux`
|
- [x] Platform support: `iOS / Android / macOS / Windows / Linux`
|
||||||
|
|
||||||
|
|
||||||
## ⬇️ Download
|
|
||||||
Platform | Support | Sign
|
|
||||||
--- | --- | ---
|
|
||||||
[iOS](https://apps.apple.com/app/id1586449703) / [Android](https://res.lolli.tech/serverbox/latest.apk) / [macOS](https://apps.apple.com/app/id1586449703) | Full | My own certificate
|
|
||||||
[Linux](https://res.lolli.tech/serverbox/latest.AppImage) / [Windows](https://res.lolli.tech/serverbox/latest.win.zip) | Not tested | Flutter default certificate
|
|
||||||
|
|
||||||
- Due to Chinese government policy and the [BEIAN](https://github.com/lollipopkit/flutter_server_box/discussions/180) issue. iOS app is now free. Please download it from other regions of AppStore.
|
|
||||||
- Security:
|
|
||||||
- To prevent injection attacks and etc., please don't download from untrusted sources.
|
|
||||||
- Since `Linux / Windows` is signed with flutter default certificate, it is recommended to **build it yourself**.
|
|
||||||
|
|
||||||
|
|
||||||
## 🆘 Help
|
|
||||||
- In order to push server status to your portable device without opening ServerBox app (Such as **message push** and **home widget**), you need to install [ServerBoxMonitor](https://github.com/lollipopkit/server_box_monitor) on your servers, and config it correctly. See [wiki](https://github.com/lollipopkit/server_box_monitor/wiki) for more details.
|
|
||||||
- **Common issues** can be found in [app wiki](https://github.com/lollipopkit/flutter_server_box/wiki).
|
|
||||||
- If you have **any question or feature request**, please open a [discussion](https://github.com/lollipopkit/flutter_server_box/discussions/new/choose).
|
|
||||||
- If ServerBox app has **any bug**, please open an [issue](https://github.com/lollipopkit/flutter_server_box/issues/new).
|
|
||||||
|
|
||||||
|
|
||||||
## 🏙️ ScreenShots
|
## 🏙️ ScreenShots
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -75,10 +65,29 @@ Platform | Support | Sign
|
|||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
|
||||||
|
## ⬇️ Download
|
||||||
|
Platform | Support | Sign
|
||||||
|
--- | --- | ---
|
||||||
|
[iOS](https://apps.apple.com/app/id1586449703) / [Android](https://res.lolli.tech/serverbox/latest.apk) / [macOS](https://apps.apple.com/app/id1586449703) | Full | My own certificate
|
||||||
|
[Linux](https://res.lolli.tech/serverbox/latest.AppImage) / [Windows](https://res.lolli.tech/serverbox/latest.win.zip) | Not tested | Flutter default certificate
|
||||||
|
|
||||||
|
- Due to Chinese government policy and the [BEIAN](https://github.com/lollipopkit/flutter_server_box/discussions/180) issue. iOS app is now free. Please download it from other regions of AppStore.
|
||||||
|
- Security:
|
||||||
|
- To prevent injection attacks and etc., please don't download from untrusted sources.
|
||||||
|
- Since `Linux / Windows` is signed with flutter default certificate, it is recommended to **build it yourself**.
|
||||||
|
|
||||||
|
|
||||||
|
## 🆘 Help
|
||||||
|
- In order to push server status to your portable device without opening ServerBox app (Such as **message push** and **home widget**), you need to install [ServerBoxMonitor](https://github.com/lollipopkit/server_box_monitor) on your servers, and config it correctly. See [wiki](https://github.com/lollipopkit/server_box_monitor/wiki) for more details.
|
||||||
|
- **Common issues** can be found in [app wiki](https://github.com/lollipopkit/flutter_server_box/wiki).
|
||||||
|
- If you have **any question or feature request**, please open a [discussion](https://github.com/lollipopkit/flutter_server_box/discussions/new/choose).
|
||||||
|
- If ServerBox app has **any bug**, please open an [issue](https://github.com/lollipopkit/flutter_server_box/issues/new).
|
||||||
|
|
||||||
|
|
||||||
## 🧱 Contribution
|
## 🧱 Contribution
|
||||||
**Any positive contribution is welcome**.
|
**Any positive contribution is welcome**.
|
||||||
|
|
||||||
### l10n guide
|
### 🌍 l10n
|
||||||
1. Fork this repo and clone forked repo to your local machine.
|
1. Fork this repo and clone forked repo to your local machine.
|
||||||
2. Create `arb` file in `lib/l10n/` directory
|
2. Create `arb` file in `lib/l10n/` directory
|
||||||
- File name should be `intl_XX.arb`, where `XX` is the language code. Such as `intl_en.arb` for English and `intl_zh.arb` for Chinese.
|
- File name should be `intl_XX.arb`, where `XX` is the language code. Such as `intl_en.arb` for English and `intl_zh.arb` for Chinese.
|
||||||
|
|||||||
48
README_zh.md
48
README_zh.md
@@ -18,6 +18,14 @@
|
|||||||
特别感谢 <a href="https://github.com/TerminalStudio/dartssh2">dartssh2</a> & <a href="https://github.com/TerminalStudio/xterm.dart">xterm.dart</a>。
|
特别感谢 <a href="https://github.com/TerminalStudio/dartssh2">dartssh2</a> & <a href="https://github.com/TerminalStudio/xterm.dart">xterm.dart</a>。
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
- [🔖 特点](#-特点)
|
||||||
|
- [🏙️ 截屏](#️-截屏)
|
||||||
|
- [⬇️ 下载](#️-下载)
|
||||||
|
- [🆘 帮助](#-帮助)
|
||||||
|
- [🧱 贡献](#-贡献)
|
||||||
|
- [🌍 l10n](#-l10n)
|
||||||
|
- [📝 协议](#-协议)
|
||||||
|
|
||||||
|
|
||||||
## 🔖 特点
|
## 🔖 特点
|
||||||
- [x] 功能
|
- [x] 功能
|
||||||
@@ -27,25 +35,6 @@
|
|||||||
- [x] 全平台支持(除 `Web`)
|
- [x] 全平台支持(除 `Web`)
|
||||||
|
|
||||||
|
|
||||||
## ⬇️ 下载
|
|
||||||
平台 | 支持 | 签名
|
|
||||||
:-: | :-: | :-:
|
|
||||||
[iOS](https://apps.apple.com/app/id1586449703) / [Android](https://res.lolli.tech/serverbox/latest.apk) / [macOS](https://apps.apple.com/app/id1586449703) | 完整 | 个人可信签名
|
|
||||||
[Linux](https://res.lolli.tech/serverbox/latest.AppImage) / [Windows](https://res.lolli.tech/serverbox/latest.win.zip) | 未测试 | Flutter 默认签名
|
|
||||||
|
|
||||||
- 由于中国政策原因,且**目前**无法完成[备案](https://github.com/lollipopkit/flutter_server_box/discussions/180)。iOS 端现已转为免费,请移步 AppStore 其他区下载。
|
|
||||||
- 关于安全:
|
|
||||||
- 为了防止注入攻击等因素,请勿从不可信来源下载。
|
|
||||||
- 由于 `Linux / Windows` 使用了默认签名,因此建议**自行构建**。
|
|
||||||
|
|
||||||
|
|
||||||
## 🆘 帮助
|
|
||||||
- 为了可以在不使用 ServerBox app 时获取服务器状态(例如:桌面小部件、推送服务),你需要在你的服务器上安装 [ServerBoxMonitor](https://github.com/lollipopkit/server_box_monitor),并且正确配置,详情可见 [wiki](https://github.com/lollipopkit/server_box_monitor/wiki/%E4%B8%BB%E9%A1%B5)。
|
|
||||||
- **常见问题**可以在 [app wiki](https://github.com/lollipopkit/flutter_server_box/wiki/主页) 查看。
|
|
||||||
- 如果你有**任何问题或者功能请求**,请在 [讨论](https://github.com/lollipopkit/flutter_server_box/discussions/new/choose) 中交流。
|
|
||||||
- 如果 ServerBox app 有**任何 bug**,请在 [问题](https://github.com/lollipopkit/flutter_server_box/issues/new) 中反馈。
|
|
||||||
|
|
||||||
|
|
||||||
## 🏙️ 截屏
|
## 🏙️ 截屏
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -75,10 +64,29 @@
|
|||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
|
||||||
|
## ⬇️ 下载
|
||||||
|
平台 | 支持 | 签名
|
||||||
|
:-: | :-: | :-:
|
||||||
|
[iOS](https://apps.apple.com/app/id1586449703) / [Android](https://res.lolli.tech/serverbox/latest.apk) / [macOS](https://apps.apple.com/app/id1586449703) | 完整 | 个人可信签名
|
||||||
|
[Linux](https://res.lolli.tech/serverbox/latest.AppImage) / [Windows](https://res.lolli.tech/serverbox/latest.win.zip) | 未测试 | Flutter 默认签名
|
||||||
|
|
||||||
|
- 由于中国政策原因,且**目前**无法完成[备案](https://github.com/lollipopkit/flutter_server_box/discussions/180)。iOS 端现已转为免费,请移步 AppStore 其他区下载。
|
||||||
|
- 关于安全:
|
||||||
|
- 为了防止注入攻击等因素,请勿从不可信来源下载。
|
||||||
|
- 由于 `Linux / Windows` 使用了默认签名,因此建议**自行构建**。
|
||||||
|
|
||||||
|
|
||||||
|
## 🆘 帮助
|
||||||
|
- 为了可以在不使用 ServerBox app 时获取服务器状态(例如:桌面小部件、推送服务),你需要在你的服务器上安装 [ServerBoxMonitor](https://github.com/lollipopkit/server_box_monitor),并且正确配置,详情可见 [wiki](https://github.com/lollipopkit/server_box_monitor/wiki/%E4%B8%BB%E9%A1%B5)。
|
||||||
|
- **常见问题**可以在 [app wiki](https://github.com/lollipopkit/flutter_server_box/wiki/主页) 查看。
|
||||||
|
- 如果你有**任何问题或者功能请求**,请在 [讨论](https://github.com/lollipopkit/flutter_server_box/discussions/new/choose) 中交流。
|
||||||
|
- 如果 ServerBox app 有**任何 bug**,请在 [问题](https://github.com/lollipopkit/flutter_server_box/issues/new) 中反馈。
|
||||||
|
|
||||||
|
|
||||||
## 🧱 贡献
|
## 🧱 贡献
|
||||||
**任何正面的贡献都欢迎**。
|
**任何正面的贡献都欢迎**。
|
||||||
|
|
||||||
### l10n
|
### 🌍 l10n
|
||||||
1. Fork 本项目,并 Clone 你 Fork 的项目至你的电脑
|
1. Fork 本项目,并 Clone 你 Fork 的项目至你的电脑
|
||||||
2. 在 `lib/l10n/` 文件夹内创建 `.arb` 本地化文件
|
2. 在 `lib/l10n/` 文件夹内创建 `.arb` 本地化文件
|
||||||
- 文件名应该类似 `intl_XX.arb`, `XX` 是语言标识码。 例如 `intl_en.arb` 是给英语的, `intl_zh.arb` 是给中文的
|
- 文件名应该类似 `intl_XX.arb`, `XX` 是语言标识码。 例如 `intl_en.arb` 是给英语的, `intl_zh.arb` 是给中文的
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import 'package:toolbox/view/page/private_key/list.dart';
|
|||||||
import 'package:toolbox/view/page/server/detail.dart';
|
import 'package:toolbox/view/page/server/detail.dart';
|
||||||
import 'package:toolbox/view/page/setting/android.dart';
|
import 'package:toolbox/view/page/setting/android.dart';
|
||||||
import 'package:toolbox/view/page/setting/ios.dart';
|
import 'package:toolbox/view/page/setting/ios.dart';
|
||||||
|
import 'package:toolbox/view/page/snippet/result.dart';
|
||||||
import 'package:toolbox/view/page/ssh_term.dart';
|
import 'package:toolbox/view/page/ssh_term.dart';
|
||||||
import 'package:toolbox/view/page/setting/virt_key.dart';
|
import 'package:toolbox/view/page/setting/virt_key.dart';
|
||||||
import 'package:toolbox/view/page/storage/local.dart';
|
import 'package:toolbox/view/page/storage/local.dart';
|
||||||
@@ -207,4 +208,13 @@ class AppRoute {
|
|||||||
static AppRoute androidSettings({Key? key}) {
|
static AppRoute androidSettings({Key? key}) {
|
||||||
return AppRoute(AndroidSettingsPage(key: key), 'android_setting');
|
return AppRoute(AndroidSettingsPage(key: key), 'android_setting');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static AppRoute snippetResult({Key? key, required Map<String, String?> results}) {
|
||||||
|
return AppRoute(
|
||||||
|
SnippetResultPage(
|
||||||
|
key: key,
|
||||||
|
results: results,
|
||||||
|
),
|
||||||
|
'snippet_result');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,12 +45,3 @@ class Snippet implements TagPickable {
|
|||||||
@override
|
@override
|
||||||
String get tagName => name;
|
String get tagName => name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Snippet for installing ServerBoxMonitor
|
|
||||||
const installSBM = Snippet(
|
|
||||||
name: 'Install ServerBoxMonitor',
|
|
||||||
script:
|
|
||||||
'curl -fsSL https://raw.githubusercontent.com/lollipopkit/server_box_monitor/main/install.sh | sh -s -- install',
|
|
||||||
tags: ['ServerBoxMonitor'],
|
|
||||||
note: 'One click script to install ServerBoxMonitor',
|
|
||||||
);
|
|
||||||
|
|||||||
@@ -26,20 +26,9 @@ class SnippetProvider extends ChangeNotifier {
|
|||||||
Stores.setting.snippetOrder.put(order);
|
Stores.setting.snippetOrder.put(order);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_addInternal();
|
|
||||||
_updateTags();
|
_updateTags();
|
||||||
}
|
}
|
||||||
|
|
||||||
void _addInternal() {
|
|
||||||
if (!Stores.first.iSSBM.fetch() ||
|
|
||||||
_snippets.any((e) => e.name == installSBM.name)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_snippets.add(installSBM);
|
|
||||||
Stores.snippet.put(installSBM);
|
|
||||||
Stores.first.iSSBM.put(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
void _updateTags() {
|
void _updateTags() {
|
||||||
_tags.clear();
|
_tags.clear();
|
||||||
final tags = <String>{};
|
final tags = <String>{};
|
||||||
|
|||||||
@@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
class BuildData {
|
class BuildData {
|
||||||
static const String name = "ServerBox";
|
static const String name = "ServerBox";
|
||||||
static const int build = 599;
|
static const int build = 601;
|
||||||
static const String engine = "3.13.7";
|
static const String engine = "3.13.7";
|
||||||
static const String buildAt = "2023-10-15 21:24:51";
|
static const String buildAt = "2023-10-17 20:28:10";
|
||||||
static const int modifications = 4;
|
static const int modifications = 4;
|
||||||
static const int script = 21;
|
static const int script = 21;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,9 +4,6 @@ import 'package:toolbox/core/persistant_store.dart';
|
|||||||
class FirstStore extends PersistentStore<bool> {
|
class FirstStore extends PersistentStore<bool> {
|
||||||
FirstStore() : super('first');
|
FirstStore() : super('first');
|
||||||
|
|
||||||
/// Add Snippet `Install ServerBoxMonitor`
|
|
||||||
late final iSSBM = StoreProperty(box, 'installMonitorSnippet', true);
|
|
||||||
|
|
||||||
/// Show tip of suspend
|
/// Show tip of suspend
|
||||||
late final showSuspendTip = StoreProperty(box, 'showSuspendTip', true);
|
late final showSuspendTip = StoreProperty(box, 'showSuspendTip', true);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import 'package:toolbox/core/extension/order.dart';
|
|||||||
import 'package:toolbox/data/res/provider.dart';
|
import 'package:toolbox/data/res/provider.dart';
|
||||||
import 'package:toolbox/data/res/store.dart';
|
import 'package:toolbox/data/res/store.dart';
|
||||||
|
|
||||||
import '../../../core/utils/misc.dart';
|
|
||||||
import '../../../data/model/server/server.dart';
|
import '../../../data/model/server/server.dart';
|
||||||
import '../../../data/model/server/snippet.dart';
|
import '../../../data/model/server/snippet.dart';
|
||||||
import '../../../data/res/ui.dart';
|
import '../../../data/res/ui.dart';
|
||||||
@@ -135,23 +134,15 @@ class _SnippetListPageState extends State<SnippetListPage> {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final ids = servers.map((e) => e.spi.id).toList();
|
final ids = servers.map((e) => e.spi.id).toList();
|
||||||
|
final names = servers.map((e) => e.spi.name).toList();
|
||||||
final results = await Pros.server.runSnippetsMulti(ids, [snippet]);
|
final results = await Pros.server.runSnippetsMulti(ids, [snippet]);
|
||||||
if (results.isNotEmpty) {
|
if (results.isNotEmpty) {
|
||||||
// SERVER_NAME: RESULT
|
// SERVER_NAME: RESULT
|
||||||
final result = Map.fromIterables(
|
final result = Map.fromIterables(
|
||||||
ids,
|
names,
|
||||||
results,
|
results,
|
||||||
).entries.map((e) => '${e.key}:\n${e.value}').join('\n');
|
|
||||||
context.showRoundDialog(
|
|
||||||
title: Text(l10n.result),
|
|
||||||
child: Text(result),
|
|
||||||
actions: [
|
|
||||||
TextButton(
|
|
||||||
onPressed: () => copy2Clipboard(result),
|
|
||||||
child: Text(l10n.copy),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
);
|
);
|
||||||
|
AppRoute.snippetResult(results: result).go(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
47
lib/view/page/snippet/result.dart
Normal file
47
lib/view/page/snippet/result.dart
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:toolbox/core/extension/context/locale.dart';
|
||||||
|
import 'package:toolbox/view/widget/cardx.dart';
|
||||||
|
import 'package:toolbox/view/widget/custom_appbar.dart';
|
||||||
|
import 'package:toolbox/view/widget/expand_tile.dart';
|
||||||
|
|
||||||
|
class SnippetResultPage extends StatelessWidget {
|
||||||
|
final Map<String, String?> results;
|
||||||
|
|
||||||
|
const SnippetResultPage({super.key, required this.results});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
appBar: CustomAppBar(
|
||||||
|
title: Text(l10n.result),
|
||||||
|
),
|
||||||
|
body: _buildBody(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildBody() {
|
||||||
|
return Align(
|
||||||
|
alignment: Alignment.centerLeft,
|
||||||
|
child: ListView.builder(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 17),
|
||||||
|
itemCount: results.length,
|
||||||
|
itemBuilder: (_, index) {
|
||||||
|
final key = results.keys.elementAt(index);
|
||||||
|
final value = results[key];
|
||||||
|
return CardX(
|
||||||
|
ExpandTile(
|
||||||
|
initiallyExpanded: results.length == 1,
|
||||||
|
title: Text(key),
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
value ?? '',
|
||||||
|
textAlign: TextAlign.start,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user