FireflyApp

FireflyApp

将网站打包成精致的 Android 原生应用

Turn websites into polished Android apps

核心特性Features

近期更新

Recent Updates

现已包含真正的 Top + Tabs 模板、可配置的 SSL 证书错误处理,以及相册导入自定义图标能力。

Now includes a true Top + Tabs template, configurable SSL certificate handling, and gallery-imported custom icons.

🎨

7 种 UI 模板

7 UI Templates

底部导航 / 顶部工具栏 / 侧滑抽屉 / 沉浸全屏等,覆盖主流 App 布局。

Bottom Bar / Top Bar / Side Drawer / Immersive, covering mainstream layouts.

📦

设备端打包

On-Device Packing

无需电脑或服务器,在手机上直接完成 APK 打包与签名。

No PC or server needed. Build & sign APK on your phone.

🛠

可视化编辑器

Visual Editor

分 Tab 编辑所有配置:基础 / 规则 / 事件 / 品牌 / 构建。

Tab-based editor: Basic / Rules / Events / Branding / Build.

🌐

完整浏览器权限

Full Web Capability

支持 Cookie、存储、文件及前置安全提示(摄像头/麦克风/定位/通知等)。

Supports Cookie, storage, files & secure prompts (cam/mic/location/notify).

🔒

安全策略

Security Policies

域名白名单、外链拦截、SSL 证书错误处理可配置、路径穿越防护。

Host whitelist, configurable SSL handling, and path traversal protection.

🎯

页面规则 & 事件

Page Rules & Events

按 URL 匹配注入 JS/CSS、自定义错误页、监听页面生命周期。

Inject JS/CSS per URL, custom error pages, lifecycle listeners.

🌙

夜间模式

Night Mode

支持手动开启或跟随系统深色主题自动切换。

Manual toggle or auto-switch with system dark theme.

🌍

多语言支持

Multi-Language

内置简体中文和英文,支持跟随系统语言。

Built-in Chinese & English, follows system language.

UI 模板UI Templates

选择不同的原生壳模板,一键切换应用的导航风格。

Choose a native shell template to switch the app's navigation style.

🌐

Browser browser

纯 WebView 全屏,无原生导航栏,适合独立网页应用。

Fullscreen WebView without native bars, ideal for web apps.

🖥

Immersive immersive_single_page

沉浸全屏模式,隐藏状态栏和导航栏,适合游戏与媒体。

Immersive mode, hides all system bars. Great for games & media.

📌

Top Bar top_bar

顶部工具栏,支持标题、返回、刷新、主页按钮。

Toolbar with title, back, refresh, and home buttons.

📱

Bottom Bar bottom_bar

底部 Tab 导航,最多 5 个标签页,最常用的 App 布局。

Bottom tabs (up to 5). The most common app layout.

🔲

Top + Tabs top_bar_tabs

顶部工具栏 + 顶部 Tab 组合,适合内容丰富的应用。

Top bar with top tabs, ideal for fast section switching.

📱

Top + BottomBar top_bar_bottom_tabs

顶部工具栏 + 底栏导航,适合内容丰富的应用。

Top bar with bottom navigation, ideal for content-rich apps.

Side Drawer side_drawer

侧滑抽屉菜单,支持自定义壁纸和头像。

Swipeable drawer with custom wallpaper & avatar.

快速开始Quick Start
1

创建项目

Create a Project

在项目中心点击「New Project」,输入项目名称即可创建。

Tap "New Project" in Project Hub and enter a project name.

2

编辑配置

Edit Configuration

在配置编辑器中设置目标网站 URL、选择模板、添加导航项、调整外观和行为。

Set the target URL, choose a template, add navigation items, and customize appearance.

3

预览效果

Preview

点击「Preview」实时查看应用效果,所见即所得。

Tap "Preview" for a live preview. What you see is what you get.

4

打包安装

Pack & Install

进入 Pack 界面 → Prepare → Pack → 生成签名 APK → 安装或分享。

Go to Pack → Prepare → Pack → Get signed APK → Install or share.

配置参考Configuration Reference

所有行为由 app-config.json 驱动。以下是主要配置项。

All behavior is driven by app-config.json. Key fields listed below.

补充说明:当前版本还支持 sslErrorHandling、首页/刷新按钮 run_js 行为,以及 custom://branding/custom-icons/... 自定义图标引用。

Additional fields now include sslErrorHandling, run_js for Home/Refresh button behaviors, and custom icon references such as custom://branding/custom-icons/....

📋 app
字段Field说明Description
name应用名称Application display name
template模板类型(见上方模板列表)Template type (see templates above)
defaultUrl默认主页 URLDefault home page URL
🌐 browser
字段Field说明Description
javaScriptEnabled启用 JavaScriptEnable JavaScript
domStorageEnabled启用 DOM 存储(localStorage 等)Enable DOM storage (localStorage, etc.)
userAgent自定义 User-Agent(留空用系统默认)Custom UA (blank = system default)
backAction返回键行为:go_back_or_exit / go_back_or_homeBack button: go_back_or_exit / go_back_or_home
nightMode夜间模式:off / on / follow_themeNight mode: off / on / follow_theme
🔒 security
字段Field说明Description
allowedHosts域名白名单数组,支持 *.example.comHost whitelist array, supports wildcards
allowExternalHosts是否允许打开白名单外的 URLAllow URLs outside the whitelist
openOtherAppsMode跳转外部应用:ask / allow / blockExternal app launch: ask / allow / block

最小可用配置示例:

Minimal working configuration:

// app-config.json { "app": { "name": "My App", "template": "bottom_bar", "defaultUrl": "https://example.com" }, "navigation": { "items": [ { "id": "home", "title": "Home", "url": "https://example.com", "icon": "home" } ] }, "security": { "allowedHosts": ["example.com"] } }
页面事件系统Page Event System

监听页面生命周期事件,触发原生或 JavaScript 动作。

Listen to page lifecycle events and trigger native or JS actions.

触发器 Triggers

Triggers

page_started page_finished page_title_changed page_left spa_url_changed

动作 Actions

Actions

toast load_url open_external reload reload_ignore_cache go_back copy_to_clipboard run_js

动作字段支持模板变量:{url} {title} {trigger} {previousUrl} {nextUrl}

Template variables: {url} {title} {trigger} {previousUrl} {nextUrl}

📦 打包原理Pack Pipeline

FireflyApp 采用 Template APK Repack 方案,在 Android 设备上完成全部流程:

FireflyApp uses Template APK Repack, completing the entire process on-device:

解压模板

Unpack Template

从宿主 assets 中提取预编译的 unsigned 模板 APK 并解压。

Extract the pre-compiled unsigned template APK from host assets.

注入配置与资产

Inject Config & Assets

将项目的 app-config.json、启动图标、Splash 图片注入到解压目录。

Inject app-config.json, launcher icon, splash image into the unpacked dir.

二进制 Manifest 修改

Binary Manifest Patching

直接操作编译后的二进制 AndroidManifest.xml,替换包名、应用名、版本号(无需 AAPT)。

Patch binary AndroidManifest.xml — replace package name, label, version (no AAPT).

重打包 → 对齐 → 签名

Repackage → Align → Sign

重新打包为 APK → zipalign 对齐 → 使用 AndroidKeyStore 或自定义 JKS 签名。

Repackage → zipalign → Sign with AndroidKeyStore or custom JKS.

产物自检及导出

Self-Check & Export

执行产物自检(Manifest完整性、签名及系统解析校验),生成最终可用 APK 以供安装或分享。

Perform artifact self-check (Manifest, Sig validation) and output final APK to install or share.

🗂 侧边栏工具Sidebar Tools

项目中心(Project Hub)提供以下快捷工具:

Quick access tools in the Project Hub drawer:

📄

说明文档

Help Documentation

即当前应用内置的中英双语离线使用手册。

The built-in bilingual offline manual you're currently viewing.

🎨

图标设计器

Icon Designer

可视化定制应用图标(底色、文字、圆角、尺寸)并导出。

Visually customize app icons (bg, transparent bg, text, radius, size) and export.

📦

图标仓库

Icon Catalog

浏览项目内置 Material 图标库,辅助配置向导。

Browse built-in icons and combine them with gallery-imported custom icons in the editor.

🌐

语言及状态切换

State Toggles

支持多语言自由切换,亦可随时隐藏或展示 Dashboard 图表概览。

Support multi-lang toggles and hiding/showing the dashboard overview.

🛡 安全机制Security

当前版本支持将 SSL 证书错误处理设置为严格校验或忽略,默认仍为严格校验。

Current versions support SSL certificate handling as either strict or ignore. Strict remains the default.

🌐

域名白名单

Host Whitelist

通过 allowedHosts 控制可访问的域名,支持通配符。

Control accessible domains via allowedHosts. Supports wildcards.

🚫

外链拦截

External Link Blocking

白名单外的 URL 可配置为弹窗确认、直接允许或完全阻止。

URLs outside whitelist: ask, allow, or block.

🔐

SSL 强制校验

SSL Enforcement

遇到 SSL 证书错误时一律拒绝加载,不提供跳过选项。

SSL errors are always rejected. No bypass option.

📂

路径安全

Path Safety

项目文件路径经过清洗,防止 ../ 等路径穿越攻击。

File paths sanitized to prevent path traversal attacks.

? 常见问题FAQ
打包出来的 APP 支持 Cookie 和 Storage 吗? Does the packed app support Cookie & Storage?
支持。Cookie(含第三方 Cookie)、localStorage、sessionStorage、IndexedDB 均默认启用。数据存储在 APP 的私有沙盒中,卸载 APP 才会清除。 Yes. Cookie (including third-party), localStorage, sessionStorage, and IndexedDB are all enabled by default. Data is stored in the app's private sandbox.
导航项最多能添加几个? How many navigation items can I add?
最多 5 个导航项。如果需要更多入口,可以使用 Side Drawer 模板。 Up to 5 items. For more entries, consider the Side Drawer template.
可以使用自己的签名密钥吗? Can I use my own signing key?
可以。在配置编辑器的 Build 页导入自定义 JKS / PKCS12 密钥库。如果不导入,将使用设备本地 AndroidKeyStore 自动生成的密钥。 Yes. Import JKS / PKCS12 in the Build tab. Otherwise, a device-local AndroidKeyStore key is used.
如何注入全局 JavaScript 或 CSS? How to inject global JavaScript or CSS?
在配置的 inject 部分添加 globalJs 和 globalCss 数组。还可以通过 pageRules 按 URL 匹配做页面级注入。 Add globalJs and globalCss arrays in the inject section. Use pageRules for per-URL injection.
网页调用摄像头、前置权限或系统级接口怎么办? How does the app handle camera, mic or native APIs?
APP 建立了完善的安全网机制(类似现代浏览器)。页面请求敏感权限(定位、通知系统等)会先触发双语前置提示,用户的信任选择会被持久化记忆;各类软硬件接口如文件选取也会接管为系统原生的。 The app guarantees a secure sandboxed approach. When requesting sensitive APIs (cam, mic, notification, GPS), a bilingual confirmation prompt pops up guaranteeing safety before native trigger. File upload menus act natively too.
SPA 单页应用的路由变化能监听吗? Can I detect SPA route changes?
可以。使用页面事件系统的 spa_url_changed 触发器,内部通过 MutationObserver 检测 URL 变化。 Yes. Use the spa_url_changed trigger. Internally uses MutationObserver to detect URL changes.
如何导入/导出项目? How to import/export projects?
项目中心支持导入 .fireflyproj.zip 项目包或 app-config.json 配置文件。导出可将项目打包为 ZIP 分享给他人。 Project Hub supports importing .fireflyproj.zip or app-config.json. Export bundles the project as ZIP.