Repository: lollipopkit/flutter_server_box Branch: main Commit: 1bea565c2180 Files: 636 Total size: 2.9 MB Directory structure: gitextract_qpo112k4/ ├── .github/ │ ├── FUNDING.yml │ ├── ISSUE_TEMPLATE/ │ │ ├── bug_report.md │ │ └── bug_report_cn.md │ └── workflows/ │ ├── analysis.yml │ └── release.yml ├── .gitignore ├── .gitmodules ├── .metadata ├── .vscode/ │ └── launch.json ├── CLAUDE.md ├── LICENSE ├── README.md ├── README_zh.md ├── analysis_options.yaml ├── android/ │ ├── .gitignore │ ├── app/ │ │ ├── build.gradle │ │ ├── proguard-rules.pro │ │ └── src/ │ │ └── main/ │ │ ├── AndroidManifest.xml │ │ ├── kotlin/ │ │ │ └── tech/ │ │ │ └── lolli/ │ │ │ └── toolbox/ │ │ │ ├── ForegroundService.kt │ │ │ ├── MainActivity.kt │ │ │ └── widget/ │ │ │ ├── HomeWidget.kt │ │ │ └── WidgetConfigureActivity.kt │ │ └── res/ │ │ ├── drawable/ │ │ │ ├── launch_background.xml │ │ │ ├── memory_24.xml │ │ │ ├── net_24.xml │ │ │ ├── settings_24.xml │ │ │ ├── speed_24.xml │ │ │ ├── storage_24.xml │ │ │ └── widget_background.xml │ │ ├── drawable-night/ │ │ │ └── launch_background.xml │ │ ├── drawable-night-v21/ │ │ │ └── launch_background.xml │ │ ├── drawable-v21/ │ │ │ └── launch_background.xml │ │ ├── layout/ │ │ │ ├── home_widget.xml │ │ │ └── widget_configure.xml │ │ ├── mipmap-anydpi-v26/ │ │ │ ├── ic_launcher.xml │ │ │ └── ic_launcher_round.xml │ │ ├── values/ │ │ │ ├── colors.xml │ │ │ ├── ic_launcher_background.xml │ │ │ ├── strings.xml │ │ │ └── styles.xml │ │ ├── values-night/ │ │ │ ├── colors.xml │ │ │ ├── ic_launcher_background.xml │ │ │ └── styles.xml │ │ └── xml/ │ │ ├── backup_rules.xml │ │ └── home_widget.xml │ ├── build.gradle │ ├── gradle/ │ │ └── wrapper/ │ │ └── gradle-wrapper.properties │ ├── gradle.properties │ └── settings.gradle ├── coverage/ │ └── lcov.info ├── devtools_options.yaml ├── docs/ │ ├── .gitignore │ ├── .vscode/ │ │ ├── extensions.json │ │ └── launch.json │ ├── README.md │ ├── astro.config.mjs │ ├── package.json │ ├── src/ │ │ ├── content/ │ │ │ └── docs/ │ │ │ ├── advanced/ │ │ │ │ ├── bulk-import.md │ │ │ │ ├── custom-commands.md │ │ │ │ ├── custom-logo.md │ │ │ │ ├── json-settings.md │ │ │ │ ├── troubleshooting.md │ │ │ │ └── widgets.md │ │ │ ├── de/ │ │ │ │ ├── advanced/ │ │ │ │ │ ├── bulk-import.md │ │ │ │ │ ├── custom-commands.md │ │ │ │ │ ├── custom-logo.md │ │ │ │ │ ├── json-settings.md │ │ │ │ │ ├── troubleshooting.md │ │ │ │ │ └── widgets.md │ │ │ │ ├── development/ │ │ │ │ │ ├── architecture.md │ │ │ │ │ ├── building.md │ │ │ │ │ ├── codegen.md │ │ │ │ │ ├── state.md │ │ │ │ │ ├── structure.md │ │ │ │ │ └── testing.md │ │ │ │ ├── index.mdx │ │ │ │ ├── installation.mdx │ │ │ │ ├── introduction.mdx │ │ │ │ ├── platforms/ │ │ │ │ │ ├── desktop.md │ │ │ │ │ └── mobile.md │ │ │ │ ├── principles/ │ │ │ │ │ ├── architecture.md │ │ │ │ │ ├── sftp.md │ │ │ │ │ ├── ssh.md │ │ │ │ │ ├── state.md │ │ │ │ │ └── terminal.md │ │ │ │ └── quick-start.mdx │ │ │ ├── development/ │ │ │ │ ├── architecture.md │ │ │ │ ├── building.md │ │ │ │ ├── codegen.md │ │ │ │ ├── state.md │ │ │ │ ├── structure.md │ │ │ │ └── testing.md │ │ │ ├── es/ │ │ │ │ ├── advanced/ │ │ │ │ │ ├── bulk-import.md │ │ │ │ │ ├── custom-commands.md │ │ │ │ │ ├── custom-logo.md │ │ │ │ │ ├── json-settings.md │ │ │ │ │ ├── troubleshooting.md │ │ │ │ │ └── widgets.md │ │ │ │ ├── development/ │ │ │ │ │ ├── architecture.md │ │ │ │ │ ├── building.md │ │ │ │ │ ├── codegen.md │ │ │ │ │ ├── state.md │ │ │ │ │ ├── structure.md │ │ │ │ │ └── testing.md │ │ │ │ ├── index.mdx │ │ │ │ ├── installation.mdx │ │ │ │ ├── introduction.mdx │ │ │ │ ├── platforms/ │ │ │ │ │ ├── desktop.md │ │ │ │ │ └── mobile.md │ │ │ │ ├── principles/ │ │ │ │ │ ├── architecture.md │ │ │ │ │ ├── sftp.md │ │ │ │ │ ├── ssh.md │ │ │ │ │ ├── state.md │ │ │ │ │ └── terminal.md │ │ │ │ └── quick-start.mdx │ │ │ ├── fr/ │ │ │ │ ├── advanced/ │ │ │ │ │ ├── bulk-import.md │ │ │ │ │ ├── custom-commands.md │ │ │ │ │ ├── custom-logo.md │ │ │ │ │ ├── json-settings.md │ │ │ │ │ ├── troubleshooting.md │ │ │ │ │ └── widgets.md │ │ │ │ ├── development/ │ │ │ │ │ ├── architecture.md │ │ │ │ │ ├── building.md │ │ │ │ │ ├── codegen.md │ │ │ │ │ ├── state.md │ │ │ │ │ ├── structure.md │ │ │ │ │ └── testing.md │ │ │ │ ├── index.mdx │ │ │ │ ├── installation.mdx │ │ │ │ ├── introduction.mdx │ │ │ │ ├── platforms/ │ │ │ │ │ ├── desktop.md │ │ │ │ │ └── mobile.md │ │ │ │ ├── principles/ │ │ │ │ │ ├── architecture.md │ │ │ │ │ ├── sftp.md │ │ │ │ │ ├── ssh.md │ │ │ │ │ ├── state.md │ │ │ │ │ └── terminal.md │ │ │ │ └── quick-start.mdx │ │ │ ├── index.mdx │ │ │ ├── installation.mdx │ │ │ ├── introduction.mdx │ │ │ ├── ja/ │ │ │ │ ├── advanced/ │ │ │ │ │ ├── bulk-import.md │ │ │ │ │ ├── custom-commands.md │ │ │ │ │ ├── custom-logo.md │ │ │ │ │ ├── json-settings.md │ │ │ │ │ ├── troubleshooting.md │ │ │ │ │ └── widgets.md │ │ │ │ ├── development/ │ │ │ │ │ ├── architecture.md │ │ │ │ │ ├── building.md │ │ │ │ │ ├── codegen.md │ │ │ │ │ ├── state.md │ │ │ │ │ ├── structure.md │ │ │ │ │ └── testing.md │ │ │ │ ├── index.mdx │ │ │ │ ├── installation.mdx │ │ │ │ ├── introduction.mdx │ │ │ │ ├── platforms/ │ │ │ │ │ ├── desktop.md │ │ │ │ │ └── mobile.md │ │ │ │ ├── principles/ │ │ │ │ │ ├── architecture.md │ │ │ │ │ ├── sftp.md │ │ │ │ │ ├── ssh.md │ │ │ │ │ ├── state.md │ │ │ │ │ └── terminal.md │ │ │ │ └── quick-start.mdx │ │ │ ├── platforms/ │ │ │ │ ├── desktop.md │ │ │ │ └── mobile.md │ │ │ ├── principles/ │ │ │ │ ├── architecture.md │ │ │ │ ├── sftp.md │ │ │ │ ├── ssh.md │ │ │ │ ├── state.md │ │ │ │ └── terminal.md │ │ │ ├── quick-start.mdx │ │ │ └── zh/ │ │ │ ├── advanced/ │ │ │ │ ├── bulk-import.md │ │ │ │ ├── custom-commands.md │ │ │ │ ├── custom-logo.md │ │ │ │ ├── json-settings.md │ │ │ │ ├── troubleshooting.md │ │ │ │ └── widgets.md │ │ │ ├── development/ │ │ │ │ ├── architecture.md │ │ │ │ ├── building.md │ │ │ │ ├── codegen.md │ │ │ │ ├── state.md │ │ │ │ ├── structure.md │ │ │ │ └── testing.md │ │ │ ├── index.mdx │ │ │ ├── installation.mdx │ │ │ ├── introduction.mdx │ │ │ ├── platforms/ │ │ │ │ ├── desktop.md │ │ │ │ └── mobile.md │ │ │ ├── principles/ │ │ │ │ ├── architecture.md │ │ │ │ ├── sftp.md │ │ │ │ ├── ssh.md │ │ │ │ ├── state.md │ │ │ │ └── terminal.md │ │ │ └── quick-start.mdx │ │ ├── content.config.ts │ │ └── styles/ │ │ └── custom.css │ └── tsconfig.json ├── fastlane/ │ └── metadata/ │ └── android/ │ ├── en-US/ │ │ ├── full_description.txt │ │ ├── short_description.txt │ │ └── title.txt │ ├── ru/ │ │ ├── full_description.txt │ │ └── short_description.txt │ └── zh-CN/ │ ├── full_description.txt │ ├── short_description.txt │ └── title.txt ├── fl_build.json ├── ios/ │ ├── .gitignore │ ├── Flutter/ │ │ ├── AppFrameworkInfo.plist │ │ ├── Debug.xcconfig │ │ └── Release.xcconfig │ ├── Podfile │ ├── PrivacyInfo.xcprivacy │ ├── Runner/ │ │ ├── AppDelegate.swift │ │ ├── Assets.xcassets/ │ │ │ ├── AppIcon.appiconset/ │ │ │ │ └── Contents.json │ │ │ ├── Contents.json │ │ │ ├── LaunchBackground.imageset/ │ │ │ │ └── Contents.json │ │ │ └── LaunchImage.imageset/ │ │ │ └── Contents.json │ │ ├── Base.lproj/ │ │ │ ├── LaunchScreen.storyboard │ │ │ └── Main.storyboard │ │ ├── Info-Debug.plist │ │ ├── Info-Profile.plist │ │ ├── Info-Release.plist │ │ ├── LiveActivityManager.swift │ │ ├── PrivacyInfo.xcprivacy │ │ ├── Runner-Bridging-Header.h │ │ ├── Runner.entitlements │ │ ├── TerminalLiveActivityAttributes.swift │ │ ├── Utils.swift │ │ ├── de.lproj/ │ │ │ ├── LaunchScreen.strings │ │ │ ├── Localizable.strings │ │ │ └── Main.strings │ │ ├── en.lproj/ │ │ │ └── Localizable.strings │ │ ├── es.lproj/ │ │ │ ├── LaunchScreen.strings │ │ │ ├── Localizable.strings │ │ │ └── Main.strings │ │ ├── fr.lproj/ │ │ │ ├── LaunchScreen.strings │ │ │ ├── Localizable.strings │ │ │ └── Main.strings │ │ ├── id.lproj/ │ │ │ ├── LaunchScreen.strings │ │ │ ├── Localizable.strings │ │ │ └── Main.strings │ │ ├── ja.lproj/ │ │ │ ├── LaunchScreen.strings │ │ │ ├── Localizable.strings │ │ │ └── Main.strings │ │ ├── pt-BR.lproj/ │ │ │ ├── LaunchScreen.strings │ │ │ ├── Localizable.strings │ │ │ └── Main.strings │ │ ├── ru.lproj/ │ │ │ ├── LaunchScreen.strings │ │ │ ├── Localizable.strings │ │ │ └── Main.strings │ │ ├── zh-Hans.lproj/ │ │ │ ├── LaunchScreen.strings │ │ │ ├── Localizable.strings │ │ │ └── Main.strings │ │ └── zh-Hant.lproj/ │ │ ├── LaunchScreen.strings │ │ ├── Localizable.strings │ │ └── Main.strings │ ├── Runner.xcodeproj/ │ │ ├── project.pbxproj │ │ ├── project.xcworkspace/ │ │ │ ├── contents.xcworkspacedata │ │ │ └── xcshareddata/ │ │ │ ├── IDEWorkspaceChecks.plist │ │ │ └── WorkspaceSettings.xcsettings │ │ └── xcshareddata/ │ │ └── xcschemes/ │ │ ├── Runner.xcscheme │ │ ├── StatusWidgetExtension.xcscheme │ │ └── WatchApp.xcscheme │ ├── Runner.xcworkspace/ │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata/ │ │ ├── IDEWorkspaceChecks.plist │ │ └── WorkspaceSettings.xcsettings │ ├── StatusWidget/ │ │ ├── Base.lproj/ │ │ │ └── StatusWidget.intentdefinition │ │ ├── Info.plist │ │ ├── PrivacyInfo.xcprivacy │ │ ├── StatusWidget.swift │ │ ├── StatusWidgetBundle.swift │ │ ├── TerminalLiveActivity.swift │ │ ├── TerminalLiveActivityAttributes.swift │ │ ├── de.lproj/ │ │ │ ├── Localizable.strings │ │ │ └── StatusWidget.strings │ │ ├── en.lproj/ │ │ │ ├── Localizable.strings │ │ │ └── StatusWidget.strings │ │ ├── es.lproj/ │ │ │ ├── Localizable.strings │ │ │ └── StatusWidget.strings │ │ ├── fr.lproj/ │ │ │ ├── Localizable.strings │ │ │ └── StatusWidget.strings │ │ ├── id.lproj/ │ │ │ ├── Localizable.strings │ │ │ └── StatusWidget.strings │ │ ├── ja.lproj/ │ │ │ ├── Localizable.strings │ │ │ └── StatusWidget.strings │ │ ├── pt-BR.lproj/ │ │ │ ├── Localizable.strings │ │ │ └── StatusWidget.strings │ │ ├── ru.lproj/ │ │ │ ├── Localizable.strings │ │ │ └── StatusWidget.strings │ │ ├── zh-Hans.lproj/ │ │ │ ├── Localizable.strings │ │ │ └── StatusWidget.strings │ │ └── zh-Hant.lproj/ │ │ ├── Localizable.strings │ │ └── StatusWidget.strings │ ├── WatchApp/ │ │ ├── ContentView.swift │ │ ├── PhoneConnMgr.swift │ │ ├── PrivacyInfo.xcprivacy │ │ ├── Store.swift │ │ ├── Watch.xcassets/ │ │ │ ├── AccentColor.colorset/ │ │ │ │ └── Contents.json │ │ │ ├── AppIcon.appiconset/ │ │ │ │ └── Contents.json │ │ │ └── Contents.json │ │ └── WatchEndApp.swift │ ├── WatchWidget/ │ │ ├── WatchStatusWidget.swift │ │ └── WatchStatusWidgetBundle.swift │ └── build/ │ └── Pods.build/ │ └── Release-iphonesimulator/ │ ├── Flutter.build/ │ │ └── dgph │ ├── GZ-NMSSH.build/ │ │ └── dgph │ ├── Pods-Runner.build/ │ │ └── dgph │ ├── countly_flutter.build/ │ │ └── dgph │ ├── path_provider.build/ │ │ └── dgph │ ├── ssh2.build/ │ │ └── dgph │ └── url_launcher.build/ │ └── dgph ├── l10n.yaml ├── lib/ │ ├── app.dart │ ├── core/ │ │ ├── app_navigator.dart │ │ ├── chan.dart │ │ ├── extension/ │ │ │ ├── context/ │ │ │ │ └── locale.dart │ │ │ ├── server.dart │ │ │ ├── sftpfile.dart │ │ │ └── ssh_client.dart │ │ ├── route.dart │ │ ├── service/ │ │ │ └── ssh_discovery.dart │ │ ├── sync.dart │ │ └── utils/ │ │ ├── comparator.dart │ │ ├── host_key_helper.dart │ │ ├── jump_chain.dart │ │ ├── misc.dart │ │ ├── server.dart │ │ ├── server_dedup.dart │ │ ├── ssh_auth.dart │ │ └── ssh_config.dart │ ├── data/ │ │ ├── helper/ │ │ │ ├── ssh_decoder.dart │ │ │ └── system_detector.dart │ │ ├── model/ │ │ │ ├── ai/ │ │ │ │ └── ask_ai_models.dart │ │ │ ├── app/ │ │ │ │ ├── bak/ │ │ │ │ │ ├── backup.dart │ │ │ │ │ ├── backup.g.dart │ │ │ │ │ ├── backup2.dart │ │ │ │ │ ├── backup2.freezed.dart │ │ │ │ │ ├── backup2.g.dart │ │ │ │ │ ├── backup_service.dart │ │ │ │ │ ├── backup_source.dart │ │ │ │ │ └── utils.dart │ │ │ │ ├── error.dart │ │ │ │ ├── menu/ │ │ │ │ │ ├── base.dart │ │ │ │ │ ├── container.dart │ │ │ │ │ ├── platform.dart │ │ │ │ │ └── server_func.dart │ │ │ │ ├── net_view.dart │ │ │ │ ├── path_with_prefix.dart │ │ │ │ ├── range.dart │ │ │ │ ├── scripts/ │ │ │ │ │ ├── cmd_types.dart │ │ │ │ │ ├── script_builders.dart │ │ │ │ │ ├── script_consts.dart │ │ │ │ │ └── shell_func.dart │ │ │ │ ├── server_detail_card.dart │ │ │ │ ├── tab.dart │ │ │ │ └── tab.g.dart │ │ │ ├── container/ │ │ │ │ ├── image.dart │ │ │ │ ├── ps.dart │ │ │ │ ├── status.dart │ │ │ │ └── type.dart │ │ │ ├── pkg/ │ │ │ │ ├── manager.dart │ │ │ │ └── upgrade_info.dart │ │ │ ├── server/ │ │ │ │ ├── amd.dart │ │ │ │ ├── battery.dart │ │ │ │ ├── conn.dart │ │ │ │ ├── connection_stat.dart │ │ │ │ ├── connection_stat.freezed.dart │ │ │ │ ├── connection_stat.g.dart │ │ │ │ ├── cpu.dart │ │ │ │ ├── custom.dart │ │ │ │ ├── custom.g.dart │ │ │ │ ├── discovery_result.dart │ │ │ │ ├── discovery_result.freezed.dart │ │ │ │ ├── discovery_result.g.dart │ │ │ │ ├── disk.dart │ │ │ │ ├── disk_smart.dart │ │ │ │ ├── disk_smart.freezed.dart │ │ │ │ ├── disk_smart.g.dart │ │ │ │ ├── dist.dart │ │ │ │ ├── memory.dart │ │ │ │ ├── net_speed.dart │ │ │ │ ├── nvdia.dart │ │ │ │ ├── ping_result.dart │ │ │ │ ├── private_key_info.dart │ │ │ │ ├── private_key_info.g.dart │ │ │ │ ├── proc.dart │ │ │ │ ├── pve.dart │ │ │ │ ├── sensors.dart │ │ │ │ ├── server.dart │ │ │ │ ├── server_private_info.dart │ │ │ │ ├── server_private_info.freezed.dart │ │ │ │ ├── server_private_info.g.dart │ │ │ │ ├── server_status_update_req.dart │ │ │ │ ├── snippet.dart │ │ │ │ ├── snippet.freezed.dart │ │ │ │ ├── snippet.g.dart │ │ │ │ ├── system.dart │ │ │ │ ├── systemd.dart │ │ │ │ ├── temp.dart │ │ │ │ ├── time_seq.dart │ │ │ │ ├── try_limiter.dart │ │ │ │ ├── windows_parser.dart │ │ │ │ ├── wol_cfg.dart │ │ │ │ └── wol_cfg.g.dart │ │ │ ├── sftp/ │ │ │ │ ├── browser_status.dart │ │ │ │ ├── req.dart │ │ │ │ └── worker.dart │ │ │ └── ssh/ │ │ │ └── virtual_key.dart │ │ ├── provider/ │ │ │ ├── ai/ │ │ │ │ └── ask_ai.dart │ │ │ ├── container.dart │ │ │ ├── container.freezed.dart │ │ │ ├── container.g.dart │ │ │ ├── private_key.dart │ │ │ ├── private_key.freezed.dart │ │ │ ├── private_key.g.dart │ │ │ ├── providers.dart │ │ │ ├── pve.dart │ │ │ ├── pve.freezed.dart │ │ │ ├── pve.g.dart │ │ │ ├── server/ │ │ │ │ ├── all.dart │ │ │ │ ├── all.freezed.dart │ │ │ │ ├── all.g.dart │ │ │ │ ├── single.dart │ │ │ │ ├── single.freezed.dart │ │ │ │ └── single.g.dart │ │ │ ├── sftp.dart │ │ │ ├── sftp.freezed.dart │ │ │ ├── sftp.g.dart │ │ │ ├── snippet.dart │ │ │ ├── snippet.freezed.dart │ │ │ ├── snippet.g.dart │ │ │ ├── systemd.dart │ │ │ ├── systemd.freezed.dart │ │ │ ├── systemd.g.dart │ │ │ ├── virtual_keyboard.dart │ │ │ ├── virtual_keyboard.freezed.dart │ │ │ └── virtual_keyboard.g.dart │ │ ├── res/ │ │ │ ├── build_data.dart │ │ │ ├── default.dart │ │ │ ├── github_id.dart │ │ │ ├── highlight.dart │ │ │ ├── misc.dart │ │ │ ├── status.dart │ │ │ ├── store.dart │ │ │ ├── terminal.dart │ │ │ └── url.dart │ │ ├── ssh/ │ │ │ └── session_manager.dart │ │ └── store/ │ │ ├── connection_stats.dart │ │ ├── container.dart │ │ ├── history.dart │ │ ├── private_key.dart │ │ ├── server.dart │ │ ├── setting.dart │ │ └── snippet.dart │ ├── generated/ │ │ └── l10n/ │ │ ├── l10n.dart │ │ ├── l10n_de.dart │ │ ├── l10n_en.dart │ │ ├── l10n_es.dart │ │ ├── l10n_fr.dart │ │ ├── l10n_id.dart │ │ ├── l10n_it.dart │ │ ├── l10n_ja.dart │ │ ├── l10n_ko.dart │ │ ├── l10n_nl.dart │ │ ├── l10n_pt.dart │ │ ├── l10n_ru.dart │ │ ├── l10n_tr.dart │ │ ├── l10n_uk.dart │ │ └── l10n_zh.dart │ ├── hive/ │ │ ├── hive_adapters.dart │ │ ├── hive_adapters.g.dart │ │ ├── hive_adapters.g.yaml │ │ └── hive_registrar.g.dart │ ├── intro.dart │ ├── l10n/ │ │ ├── app_de.arb │ │ ├── app_en.arb │ │ ├── app_es.arb │ │ ├── app_fr.arb │ │ ├── app_id.arb │ │ ├── app_it.arb │ │ ├── app_ja.arb │ │ ├── app_ko.arb │ │ ├── app_nl.arb │ │ ├── app_pt.arb │ │ ├── app_ru.arb │ │ ├── app_tr.arb │ │ ├── app_uk.arb │ │ ├── app_zh.arb │ │ └── app_zh_tw.arb │ ├── main.dart │ └── view/ │ ├── page/ │ │ ├── backup.dart │ │ ├── container/ │ │ │ ├── actions.dart │ │ │ ├── container.dart │ │ │ └── types.dart │ │ ├── home.dart │ │ ├── iperf.dart │ │ ├── ping.dart │ │ ├── private_key/ │ │ │ ├── edit.dart │ │ │ └── list.dart │ │ ├── process.dart │ │ ├── pve.dart │ │ ├── server/ │ │ │ ├── detail/ │ │ │ │ ├── misc.dart │ │ │ │ └── view.dart │ │ │ ├── discovery/ │ │ │ │ ├── discovery.dart │ │ │ │ └── widget.dart │ │ │ ├── edit/ │ │ │ │ ├── actions.dart │ │ │ │ ├── edit.dart │ │ │ │ └── widget.dart │ │ │ └── tab/ │ │ │ ├── card_stat.dart │ │ │ ├── content.dart │ │ │ ├── landscape.dart │ │ │ ├── tab.dart │ │ │ ├── top_bar.dart │ │ │ └── utils.dart │ │ ├── setting/ │ │ │ ├── about.dart │ │ │ ├── entries/ │ │ │ │ ├── ai.dart │ │ │ │ ├── app.dart │ │ │ │ ├── container.dart │ │ │ │ ├── editor.dart │ │ │ │ ├── full_screen.dart │ │ │ │ ├── home_tabs.dart │ │ │ │ ├── server.dart │ │ │ │ ├── sftp.dart │ │ │ │ └── ssh.dart │ │ │ ├── entry.dart │ │ │ ├── platform/ │ │ │ │ ├── ios.dart │ │ │ │ └── platform_pub.dart │ │ │ └── seq/ │ │ │ ├── srv_detail_seq.dart │ │ │ ├── srv_func_seq.dart │ │ │ ├── srv_seq.dart │ │ │ └── virt_key.dart │ │ ├── snippet/ │ │ │ ├── edit.dart │ │ │ ├── list.dart │ │ │ └── result.dart │ │ ├── ssh/ │ │ │ ├── page/ │ │ │ │ ├── ask_ai.dart │ │ │ │ ├── init.dart │ │ │ │ ├── keyboard.dart │ │ │ │ ├── page.dart │ │ │ │ └── virt_key.dart │ │ │ └── tab.dart │ │ ├── storage/ │ │ │ ├── local.dart │ │ │ ├── sftp.dart │ │ │ └── sftp_mission.dart │ │ └── systemd.dart │ └── widget/ │ ├── omit_start_text.dart │ ├── percent_circle.dart │ ├── server_func_btns.dart │ └── unix_perm.dart ├── linux/ │ ├── .gitignore │ ├── CMakeLists.txt │ ├── flutter/ │ │ ├── CMakeLists.txt │ │ ├── generated_plugin_registrant.cc │ │ ├── generated_plugin_registrant.h │ │ └── generated_plugins.cmake │ ├── main.cc │ ├── my_application.cc │ ├── my_application.h │ └── packaging/ │ ├── appimage/ │ │ └── make_config.yaml │ ├── deb/ │ │ └── make_config.yaml │ └── rpm/ │ └── make_config.yaml ├── macos/ │ ├── .gitignore │ ├── Flutter/ │ │ ├── Flutter-Debug.xcconfig │ │ ├── Flutter-Release.xcconfig │ │ └── GeneratedPluginRegistrant.swift │ ├── Podfile │ ├── Runner/ │ │ ├── AppDelegate.swift │ │ ├── Assets.xcassets/ │ │ │ └── AppIcon.appiconset/ │ │ │ └── Contents.json │ │ ├── Base.lproj/ │ │ │ └── MainMenu.xib │ │ ├── Configs/ │ │ │ ├── AppInfo.xcconfig │ │ │ ├── Debug.xcconfig │ │ │ ├── Release.xcconfig │ │ │ └── Warnings.xcconfig │ │ ├── DebugProfile.entitlements │ │ ├── Info.plist │ │ ├── MainFlutterWindow.swift │ │ ├── PrivacyInfo.xcprivacy │ │ ├── Release.entitlements │ │ ├── de.lproj/ │ │ │ └── MainMenu.strings │ │ ├── es.lproj/ │ │ │ └── MainMenu.strings │ │ ├── fr.lproj/ │ │ │ └── MainMenu.strings │ │ ├── id.lproj/ │ │ │ └── MainMenu.strings │ │ ├── ja.lproj/ │ │ │ └── MainMenu.strings │ │ ├── pt-BR.lproj/ │ │ │ └── MainMenu.strings │ │ ├── ru.lproj/ │ │ │ └── MainMenu.strings │ │ ├── zh-Hans.lproj/ │ │ │ └── MainMenu.strings │ │ └── zh-Hant.lproj/ │ │ └── MainMenu.strings │ ├── Runner.xcodeproj/ │ │ ├── project.pbxproj │ │ ├── project.xcworkspace/ │ │ │ └── xcshareddata/ │ │ │ └── IDEWorkspaceChecks.plist │ │ └── xcshareddata/ │ │ └── xcschemes/ │ │ └── Runner.xcscheme │ ├── Runner.xcworkspace/ │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata/ │ │ └── IDEWorkspaceChecks.plist │ └── RunnerTests/ │ └── RunnerTests.swift ├── make.dart ├── pubspec.yaml ├── test/ │ ├── amd_smi_test.dart │ ├── battery_test.dart │ ├── btrfs_test.dart │ ├── container_test.dart │ ├── core_utils_test.dart │ ├── cpu_test.dart │ ├── disabled_cmd_types_test.dart │ ├── disk_smart_test.dart │ ├── disk_test.dart │ ├── jump_chain_test.dart │ ├── memory_test.dart │ ├── net_speed_test.dart │ ├── nvidia.xml │ ├── nvidia2.xml │ ├── nvidia_test.dart │ ├── proc_test.dart │ ├── pve_test.dart │ ├── script_builder_test.dart │ ├── sensors_test.dart │ ├── server_dedup_test.dart │ ├── server_edit_logic_test.dart │ ├── ssh_config_test.dart │ ├── system_dist_test.dart │ ├── uptime_test.dart │ └── windows_test.dart └── windows/ ├── .gitignore ├── CMakeLists.txt ├── flutter/ │ ├── CMakeLists.txt │ ├── generated_plugin_registrant.cc │ ├── generated_plugin_registrant.h │ └── generated_plugins.cmake └── runner/ ├── CMakeLists.txt ├── Runner.rc ├── flutter_window.cpp ├── flutter_window.h ├── main.cpp ├── resource.h ├── runner.exe.manifest ├── utils.cpp ├── utils.h ├── win32_window.cpp └── win32_window.h ================================================ FILE CONTENTS ================================================ ================================================ FILE: .github/FUNDING.yml ================================================ custom: ['https://cdn.lpkt.cn/donate'] ================================================ FILE: .github/ISSUE_TEMPLATE/bug_report.md ================================================ --- name: Bug report about: Create a report to help us improve title: '' labels: '' assignees: '' --- **Describe the bug** **To Reproduce** **Desired Results** **Actual Results** **Screenshots** **Device** **Additional context** ================================================ FILE: .github/ISSUE_TEMPLATE/bug_report_cn.md ================================================ --- name: Bug 反馈 about: 帮助我们改进错误 title: '' labels: '' assignees: '' --- **描述BUG** **复现步骤** **期望结果** **实际结果** **截图** **设备** **更多信息** ================================================ FILE: .github/workflows/analysis.yml ================================================ # This workflow uses actions that are not certified by GitHub. # They are provided by a third-party and are governed by # separate terms of service, privacy policy, and support # documentation. name: flutter analysis on: push: branches: [ "main" ] pull_request: branches: [ "main" ] jobs: check: runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 with: fetch-depth: 1 submodules: recursive - uses: subosito/flutter-action@v2 with: channel: 'stable' - name: Install dependencies run: flutter pub get # Consider passing '--fatal-infos' for slightly stricter analysis. - name: Analyze project source run: flutter analyze lib test # Your project will need to have tests in test/ and a dependency on # package:test for this step to succeed. Note that Flutter projects will # want to change this to 'flutter test'. - name: Run tests run: flutter test ================================================ FILE: .github/workflows/release.yml ================================================ name: Flutter Release on: workflow_dispatch: push: tags: - "v*" permissions: contents: write env: APP_NAME: ServerBox RELEASE_TAG: ${{ github.ref_name }} jobs: releaseAndroid: name: Release android runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v6 with: submodules: recursive - name: Install Flutter uses: subosito/flutter-action@v2 with: channel: "stable" flutter-version: "3.41.4" - uses: actions/setup-java@v4 with: distribution: "zulu" java-version: "17" - name: Fetch secrets run: | curl -u ${{ secrets.BASIC_AUTH }} -o android/app/app.key ${{ secrets.URL_PREFIX }}app.key curl -u ${{ secrets.BASIC_AUTH }} -o android/key.properties ${{ secrets.URL_PREFIX }}key.properties - name: Build run: dart run fl_build -p android - name: Rename for fdroid shell: bash run: | APK_DIR="build/app/outputs/flutter-apk" shopt -s nullglob for arch in arm64 arm amd64; do matches=("$APK_DIR"/"${APP_NAME}"_*_"${arch}".apk) if [ ${#matches[@]} -ne 1 ]; then echo "Error: expected 1 APK for ${arch}, found ${#matches[@]}" echo "APK_DIR: $APK_DIR" ls -la "$APK_DIR" || true exit 1 fi mv "${matches[0]}" "$APK_DIR/${APP_NAME}_${RELEASE_TAG}_${arch}.apk" done - name: Create Release uses: softprops/action-gh-release@v2 with: files: | build/app/outputs/flutter-apk/${{ env.APP_NAME }}_${{ env.RELEASE_TAG }}_arm64.apk build/app/outputs/flutter-apk/${{ env.APP_NAME }}_${{ env.RELEASE_TAG }}_arm.apk build/app/outputs/flutter-apk/${{ env.APP_NAME }}_${{ env.RELEASE_TAG }}_amd64.apk env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} releaseLinux: name: Release linux runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v6 with: submodules: recursive - name: Install Flutter uses: subosito/flutter-action@v2 - name: Install dependencies run: | sudo apt update # Basic sudo apt install -y clang cmake ninja-build pkg-config libgtk-3-dev mesa-utils libvulkan-dev desktop-file-utils wget # App Specific sudo apt install -y libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libunwind-dev libsecret-1-dev - name: Build run: | dart run fl_build -p linux - name: Rename for release shell: bash run: | shopt -s nullglob matches=("${APP_NAME}"_*_amd64.AppImage) if [ ${#matches[@]} -ne 1 ]; then echo "Error: expected 1 AppImage, found ${#matches[@]}" ls -la || true exit 1 fi mv "${matches[0]}" "${APP_NAME}_${RELEASE_TAG}_amd64.AppImage" - name: Create Release uses: softprops/action-gh-release@v2 with: files: | ${{ env.APP_NAME }}_${{ env.RELEASE_TAG }}_amd64.AppImage env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} releaseWin: name: Release windows runs-on: windows-latest steps: - name: Checkout uses: actions/checkout@v6 with: submodules: recursive - name: Install Flutter uses: subosito/flutter-action@v2 - name: Build run: dart run fl_build -p windows - name: Rename for release shell: bash run: | shopt -s nullglob matches=("${APP_NAME}"_*_windows_amd64.zip) if [ ${#matches[@]} -ne 1 ]; then echo "Error: expected 1 zip, found ${#matches[@]}" ls -la || true exit 1 fi mv "${matches[0]}" "${APP_NAME}_${RELEASE_TAG}_windows_amd64.zip" - name: Create Release uses: softprops/action-gh-release@v2 with: files: | ${{ env.APP_NAME }}_${{ env.RELEASE_TAG }}_windows_amd64.zip env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # releaseIOS: # name: Release iOS # runs-on: macos-latest # steps: # - name: Checkout # uses: actions/checkout@v6 # with: # submodules: recursive # - name: Install Flutter # uses: subosito/flutter-action@v2 # - name: Build # run: | # dart run fl_build -p ios -- --no-codesign # shopt -s nullglob # IPA_FILES=(build/ios/ipa/*.ipa) # if [ ${#IPA_FILES[@]} -ne 1 ]; then # echo "Error: expected 1 IPA, found ${#IPA_FILES[@]}" # ls -la build/ios/ipa || true # exit 1 # fi # IPA_FILE="${IPA_FILES[0]}" # echo "Found IPA: $IPA_FILE" # cp "$IPA_FILE" "${APP_NAME}_${RELEASE_TAG}_ios.ipa" # - name: Create Release # uses: softprops/action-gh-release@v2 # with: # files: | # ${{ env.APP_NAME }}_${{ env.RELEASE_TAG }}_ios.ipa # env: # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # releaseMacOS: # name: Release macOS # runs-on: macos-latest # steps: # - name: Checkout # uses: actions/checkout@v6 # with: # submodules: recursive # - name: Install Flutter # uses: subosito/flutter-action@v2 # - name: Build # run: | # dart run fl_build -p macos -- --no-codesign # - name: Package # run: | # RELEASE_DIR="$GITHUB_WORKSPACE/build/macos/Build/Products/Release" # APP_DIR="$RELEASE_DIR/$APP_NAME.app" # OUT_ZIP="$GITHUB_WORKSPACE/${APP_NAME}_${RELEASE_TAG}_macos.zip" # if [ ! -d "$RELEASE_DIR" ]; then # echo "Error: macOS release directory not found: $RELEASE_DIR" # exit 1 # fi # if [ ! -d "$APP_DIR" ]; then # echo "Error: macOS app bundle not found: $APP_DIR" # exit 1 # fi # cd "$RELEASE_DIR" # zip -ry "$OUT_ZIP" "$APP_NAME.app" # - name: Create Release # uses: softprops/action-gh-release@v2 # with: # files: | # ${{ env.APP_NAME }}_${{ env.RELEASE_TAG }}_macos.zip # env: # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} ================================================ FILE: .gitignore ================================================ # Miscellaneous *.class *.log *.pyc *.swp .DS_Store .atom/ .buildlog/ .history .svn/ # IntelliJ related *.iml *.ipr *.iws .idea/ # The .vscode folder contains launch configuration and tasks you configure in # VS Code which you may wish to be included in version control, so this line # is commented out by default. #.vscode/ # Flutter/Dart/Pub related **/doc/api/ **/ios/Flutter/.last_build_id # .dart_tool/ .flutter-plugins .flutter-plugins-dependencies .packages .pub-cache/ .pub/ /build/ # Web related lib/generated_plugin_registrant.dart # Symbolication related app.*.symbols # Obfuscation related app.*.map.json # Android Studio will place build artifacts here /android/app/debug /android/app/profile /android/app/release /android/app/fjy.androidstudio.key /android/app/app.key /release test.dart # Keep generated l10n files # /.dart_tool/* # !/.dart_tool/flutter_gen .dart_tool # Linux release linux.AppDir **/*.AppImage untranlated.json .vscode/settings.json more_build_data.json trans.txt android/app/.cxx ================================================ FILE: .gitmodules ================================================ [submodule "dartssh2"] path = packages/dartssh2 url = https://github.com/lollipopkit/dartssh2 branch = master [submodule "xterm"] path = packages/xterm url = https://github.com/lollipopkit/xterm.dart branch = master [submodule "fl_lib"] path = packages/fl_lib url = https://github.com/lollipopkit/fl_lib branch = before-sqlite [submodule "fl_build"] path = packages/fl_build url = https://github.com/lppcg/fl_build.git branch = main [submodule "server_box_monitor"] path = packages/server_box_monitor url = https://github.com/lollipopkit/server_box_monitor branch = main [submodule "circle_chart"] path = packages/circle_chart url = https://github.com/lollipopkit/circle_chart branch = main [submodule "plain_notification_token"] path = packages/plain_notification_token url = https://github.com/lollipopkit/plain_notification_token branch = master [submodule "watch_connectivity"] path = packages/watch_connectivity url = https://github.com/lollipopkit/watch_connectivity branch = master ================================================ FILE: .metadata ================================================ # This file tracks properties of this Flutter project. # Used by Flutter tool to assess capabilities and perform upgrades etc. # # This file should be version controlled and should not be manually edited. version: revision: "761747bfc538b5af34aa0d3fac380f1bc331ec49" channel: "stable" project_type: app # Tracks metadata for the flutter migrate command migration: platforms: - platform: root create_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49 base_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49 - platform: android create_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49 base_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49 - platform: ios create_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49 base_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49 - platform: linux create_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49 base_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49 - platform: macos create_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49 base_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49 - platform: web create_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49 base_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49 - platform: windows create_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49 base_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49 # User provided section # List of Local paths (relative to this file) that should be # ignored by the migrate tool. # # Files that are not part of the templates will be ignored by default. unmanaged_files: - 'lib/main.dart' - 'ios/Runner.xcodeproj/project.pbxproj' ================================================ FILE: .vscode/launch.json ================================================ { // 使用 IntelliSense 了解相关属性。 // 悬停以查看现有属性的描述。 // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ { "name": "debug", "request": "launch", "type": "dart", "env": { // Comment this line to use the default display "DISPLAY": ":1" } // "args": [ // "-v" // ] }, { "name": "profile", "request": "launch", "type": "dart", "flutterMode": "profile", "args": [ "--cache-sksl", // "--purge-persistent-cache" ] } ] } ================================================ FILE: CLAUDE.md ================================================ # CLAUDE.md This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. ## Commands ### Development - `flutter run` - Run the app in development mode - `dart run fl_build -p PLATFORM` - Build the app for specific platform (see fl_build package) - `dart run build_runner build --delete-conflicting-outputs` - Generate code for models with annotations (json_serializable, freezed, hive, riverpod) - Every time you change model files, run this command to regenerate code (Hive adapters, Riverpod providers, etc.) - Generated files include: `*.g.dart`, `*.freezed.dart` files ### Testing - `flutter test` - Run unit tests - `flutter test test/battery_test.dart` - Run specific test file ## Architecture This is a Flutter application for managing Linux servers with the following key architectural components: ### Project Structure - `lib/core/` - Core utilities, extensions, and routing - `lib/data/` - Data layer with models, providers, and storage - `model/` - Data models organized by feature (server, container, ssh, etc.) - `provider/` - Riverpod providers for state management - `store/` - Local storage implementations using Hive - `lib/view/` - UI layer with pages and widgets - `lib/generated/` - Generated localization files - `lib/hive/` - Hive adapters for local storage ### Key Technologies - **State Management**: Riverpod with code generation (riverpod_annotation) - **Local Storage**: Hive for persistent data with generated adapters - **SSH/SFTP**: Custom dartssh2 fork for server connections - **Terminal**: Custom xterm.dart fork for SSH terminal interface - **Networking**: dio for HTTP requests - **Charts**: fl_chart for server status visualization - **Localization**: Flutter's built-in i18n with ARB files - **Code Generation**: Uses build_runner with json_serializable, freezed, hive_generator, riverpod_generator ### Data Models - Server management models in `lib/data/model/server/` - Container/Docker models in `lib/data/model/container/` - SSH and SFTP models in respective directories - Most models use freezed for immutability and json_annotation for serialization ### Features - Server status monitoring (CPU, memory, disk, network) - SSH terminal with virtual keyboard - SFTP file browser - Docker container management - Process and systemd service management - Server snippets and custom commands - Multi-language support (12+ languages) - Cross-platform support (iOS, Android, macOS, Linux, Windows) ### State Management Pattern - Uses Riverpod providers for dependency injection and state management - Uses Freezed for immutable state models - Providers are organized by feature in `lib/data/provider/` - State is often persisted using Hive stores in `lib/data/store/` ### Build System - Uses custom `fl_build` package for cross-platform building - `make.dart` script handles pre/post build tasks (metadata generation) - Supports building for multiple platforms with platform-specific configurations - Many dependencies are custom forks hosted on GitHub (dartssh2, xterm, fl_lib, etc.) ### Important Notes - **Never run code formatting commands** - The codebase has specific formatting that should not be changed - **Always run code generation** after modifying models with annotations (freezed, json_serializable, hive, riverpod) - Generated files (`*.g.dart`, `*.freezed.dart`) should not be manually edited - AGAIN, NEVER run code formatting commands. - USE dependency injection via GetIt for services like Stores, Services and etc. - Generate all l10n files using `flutter gen-l10n` command after modifying ARB files. - USE `hive_ce` not `hive` package for Hive integration. - Which no need to config `HiveField` and `HiveType` manually. - USE widgets and utilities from `fl_lib` package for common functionalities. - Such as `CustomAppBar`, `context.showRoundDialog`, `Input`, `Btnx.cancelOk`, etc. - You can use context7 MCP to search `lppcg fl_lib KEYWORD` to find relevant widgets and utilities. - USE `libL10n` and `l10n` for localization strings. - `libL10n` is from `fl_lib` package, and `l10n` is from this project. - Before adding new strings, check if it already exists in `libL10n`. - Prioritize using strings from `libL10n` to avoid duplication, even if the meaning is not 100% exact, just use the substitution of `libL10n`. - Split UI into Widget build, Actions, Utils. use `extension on` to achieve this ================================================ FILE: LICENSE ================================================ GNU AFFERO GENERAL PUBLIC LICENSE Version 3, 19 November 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU Affero General Public License is a free, copyleft license for software and other kinds of works, specifically designed to ensure cooperation with the community in the case of network server software. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, our General Public Licenses are intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. Developers that use our General Public Licenses protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License which gives you legal permission to copy, distribute and/or modify the software. A secondary benefit of defending all users' freedom is that improvements made in alternate versions of the program, if they receive widespread use, become available for other developers to incorporate. Many developers of free software are heartened and encouraged by the resulting cooperation. However, in the case of software used on network servers, this result may fail to come about. The GNU General Public License permits making a modified version and letting the public access it on a server without ever releasing its source code to the public. The GNU Affero General Public License is designed specifically to ensure that, in such cases, the modified source code becomes available to the community. It requires the operator of a network server to provide the source code of the modified version running there to the users of that server. Therefore, public use of a modified version, on a publicly accessible server, gives the public access to the source code of the modified version. An older license, called the Affero General Public License and published by Affero, was designed to accomplish similar goals. This is a different license, not a version of the Affero GPL, but Affero has released a new version of the Affero GPL which permits relicensing under this license. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU Affero General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Remote Network Interaction; Use with the GNU General Public License. Notwithstanding any other provision of this License, if you modify the Program, your modified version must prominently offer all users interacting with it remotely through a computer network (if your version supports such interaction) an opportunity to receive the Corresponding Source of your version by providing access to the Corresponding Source from a network server at no charge, through some standard or customary means of facilitating copying of software. This Corresponding Source shall include the Corresponding Source for any work covered by version 3 of the GNU General Public License that is incorporated pursuant to the following paragraph. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the work with which it is combined will remain governed by version 3 of the GNU General Public License. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU Affero General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU Affero General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU Affero General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU Affero General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program 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 Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If your software can interact with users remotely through a computer network, you should also make sure that it provides a way for users to get its source. For example, if your program is a web application, its interface could display a "Source" link that leads users to an archive of the code. There are many ways you could offer source, and different solutions will be better for different programs; see section 13 for the specific requirements. You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU AGPL, see . ================================================ FILE: README.md ================================================ English | [简体中文](README_zh.md)

Flutter Server Box

donate lang license Ask DeepWiki

A Flutter project which provides charts to display Linux, Unix and Windows server status and tools to manage servers.
Especially thanks to dartssh2 & xterm.dart.

## 🏙️ Screenshots
## 📥 Installation |Platform| From| |--|--| | iOS / macOS | [AppStore](https://apps.apple.com/app/id1586449703) | | Android | [GitHub](https://github.com/lollipopkit/flutter_server_box/releases) / [CDN](https://cdn.lpkt.cn/serverbox/pkg/?sort=time&order=desc&layout=grid) / [F-Droid](https://f-droid.org/packages/tech.lolli.toolbox) / [OpenAPK](https://www.openapk.net/serverbox/tech.lolli.toolbox/) | | Linux / Windows | [GitHub](https://github.com/lollipopkit/flutter_server_box/releases) / [CDN](https://cdn.lpkt.cn/serverbox/pkg/?sort=time&order=desc&layout=grid) | Please only download pkgs from the source that **you trust**! ## 🔖 Features - `Status chart` (CPU, Sensors, GPU...), `SSH` Term, `SFTP`, `Docker & Process & Systemd`, `S.M.A.R.T`... - Platform specific: `Bio auth`、`Msg push`、`Home widget`、`watchOS App`... - English, 简体中文; Deutsch [@its-tom](https://github.com/its-tom), 繁體中文 [@kalashnikov](https://github.com/kalashnikov), Indonesian [@azkadev](https://github.com/azkadev), Français [@FrancXPT](https://github.com/FrancXPT), Dutch [@QazCetelic](https://github.com/QazCetelic), Türkçe [@mikropsoft](https://github.com/mikropsoft), Українська мова [@CakesTwix](https://github.com/CakesTwix); Español, Русский язык, Português, 日本語 (Generated by GPT) ## 🆘 Help
qq donate discord
- 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). Before you open an issue, please read the following: 1. Paste the **entire log** (click the top right of the home page) in the issue template. 2. Make sure whether the issue is caused by ServerBox app. 3. Welcome all valid and positive feedback, subjective feedback (such as you think other UI is better) may not be accepted. After you read the above, you can open an [issue](https://github.com/lollipopkit/flutter_server_box/issues/new). ## 🧱 Contributions Any positive contribution is welcome. If I forgot to add your name to the contributors list, please add a comment in the issue or PR you opened to let me know, I will add it as soon as possible. ### Development 1. Setup [Flutter](https://flutter.dev/docs/get-started/install) environment. 2. Clone this repo, run `flutter run` to start the app. 3. Run `dart run fl_build -p PLATFORM` to build the app. ### Translation - [Guide](https://blog.lpkt.cn/posts/faq/) can be found in my blog. - We need your help! Just feel free to open a PR. ## 💡 My other apps - [GPT Box](https://github.com/lollipopkit/flutter_gpt_box) - A third-party GPT Client for OpenAI API on all platforms. - [More](https://github.com/lollipopkit) - Tools & etc. ## 📝 License `AGPL v3 lollipopkit & all contributors` ================================================ FILE: README_zh.md ================================================ 简体中文 | [English](README.md)

Flutter Server Box

donate 语言 license Ask DeepWiki

使用 Flutter 开发的 Linux, Unix, Windows 服务器工具箱,提供服务器状态图表和管理工具。
特别感谢 dartssh2 & xterm.dart

## 🏙️ 截屏
## 📥 安装 平台|下载 --|-- iOS / macOS | [AppStore](https://apps.apple.com/app/id1586449703) Android | [GitHub](https://github.com/lollipopkit/flutter_server_box/releases) / [CDN](https://cdn.lpkt.cn/serverbox/pkg/?sort=time&order=desc&layout=grid) / [F-Droid](https://f-droid.org/packages/tech.lolli.toolbox) / [OpenAPK](https://www.openapk.net/serverbox/tech.lolli.toolbox/) Linux / Windows | [GitHub](https://github.com/lollipopkit/flutter_server_box/releases) / [CDN](https://cdn.lpkt.cn/serverbox/pkg/?sort=time&order=desc&layout=grid) 请从 **信任** 的来源下载! ## 🔖 特点 - `状态图表`(CPU、传感器、GPU 等), `SSH` 终端, `SFTP`, `Docker & 进程 & Systemd` 管理,`S.M.A.R.T`... - 特殊支持:`生物认证`、`推送`、`桌面小部件`、`watchOS App`、`跟随系统颜色`... - 本地化 - English, 简体中文 - Español, Русский язык, Português, 日本語 (Generated by GPT) - Deutsch [@its-tom](https://github.com/its-tom), 繁體中文 [@kalashnikov](https://github.com/kalashnikov), Indonesian [@azkadev](https://github.com/azkadev), Français [@FrancXPT](https://github.com/FrancXPT), Dutch [@QazCetelic](https://github.com/QazCetelic), Türkçe [@mikropsoft](https://github.com/mikropsoft), Українська мова [@CakesTwix](https://github.com/CakesTwix); - 感谢贡献者们! ## 🆘 帮助
qq donate discord
- 为了可以在不使用 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/主页) 查看。 反馈前须知: 1. 反馈问题请附带 log(点击首页右上角),并以 bug 模版提交。 2. 反馈问题前请检查是否是 serverbox 的问题。 3. 欢迎所有有效、正面的反馈,主观(比如你觉得其他UI更好看)的反馈不一定会接受 ## 🧱 贡献 任何正面的贡献都欢迎。 如果我忘记在贡献者列表中添加你的名字,请在你打开的 issue 或 PR 中添加评论让我知道,我会尽快添加。 ### 开发 1. 安装 [Flutter](https://flutter.dev/docs/get-started/install) 2. 克隆这个仓库, 运行 `flutter run` 启动应用 3. 运行 `dart run fl_build -p PLATFORM` 构建应用 ### 翻译 [指南](https://blog.lpkt.cn/faq/) 可在我的博客中找到。 ## 💡 我的其它 Apps - [GPT Box](https://github.com/lollipopkit/flutter_gpt_box) - 支持 OpenAI API 的 第三方全平台客户端。 - [更多](https://github.com/lollipopkit) - 工具 & etc. ## 📝 协议 `AGPL v3 lollipopkit & 所有贡献者` ================================================ FILE: analysis_options.yaml ================================================ # This file configures the analyzer, which statically analyzes Dart code to # check for errors, warnings, and lints. # # The issues identified by the analyzer are surfaced in the UI of Dart-enabled # IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be # invoked from the command line by running `flutter analyze`. # The following line activates a set of recommended lints for Flutter apps, # packages, and plugins designed to encourage good coding practices. include: package:flutter_lints/flutter.yaml analyzer: exclude: - "**/*.g.dart" language: # strict-casts: true # strict-inference: true # strict-raw-types: true errors: invalid_annotation_target: ignore linter: # The lint rules applied to this project can be customized in the # section below to disable rules from the `package:flutter_lints/flutter.yaml` # included above or to enable additional rules. A list of all available lints # and their documentation is published at # https://dart-lang.github.io/linter/lints/index.html. # # Instead of disabling a lint rule for the entire project in the # section below, it can also be suppressed for a single line of code # or a specific dart file by using the `// ignore: name_of_lint` and # `// ignore_for_file: name_of_lint` syntax on the line or in the file # producing the lint. rules: library_private_types_in_public_api: true use_build_context_synchronously: false depend_on_referenced_packages: false prefer_final_locals: true unnecessary_parenthesis: true implicit_call_tearoffs: true always_declare_return_types: true always_use_package_imports: true annotate_overrides: true avoid_empty_else: true # avoid_print: false # Uncomment to disable the `avoid_print` rule prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule avoid_return_types_on_setters: true directives_ordering: true # Enable sorting of imports # Additional information about this file can be found at # https://dart.dev/guides/language/analysis-options ================================================ FILE: android/.gitignore ================================================ gradle-wrapper.jar /.gradle /captures/ /gradlew /gradlew.bat /local.properties GeneratedPluginRegistrant.java # Remember to never publicly share your keystore. # See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app key.properties **/*.keystore **/*.jks ================================================ FILE: android/app/build.gradle ================================================ plugins { id "com.android.application" id "kotlin-android" id "dev.flutter.flutter-gradle-plugin" } def localProperties = new Properties() def localPropertiesFile = rootProject.file('local.properties') if (localPropertiesFile.exists()) { localPropertiesFile.withReader('UTF-8') { reader -> localProperties.load(reader) } } def keystoreProperties = new Properties() def keystorePropertiesFile = rootProject.file('key.properties') if (keystorePropertiesFile.exists()) { keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) } else { System.err.printf(" [!] key.properties not found in %s (%s). Build will fail. \n", rootProject, rootProject.file('.')) } if (keystoreProperties['storeFile'] == null || !file(keystoreProperties['storeFile']).exists()) { System.err.printf(" [!] storeFile defined in key.properties does not exist in %s. Build will fail. \n", file('.')) } def flutterVersionCode = localProperties.getProperty('flutter.versionCode') if (flutterVersionCode == null) { flutterVersionCode = '1' } def flutterVersionName = localProperties.getProperty('flutter.versionName') if (flutterVersionName == null) { flutterVersionName = '1.0' } android { namespace "tech.lolli.toolbox" compileSdk flutter.compileSdkVersion ndkVersion flutter.ndkVersion compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } kotlinOptions { jvmTarget = '1.8' } sourceSets { main.java.srcDirs += 'src/main/kotlin' } defaultConfig { applicationId "tech.lolli.toolbox" // 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 targetSdkVersion flutter.targetSdkVersion versionCode flutterVersionCode.toInteger() versionName flutterVersionName ndk { if(!splits.abi.enable) { // abiFilters cannot be present when splits abi filters are set abiFilters 'arm64-v8a', 'armeabi-v7a' } } } signingConfigs { release { keyAlias keystoreProperties['keyAlias'] keyPassword keystoreProperties['keyPassword'] storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null storePassword keystoreProperties['storePassword'] } } buildTypes { release { signingConfig signingConfigs.release minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } debug { // No applicationIdSuffix or resValue here } profile { // No applicationIdSuffix or resValue here } } dependenciesInfo { // Disables dependency metadata when building APKs. includeInApk = false // Disables dependency metadata when building Android App Bundles. includeInBundle = false } } flutter { source '../..' } dependencies {} ext.abiCodes = ["x86_64": 1, "armeabi-v7a": 2, "arm64-v8a": 3] import com.android.build.OutputFile android.applicationVariants.all { variant -> variant.outputs.each { output -> def abiVersionCode = project.ext.abiCodes.get(output.getFilter(OutputFile.ABI)) if (abiVersionCode != null) { output.versionCodeOverride = variant.versionCode * 100 + abiVersionCode } } } ================================================ FILE: android/app/proguard-rules.pro ================================================ -keep class com.jcraft.** { *; } ================================================ FILE: android/app/src/main/AndroidManifest.xml ================================================ ================================================ FILE: android/app/src/main/kotlin/tech/lolli/toolbox/ForegroundService.kt ================================================ package tech.lolli.toolbox import android.app.* import android.content.Intent import android.content.pm.ServiceInfo import android.graphics.drawable.Icon import android.os.Build import android.os.IBinder import android.util.Log import org.json.JSONArray import org.json.JSONObject import java.io.File import java.util.* class ForegroundService : Service() { companion object { @Volatile var isRunning: Boolean = false } private val chanId = "ForegroundServiceChannel" private val NOTIFICATION_ID = 1000 private val ACTION_STOP_FOREGROUND = "ACTION_STOP_FOREGROUND" private val ACTION_UPDATE_SESSIONS = "tech.lolli.toolbox.ACTION_UPDATE_SESSIONS" private val ACTION_DISCONNECT_SESSION = "tech.lolli.toolbox.ACTION_DISCONNECT_SESSION" private var isFgStarted = false private val postedIds = mutableSetOf() // Stable mapping from session-id -> notification-id to avoid hash collisions private val notificationIdMap = mutableMapOf() private val nextNotificationId = java.util.concurrent.atomic.AtomicInteger(2001) private fun logError(message: String, error: Throwable? = null) { Log.e("ForegroundService", message, error) try { val logFile = File(getExternalFilesDir(null), "server_box.log") val timestamp = java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.US).format(Date()) val logMessage = "$timestamp [ForegroundService] ERROR: $message\n${error?.stackTraceToString() ?: ""}\n" logFile.appendText(logMessage) } catch (e: Exception) { Log.e("ForegroundService", "Failed to write log", e) } } override fun onCreate() { super.onCreate() Log.d("ForegroundService", "Service onCreate") isRunning = true createNotificationChannel() } override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int { try { // Check notification permission for Android 13+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU && androidx.core.content.ContextCompat.checkSelfPermission( this, android.Manifest.permission.POST_NOTIFICATIONS ) != android.content.pm.PackageManager.PERMISSION_GRANTED ) { Log.w("ForegroundService", "Notification permission denied. Stopping service gracefully.") // Don't call stopForegroundService() here as we haven't started foreground yet stopSelf() return START_NOT_STICKY } if (intent == null) { Log.w("ForegroundService", "onStartCommand called with null intent") // Don't call stopForegroundService() here as we haven't started foreground yet stopSelf() return START_NOT_STICKY } val action = intent.action Log.d("ForegroundService", "onStartCommand action=$action") return when (action) { ACTION_STOP_FOREGROUND -> { // Notify Flutter to stop all connections before stopping service val stopAllIntent = Intent("tech.lolli.toolbox.STOP_ALL_CONNECTIONS") sendBroadcast(stopAllIntent) clearAll() stopForegroundService() START_NOT_STICKY } ACTION_UPDATE_SESSIONS -> { val payload = intent.getStringExtra("payload") ?: "{}" handleUpdateSessions(payload) START_STICKY } else -> { // Default bring up foreground with placeholder ensureForeground(createMergedNotification(0, emptyList(), emptyList())) START_STICKY } } } catch (e: Exception) { logError("Error in onStartCommand", e) stopSelf() return START_NOT_STICKY } } override fun onBind(intent: Intent?): IBinder? { return null } private fun createNotificationChannel() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { try { val manager = getSystemService(NotificationManager::class.java) if (manager == null) { Log.e("ForegroundService", "Failed to get NotificationManager") return } val serviceChannel = NotificationChannel( chanId, "ForegroundServiceChannel", NotificationManager.IMPORTANCE_DEFAULT ).apply { description = "For foreground service" } manager.createNotificationChannel(serviceChannel) Log.d("ForegroundService", "Notification channel created successfully") } catch (e: Exception) { logError("Failed to create notification channel", e) } } } private fun ensureForeground(notification: Notification) { try { // Double-check notification permission before starting foreground service if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU && androidx.core.content.ContextCompat.checkSelfPermission( this, android.Manifest.permission.POST_NOTIFICATIONS ) != android.content.pm.PackageManager.PERMISSION_GRANTED ) { Log.w("ForegroundService", "Cannot start foreground service without notification permission") stopSelf() return } if (!isFgStarted) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { startForeground(NOTIFICATION_ID, notification, ServiceInfo.FOREGROUND_SERVICE_TYPE_DATA_SYNC) } else { startForeground(NOTIFICATION_ID, notification) } isFgStarted = true Log.d("ForegroundService", "Foreground service started successfully") } else { val nm = getSystemService(NotificationManager::class.java) if (nm != null) { nm.notify(NOTIFICATION_ID, notification) } else { Log.w("ForegroundService", "NotificationManager is null, cannot update notification") } } } catch (e: SecurityException) { logError("Security exception when starting foreground service (likely missing permission)", e) stopSelf() } catch (e: Exception) { logError("Failed to start/update foreground", e) // Don't stop the service for other exceptions, just log them } } private fun createMergedNotification(count: Int, lines: List, sessions: List): Notification { val notificationIntent = Intent(this, MainActivity::class.java) val pendingIntent = PendingIntent.getActivity( this, 0, notificationIntent, PendingIntent.FLAG_IMMUTABLE ) val stopIntent = Intent(this, ForegroundService::class.java).apply { action = ACTION_STOP_FOREGROUND } val stopPending = PendingIntent.getService(this, 0, stopIntent, PendingIntent.FLAG_IMMUTABLE) val builder = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { Notification.Builder(this, chanId) } else { @Suppress("DEPRECATION") Notification.Builder(this) } // Use the earliest session's start time for chronometer val earliestStartTime = sessions.minOfOrNull { it.startWhen } ?: System.currentTimeMillis() val title = when (count) { 0 -> "Server Box" 1 -> sessions.first().title else -> "SSH sessions: $count active" } val contentText = when (count) { 0 -> "Ready for connections" 1 -> { val session = sessions.first() "${session.subtitle} · ${session.status}" } else -> "Multiple SSH connections active" } // For multiple sessions, show details in expanded view val style = if (count > 1) { val inbox = Notification.InboxStyle() val maxLines = 5 val displayLines = if (lines.size > maxLines) { lines.take(maxLines) + "...and ${lines.size - maxLines} more" } else { lines } displayLines.forEach { inbox.addLine(it) } inbox.setBigContentTitle(title) inbox } else { null } val notification = builder .setContentTitle(title) .setContentText(contentText) .setSmallIcon(R.mipmap.ic_launcher) .setWhen(earliestStartTime) .setUsesChronometer(true) .setOngoing(true) .setOnlyAlertOnce(true) .setContentIntent(pendingIntent) .addAction( Notification.Action.Builder( Icon.createWithResource(this, android.R.drawable.ic_delete), "Stop All", stopPending ).build() ) if (style != null) { notification.setStyle(style) } return notification.build() } private fun handleUpdateSessions(payload: String) { val nm = getSystemService(NotificationManager::class.java) if (nm == null) { logError("NotificationManager null") return } val sessions = mutableListOf() try { val obj = JSONObject(payload) val arr: JSONArray = obj.optJSONArray("sessions") ?: JSONArray() for (i in 0 until arr.length()) { val s = arr.optJSONObject(i) ?: continue val id = s.optString("id") val title = s.optString("title") val sub = s.optString("subtitle") val whenMs = s.optLong("startTimeMs", System.currentTimeMillis()) val status = s.optString("status", "connected") if (id.isNotEmpty()) { sessions.add(SessionItem(id, title, sub, whenMs, status)) } } } catch (e: Exception) { logError("Failed to parse payload", e) } // Clear if empty if (sessions.isEmpty()) { clearAll() return } // Cancel any existing individual notifications (we only show merged notification now) val toCancel = postedIds.toSet() toCancel.forEach { nm.cancel(it) } postedIds.clear() notificationIdMap.clear() // Create merged notification content val summaryLines = sessions.map { "${it.title}: ${it.status}" } val mergedNotification = createMergedNotification(sessions.size, summaryLines, sessions) ensureForeground(mergedNotification) } private fun clearAll() { val nm = getSystemService(NotificationManager::class.java) nm?.cancel(NOTIFICATION_ID) postedIds.forEach { id -> nm?.cancel(id) } postedIds.clear() isFgStarted = false } data class SessionItem( val id: String, val title: String, val subtitle: String, val startWhen: Long, val status: String, ) private fun stopForegroundService() { try { if (isFgStarted) { stopForeground(STOP_FOREGROUND_REMOVE) isFgStarted = false } } catch (e: Exception) { logError("Error stopping foreground", e) } stopSelf() Log.d("ForegroundService", "ForegroundService stopped") } override fun onDestroy() { super.onDestroy() Log.d("ForegroundService", "Service onDestroy") isRunning = false } } ================================================ FILE: android/app/src/main/kotlin/tech/lolli/toolbox/MainActivity.kt ================================================ package tech.lolli.toolbox import android.content.Intent import android.content.pm.PackageManager import android.os.Build import android.Manifest import android.content.BroadcastReceiver import android.content.Context import android.content.IntentFilter import androidx.core.app.ActivityCompat import androidx.core.content.ContextCompat import io.flutter.embedding.android.FlutterFragmentActivity import io.flutter.embedding.engine.FlutterEngine import io.flutter.plugin.common.MethodChannel import android.appwidget.AppWidgetManager import tech.lolli.toolbox.widget.HomeWidget class MainActivity: FlutterFragmentActivity() { private lateinit var channel: MethodChannel private val ACTION_UPDATE_SESSIONS = "tech.lolli.toolbox.ACTION_UPDATE_SESSIONS" private val ACTION_DISCONNECT_SESSION = "tech.lolli.toolbox.ACTION_DISCONNECT_SESSION" private val ACTION_STOP_ALL_CONNECTIONS = "tech.lolli.toolbox.STOP_ALL_CONNECTIONS" private var stopAllReceiver: BroadcastReceiver? = null override fun configureFlutterEngine(flutterEngine: FlutterEngine) { super.configureFlutterEngine(flutterEngine) val binaryMessenger = flutterEngine.dartExecutor.binaryMessenger channel = MethodChannel(binaryMessenger, "tech.lolli.toolbox/main_chan") channel.setMethodCallHandler { method, result -> when (method.method) { "sendToBackground" -> { moveTaskToBack(true) result.success(null) } "isServiceRunning" -> { result.success(ForegroundService.isRunning) } "startService" -> { try { reqPerm() if (!notificationsAllowed()) { // Don't start foreground service without notification permission on API 33+ result.error("NOTIFICATION_PERMISSION_DENIED", "Notification permission not granted", null) return@setMethodCallHandler } val serviceIntent = Intent(this@MainActivity, ForegroundService::class.java) if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { startForegroundService(serviceIntent) } else { startService(serviceIntent) } result.success(null) } catch (e: Exception) { // Log error but don't crash android.util.Log.e("MainActivity", "Failed to start service: ${e.message}") result.error("SERVICE_ERROR", e.message, null) } } "stopService" -> { val serviceIntent = Intent(this@MainActivity, ForegroundService::class.java) stopService(serviceIntent) result.success(null) } "updateHomeWidget" -> { val intent = Intent(this@MainActivity, HomeWidget::class.java) intent.action = AppWidgetManager.ACTION_APPWIDGET_UPDATE sendBroadcast(intent) result.success(null) } "updateSessions" -> { try { if (!notificationsAllowed()) { // Avoid starting/continuing service updates when notifications are blocked result.error("NOTIFICATION_PERMISSION_DENIED", "Notification permission not granted", null) return@setMethodCallHandler } val serviceIntent = Intent(this@MainActivity, ForegroundService::class.java) serviceIntent.action = ACTION_UPDATE_SESSIONS serviceIntent.putExtra("payload", method.arguments as String) if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { startForegroundService(serviceIntent) } else { startService(serviceIntent) } result.success(null) } catch (e: Exception) { android.util.Log.e("MainActivity", "Failed to update sessions: ${e.message}") result.error("SERVICE_ERROR", e.message, null) } } else -> { result.notImplemented() } } } // Handle intent if launched via notification action handleActionIntent(intent) // Register broadcast receiver for stop all connections setupStopAllReceiver() } private fun reqPerm() { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU) return try { // Check if we already have the permission to avoid unnecessary prompts if (ContextCompat.checkSelfPermission(this, Manifest.permission.POST_NOTIFICATIONS) != PackageManager.PERMISSION_GRANTED) { // Check if we should show rationale if (ActivityCompat.shouldShowRequestPermissionRationale(this, Manifest.permission.POST_NOTIFICATIONS)) { android.util.Log.i("MainActivity", "User previously denied notification permission") } ActivityCompat.requestPermissions( this, arrayOf(Manifest.permission.POST_NOTIFICATIONS), 123, ) } } catch (e: Exception) { // Log error but don't crash android.util.Log.e("MainActivity", "Failed to request permissions: ${e.message}") } } private fun notificationsAllowed(): Boolean { return if (Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU) { true } else { ContextCompat.checkSelfPermission(this, Manifest.permission.POST_NOTIFICATIONS) == PackageManager.PERMISSION_GRANTED } } override fun onNewIntent(intent: Intent) { super.onNewIntent(intent) handleActionIntent(intent) } private fun handleActionIntent(intent: Intent?) { if (intent == null) return when (intent.action) { ACTION_DISCONNECT_SESSION -> { val sessionId = intent.getStringExtra("session_id") if (sessionId != null && ::channel.isInitialized) { try { channel.invokeMethod("disconnectSession", mapOf("id" to sessionId)) } catch (e: Exception) { android.util.Log.e("MainActivity", "Failed to invoke disconnect: ${e.message}") } } } } } private fun setupStopAllReceiver() { stopAllReceiver = object : BroadcastReceiver() { override fun onReceive(context: Context?, intent: Intent?) { if (intent?.action == ACTION_STOP_ALL_CONNECTIONS && ::channel.isInitialized) { try { channel.invokeMethod("stopAllConnections", null) } catch (e: Exception) { android.util.Log.e("MainActivity", "Failed to invoke stopAllConnections: ${e.message}") } } } } val filter = IntentFilter(ACTION_STOP_ALL_CONNECTIONS) if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { ContextCompat.registerReceiver(this, stopAllReceiver, filter, ContextCompat.RECEIVER_NOT_EXPORTED) } else { registerReceiver(stopAllReceiver, filter) } } override fun onRequestPermissionsResult( requestCode: Int, permissions: Array, grantResults: IntArray ) { super.onRequestPermissionsResult(requestCode, permissions, grantResults) if (requestCode == 123) { if (grantResults.isNotEmpty() && grantResults[0] == PackageManager.PERMISSION_GRANTED) { android.util.Log.i("MainActivity", "Notification permission granted") } else { android.util.Log.w("MainActivity", "Notification permission denied") // Optionally inform user about the limitation } } } override fun onDestroy() { super.onDestroy() stopAllReceiver?.let { try { unregisterReceiver(it) } catch (e: Exception) { android.util.Log.e("MainActivity", "Failed to unregister receiver: ${e.message}") } stopAllReceiver = null } } } ================================================ FILE: android/app/src/main/kotlin/tech/lolli/toolbox/widget/HomeWidget.kt ================================================ package tech.lolli.toolbox.widget import android.app.PendingIntent import android.appwidget.AppWidgetManager import android.appwidget.AppWidgetProvider import android.content.Context import android.content.Intent import android.os.Build import android.util.Log import android.view.View import android.widget.RemoteViews import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch import kotlinx.coroutines.withContext import kotlinx.coroutines.withTimeoutOrNull import org.json.JSONObject import org.json.JSONException import tech.lolli.toolbox.R import java.net.URL import java.net.HttpURLConnection import java.net.SocketTimeoutException import java.io.FileNotFoundException import java.io.IOException import java.util.concurrent.ConcurrentHashMap class HomeWidget : AppWidgetProvider() { companion object { private const val TAG = "HomeWidget" private const val NETWORK_TIMEOUT = 10_000L // 10 seconds private const val COROUTINE_TIMEOUT = 15_000L // 15 seconds private val activeUpdates = ConcurrentHashMap() } override fun onUpdate(context: Context, appWidgetManager: AppWidgetManager, appWidgetIds: IntArray) { for (appWidgetId in appWidgetIds) { updateAppWidget(context, appWidgetManager, appWidgetId) } } private fun updateAppWidget(context: Context, appWidgetManager: AppWidgetManager, appWidgetId: Int) { // Prevent concurrent updates for the same widget if (activeUpdates.putIfAbsent(appWidgetId, true) == true) { Log.d(TAG, "Widget $appWidgetId is already updating, skipping") return } val views = RemoteViews(context.packageName, R.layout.home_widget) val url = getWidgetUrl(context, appWidgetId) if (url.isNullOrEmpty()) { Log.w(TAG, "URL not found for widget $appWidgetId") showErrorState(views, appWidgetManager, appWidgetId, "Please configure the widget URL.") activeUpdates.remove(appWidgetId) return } setupClickIntent(context, views, appWidgetId) showLoadingState(views, appWidgetManager, appWidgetId) CoroutineScope(Dispatchers.IO).launch { withTimeoutOrNull(COROUTINE_TIMEOUT) { try { val serverData = fetchServerData(url) if (serverData != null) { withContext(Dispatchers.Main) { showSuccessState(views, appWidgetManager, appWidgetId, serverData) } } else { withContext(Dispatchers.Main) { showErrorState(views, appWidgetManager, appWidgetId, "Invalid server data received.") } } } catch (e: Exception) { Log.e(TAG, "Error updating widget $appWidgetId: ${e.message}", e) withContext(Dispatchers.Main) { val errorMessage = when (e) { is SocketTimeoutException -> "Connection timeout. Please check your network." is IOException -> "Network error. Please check your connection." is JSONException -> "Invalid data format received from server." else -> "Failed to retrieve data: ${e.message}" } showErrorState(views, appWidgetManager, appWidgetId, errorMessage) } } } ?: run { Log.w(TAG, "Widget update timed out for widget $appWidgetId") withContext(Dispatchers.Main) { showErrorState(views, appWidgetManager, appWidgetId, "Update timed out. Please try again.") } } activeUpdates.remove(appWidgetId) } } private fun getWidgetUrl(context: Context, appWidgetId: Int): String? { val sp = context.getSharedPreferences("FlutterSharedPreferences", Context.MODE_PRIVATE) return sp.getString("widget_$appWidgetId", null) ?: sp.getString("$appWidgetId", null) ?: sp.getString("widget_*", null) } private fun setupClickIntent(context: Context, views: RemoteViews, appWidgetId: Int) { val intentConfigure = Intent(context, WidgetConfigureActivity::class.java).apply { putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId) } val flag = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE } else { PendingIntent.FLAG_UPDATE_CURRENT } val pendingConfigure = PendingIntent.getActivity(context, appWidgetId, intentConfigure, flag) views.setOnClickPendingIntent(R.id.widget_container, pendingConfigure) } private suspend fun fetchServerData(url: String): ServerData? = withContext(Dispatchers.IO) { var connection: HttpURLConnection? = null try { connection = (URL(url).openConnection() as HttpURLConnection).apply { requestMethod = "GET" connectTimeout = NETWORK_TIMEOUT.toInt() readTimeout = NETWORK_TIMEOUT.toInt() setRequestProperty("User-Agent", "ServerBox-Widget/1.0") setRequestProperty("Accept", "application/json") } if (connection.responseCode != HttpURLConnection.HTTP_OK) { throw IOException("HTTP ${connection.responseCode}: ${connection.responseMessage}") } val jsonStr = connection.inputStream.bufferedReader().use { it.readText() } parseServerData(jsonStr) } finally { connection?.disconnect() } } private fun parseServerData(jsonStr: String): ServerData? { return try { val jsonObject = JSONObject(jsonStr) val data = jsonObject.getJSONObject("data") val server = data.optString("name", "Unknown Server") val cpu = data.optString("cpu", "").takeIf { it.isNotBlank() } ?: "N/A" val mem = data.optString("mem", "").takeIf { it.isNotBlank() } ?: "N/A" val disk = data.optString("disk", "").takeIf { it.isNotBlank() } ?: "N/A" val net = data.optString("net", "").takeIf { it.isNotBlank() } ?: "N/A" // Return data even if some fields are missing, providing defaults // Only reject if we can't parse the JSON structure properly ServerData(server, cpu, mem, disk, net) } catch (e: JSONException) { Log.e(TAG, "JSON parsing error: ${e.message}", e) null } } private fun showLoadingState(views: RemoteViews, appWidgetManager: AppWidgetManager, appWidgetId: Int) { views.apply { setTextViewText(R.id.widget_name, "Loading...") setViewVisibility(R.id.error_message, View.GONE) setViewVisibility(R.id.widget_content, View.VISIBLE) setViewVisibility(R.id.widget_cpu_label, View.VISIBLE) setViewVisibility(R.id.widget_mem_label, View.VISIBLE) setViewVisibility(R.id.widget_disk_label, View.VISIBLE) setViewVisibility(R.id.widget_net_label, View.VISIBLE) setViewVisibility(R.id.widget_progress, View.VISIBLE) setFloat(R.id.widget_name, "setAlpha", 0.7f) } appWidgetManager.updateAppWidget(appWidgetId, views) } private fun showSuccessState(views: RemoteViews, appWidgetManager: AppWidgetManager, appWidgetId: Int, data: ServerData) { views.apply { setTextViewText(R.id.widget_name, data.name) setTextViewText(R.id.widget_cpu, data.cpu) setTextViewText(R.id.widget_mem, data.mem) setTextViewText(R.id.widget_disk, data.disk) setTextViewText(R.id.widget_net, data.net) val timeStr = android.text.format.DateFormat.format("HH:mm", java.util.Date()).toString() setTextViewText(R.id.widget_time, timeStr) setViewVisibility(R.id.error_message, View.GONE) setViewVisibility(R.id.widget_content, View.VISIBLE) setViewVisibility(R.id.widget_progress, View.GONE) // Smooth fade-in animation setFloat(R.id.widget_name, "setAlpha", 1f) setFloat(R.id.widget_cpu_label, "setAlpha", 1f) setFloat(R.id.widget_mem_label, "setAlpha", 1f) setFloat(R.id.widget_disk_label, "setAlpha", 1f) setFloat(R.id.widget_net_label, "setAlpha", 1f) setFloat(R.id.widget_time, "setAlpha", 1f) } appWidgetManager.updateAppWidget(appWidgetId, views) } private fun showErrorState(views: RemoteViews, appWidgetManager: AppWidgetManager, appWidgetId: Int, errorMessage: String) { views.apply { setTextViewText(R.id.widget_name, "Error") setViewVisibility(R.id.error_message, View.VISIBLE) setTextViewText(R.id.error_message, errorMessage) setViewVisibility(R.id.widget_content, View.GONE) setViewVisibility(R.id.widget_progress, View.GONE) setFloat(R.id.widget_name, "setAlpha", 1f) setFloat(R.id.error_message, "setAlpha", 1f) } appWidgetManager.updateAppWidget(appWidgetId, views) } data class ServerData( val name: String, val cpu: String, val mem: String, val disk: String, val net: String ) } ================================================ FILE: android/app/src/main/kotlin/tech/lolli/toolbox/widget/WidgetConfigureActivity.kt ================================================ package tech.lolli.toolbox.widget import android.app.Activity import android.appwidget.AppWidgetManager import android.content.Intent import android.os.Bundle import android.util.Patterns import android.widget.Button import android.widget.EditText import tech.lolli.toolbox.R class WidgetConfigureActivity : Activity() { private var appWidgetId = AppWidgetManager.INVALID_APPWIDGET_ID private lateinit var urlEditText: EditText private lateinit var saveButton: Button override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.widget_configure) // 设置结果为取消,以防用户在完成配置前退出 setResult(RESULT_CANCELED) // 获取 widget ID val extras = intent.extras if (extras != null) { appWidgetId = extras.getInt( AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID ) } // 如果没有有效的 widget ID,完成 activity if (appWidgetId == AppWidgetManager.INVALID_APPWIDGET_ID) { finish() return } // 初始化 UI 元素 urlEditText = findViewById(R.id.url_edit_text) saveButton = findViewById(R.id.save_button) // 从 SharedPreferences 加载现有配置 val sp = getSharedPreferences("FlutterSharedPreferences", MODE_PRIVATE) val existingUrl = sp.getString("widget_$appWidgetId", "") urlEditText.setText(existingUrl) // 设置保存按钮点击事件 saveButton.setOnClickListener { val url = urlEditText.text.toString().trim() if (url.isEmpty()) { urlEditText.error = "Please enter a URL" return@setOnClickListener } // 验证 URL 格式 if (!Patterns.WEB_URL.matcher(url).matches()) { urlEditText.error = "Please enter a valid URL" return@setOnClickListener } // 保存 URL 到 SharedPreferences val editor = sp.edit() editor.putString("widget_$appWidgetId", url) editor.apply() // 更新 widget 使用 AppWidgetManager val appWidgetManager = AppWidgetManager.getInstance(this) val updateIntent = Intent(this, HomeWidget::class.java).apply { action = AppWidgetManager.ACTION_APPWIDGET_UPDATE putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, intArrayOf(appWidgetId)) } sendBroadcast(updateIntent) // 设置结果并结束 activity val resultValue = Intent() resultValue.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId) setResult(RESULT_OK, resultValue) finish() } } } ================================================ FILE: android/app/src/main/res/drawable/launch_background.xml ================================================ ================================================ FILE: android/app/src/main/res/drawable/memory_24.xml ================================================ ================================================ FILE: android/app/src/main/res/drawable/net_24.xml ================================================ ================================================ FILE: android/app/src/main/res/drawable/settings_24.xml ================================================ ================================================ FILE: android/app/src/main/res/drawable/speed_24.xml ================================================ ================================================ FILE: android/app/src/main/res/drawable/storage_24.xml ================================================ ================================================ FILE: android/app/src/main/res/drawable/widget_background.xml ================================================ ================================================ FILE: android/app/src/main/res/drawable-night/launch_background.xml ================================================ ================================================ FILE: android/app/src/main/res/drawable-night-v21/launch_background.xml ================================================ ================================================ FILE: android/app/src/main/res/drawable-v21/launch_background.xml ================================================ ================================================ FILE: android/app/src/main/res/layout/home_widget.xml ================================================ ================================================ FILE: android/app/src/main/res/layout/widget_configure.xml ================================================