diff --git a/.gitignore b/.gitignore index f613622a1..3e61a2fcf 100644 --- a/.gitignore +++ b/.gitignore @@ -43,6 +43,7 @@ coverage/ # Build out/ bundle/ +.flatpak-builder/ # WXT specified this too *.output diff --git a/apps/stage-tamagotchi/ai.moeru.airi.desktop b/apps/stage-tamagotchi/ai.moeru.airi.desktop new file mode 100644 index 000000000..4b29b664b --- /dev/null +++ b/apps/stage-tamagotchi/ai.moeru.airi.desktop @@ -0,0 +1,10 @@ +[Desktop Entry] +Name=AIRI +Exec=airi %U +Terminal=false +Type=Application +Icon=ai.moeru.airi +StartupWMClass=AIRI +Comment=AIRI is an AI VTuber/Waifu chatbot supporting Live2D/VRM avatars, featuring human-like interactions and modular stage-based rendering. +Categories=Utility; + diff --git a/apps/stage-tamagotchi/ai.moeru.airi.flatpak.yml b/apps/stage-tamagotchi/ai.moeru.airi.flatpak.yml new file mode 100644 index 000000000..c70be7fce --- /dev/null +++ b/apps/stage-tamagotchi/ai.moeru.airi.flatpak.yml @@ -0,0 +1,78 @@ +app-id: ai.moeru.airi +runtime: org.freedesktop.Platform +runtime-version: '24.08' +sdk: org.freedesktop.Sdk +base: org.electronjs.Electron2.BaseApp +base-version: '24.08' +command: airi.sh + +finish-args: + # GUI environment + - --share=network + - --socket=x11 + - --socket=wayland + - --device=all + - --socket=pulseaudio + - --socket=system-bus + - --socket=session-bus + - --share=ipc + + # DBus + - --talk-name=org.freedesktop.Notifications + - --talk-name=org.freedesktop.portal.Desktop + - --system-talk-name=org.freedesktop.login1 + - --system-talk-name=org.freedesktop.UPower + - --filesystem=home:rw + +modules: + - name: AIRI-App + buildsystem: simple + build-commands: + - mkdir -p /app/bin + - mkdir -p /app/bin/airi + - cp -r ./* /app/bin/airi/ + - chmod +x /app/bin/airi/airi + - install airi.sh /app/bin/airi.sh + - chmod +x /app/bin/airi/airi.sh + - ls -la /app/bin/airi/ + - ls -la /app/bin/airi/airi + sources: + - type: dir + only-arches: [x86_64] + path: dist/linux-unpacked + - type: dir + only-arches: [aarch64] + path: dist/linux-arm64-unpacked + # First discovered by [@gg582](https://github.com/gg582) in https://github.com/moeru-ai/airi/pull/647 + # + # Without the correct zypak-wrapper, application launch will result in this error: + # content/browser/zygote_host/zygote_host_impl_linux.cc:132] No usable sandbox! ... If you want to live + # dangerously and need an immediate workaround, you can try using --no-sandbox. + # + # Though https://github.com/refi64/chromium-tar/blob/82ebd6a0473341fa75dd3bbb2f584da99f5ac92c/content/browser/zygote_host/zygote_host_impl_linux.cc#L104-L131 + # suggests that the error is related to missing switch of service_manager::switches::kDisableNamespaceSandbox and + # service_manager::switches::kDisableSetuidSandbox, even if we add --no-sandbox to the command, the application basically + # exits immediately without any error message and traces. + # + # When searching for solutions, I spotted the session-desktop issue below looks exactly the same and + # they managed to resolve it by renaming the executable command with -app suffix, however the wrapper + # called zypak-wrapper is the key to resolve this issue: + # https://github.com/session-foundation/session-desktop/issues/795 + # https://github.com/flathub/network.loki.Session/pull/32 + # + # Similar keywords appears in the official docs of Flatpak as well: + # https://docs.flatpak.org/en/latest/electron.html#launching-the-app + # + # With the correct way to research, I found several examples of Electron apps using zypak-wrapper: + # https://github.com/chaiNNer-org/chaiNNer/issues/1597#issuecomment-3272020725 + # https://github.com/vendillah/app.Chainner.chainner/blob/main/app.chainner.Chainner.yaml + # + # and bitwarden, as the most popular password manager app, it's architecture and bundle workflow looked + # almost the same as ours, most of the structure of this manifest is based on bitwarden's: + # https://github.com/bitwarden/clients/blob/b8d55c4db178de67f1778bc307f7c22aad01f4a9/apps/desktop/resources/com.bitwarden.desktop.devel.yaml + - type: script + dest-filename: airi.sh + commands: + - ulimit -c 0 + - export TMPDIR="$XDG_RUNTIME_DIR/app/$FLATPAK_ID" + - exec zypak-wrapper /app/bin/airi/airi "$@" diff --git a/apps/stage-tamagotchi/electron-builder.yml b/apps/stage-tamagotchi/electron-builder.yml index 5f8b521d9..fdd4703af 100644 --- a/apps/stage-tamagotchi/electron-builder.yml +++ b/apps/stage-tamagotchi/electron-builder.yml @@ -1,8 +1,14 @@ appId: ai.moeru.airi productName: AIRI + directories: + output: dist buildResources: build + files: + - out/** + - resources/** + - package.json - '!**/.vscode/*' - '!src/*' - '!electron.vite.config.{js,ts,mjs,cjs}' @@ -11,35 +17,53 @@ files: - '!{.eslintcache,eslint.config.ts,.yaml,dev-app-update.yml,CHANGELOG.md,README.md}' - '!{.env,.env.*,.npmrc,pnpm-lock.yaml}' - '!{tsconfig.json}' + +asar: true asarUnpack: - resources/** + - out/renderer/** + +extraMetadata: + main: 'out/main/index.js' + win: - executableName: AIRI + executableName: airi nsis: artifactName: ${productName}-${version}-windows-${arch}-setup.${ext} shortcutName: ${productName} uninstallDisplayName: ${productName} createDesktopShortcut: always deleteAppDataOnUninstall: true + mac: entitlementsInherit: build/entitlements.mac.plist extendInfo: - NSDocumentsFolderUsageDescription: Application requests access to the user's Documents folder. - NSDownloadsFolderUsageDescription: Application requests access to the user's Downloads folder. notarize: false - executableName: AIRI + executableName: airi dmg: artifactName: ${productName}-${version}-darwin-${arch}.${ext} + linux: target: - - AppImage + - deb + - rpm maintainer: moeru.ai category: Utility - executableName: AIRI + synopsis: 'AI VTuber/Waifu chatbot app inspired by Neuro-sama.' + description: 'AIRI is an AI VTuber/Waifu chatbot supporting Live2D/VRM avatars, featuring human-like interactions and modular stage-based rendering.' + executableName: airi artifactName: ${productName}-${version}-linux-${arch}.${ext} + icon: build/icons/icon.png + appImage: artifactName: ${productName}-${version}-linux-${arch}.${ext} + +snap: + confinement: strict + grade: stable + summary: 'AI VTuber/Waifu chatbot app inspired by Neuro-sama' + description: 'AIRI enables human-like conversational interaction with Live2D/VRM avatars, designed for VTuber streaming and AI-driven performance.' + npmRebuild: false -publish: - provider: generic - url: https://example.com/auto-updates diff --git a/apps/stage-tamagotchi/resources/icon.svg b/apps/stage-tamagotchi/resources/icon.svg new file mode 100644 index 000000000..e5a37b8a2 --- /dev/null +++ b/apps/stage-tamagotchi/resources/icon.svg @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +