Initial commit
Some checks failed
Main Deploy Workflow / deploy_web (push) Has been cancelled
Main Deploy Workflow / deploy_playstore_internal (push) Has been cancelled
Close stale issues and PRs / stale (push) Has been cancelled

This commit is contained in:
2026-09-11 15:59:56 -03:00
commit 0037b0b9cf
651 changed files with 199705 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
#!/usr/bin/env bash
# SPDX-FileCopyrightText: 2019-Present Christian Kußowski
# SPDX-FileCopyrightText: 2019-Present Contributors to FluffyChat
#
# SPDX-License-Identifier: AGPL-3.0-or-later
flutter pub add fcm_shared_isolate
flutter pub get
if [[ "$OSTYPE" == "darwin"* ]]; then
sed -i '' 's,//<GOOGLE_SERVICES>,,g' lib/utils/background_push.dart
sed -i '' -e 's,^/\*,,' -e 's,\*/$,,' android/app/src/main/kotlin/chat/fluffy/fluffychat/FcmPushService.kt
else
sed -i 's,//<GOOGLE_SERVICES>,,g' lib/utils/background_push.dart
sed -i -e 's,^/\*,,' -e 's,\*/$,,' android/app/src/main/kotlin/chat/fluffy/fluffychat/FcmPushService.kt
fi

84
scripts/build-ios.sh Normal file
View File

@@ -0,0 +1,84 @@
#!/usr/bin/env bash
# SPDX-FileCopyrightText: 2019-Present Christian Kußowski
# SPDX-FileCopyrightText: 2019-Present Contributors to FluffyChat
#
# SPDX-License-Identifier: AGPL-3.0-or-later
git apply ./scripts/enable-android-google-services.patch
FLUFFYCHAT_ORIG_GROUP="im.fluffychat"
FLUFFYCHAT_ORIG_TEAM="4NXF6Z997G"
#FLUFFYCHAT_NEW_GROUP="com.example.fluffychat"
#FLUFFYCHAT_NEW_TEAM="ABCDE12345"
# In some cases (ie: running beta XCode releases) some pods haven't updated their minimum version
# but XCode will reject the package for using too old of a minimum version.
# This will fix that, but. Well. Use at your own risk.
# export I_PROMISE_IM_REALLY_SMART=1
# If you want to automatically install the app
# export FLUFFYCHAT_INSTALL_IPA=1
### Rotate IDs ###
[ -n "${FLUFFYCHAT_NEW_GROUP}" ] && {
# App group IDs
sed -i "" "s/group.${FLUFFYCHAT_ORIG_GROUP}.app/group.${FLUFFYCHAT_NEW_GROUP}.app/g" "ios/FluffyChat Share/FluffyChat Share.entitlements"
sed -i "" "s/group.${FLUFFYCHAT_ORIG_GROUP}.app/group.${FLUFFYCHAT_NEW_GROUP}.app/g" "ios/Runner/Runner.entitlements"
sed -i "" "s/group.${FLUFFYCHAT_ORIG_GROUP}.app/group.${FLUFFYCHAT_NEW_GROUP}.app/g" "ios/Runner.xcodeproj/project.pbxproj"
# Bundle identifiers
sed -i "" "s/${FLUFFYCHAT_ORIG_GROUP}.app/${FLUFFYCHAT_NEW_GROUP}.app/g" "ios/Runner.xcodeproj/project.pbxproj"
}
[ -n "${FLUFFYCHAT_NEW_TEAM}" ] && {
# Code signing team
sed -i "" "s/${FLUFFYCHAT_ORIG_TEAM}/${FLUFFYCHAT_NEW_TEAM}/g" "ios/Runner.xcodeproj/project.pbxproj"
}
cat << EOHELP
If something later in the build explodes, and looks possibly related to App IDs:
1. Ask Xcode nicely
- Open ios/Runner.xcodeproj in Xcode
- Go to the Signing & Capabilities tab
- Ask it to repair the certificates/register app IDs/etc
2. Fix it yourself
- Go to https://developer.apple.com/account/resources/identifiers/list
- Ensure that Xcode created the App ID successfully (for fluffychat.app and fluffychat.app.FluffyChat-Share)
- Under "App Groups", make sure it registered your group
- Back "App IDs", check that the App Group was added to each App ID's entitlements
EOHELP
### [optional] override pods minimum iphoneos deployment target ###
[ -n "${I_PROMISE_IM_REALLY_SMART}" ] && {
# 1. I'm sorry about the indentation't ;_; heredocs are weird about it
# 2. The patch basically just removes any preference on target iOS version
# This lets our default from ios/Flutter/AppFrameworkInfo.plist take precendence
cat << EOPATCH | patch --forward --reject-file=apple_please_fix_your_coreutils --silent ios/Podfile
diff --git a/ios/Podfile b/ios/Podfile
index 9411102b..0446120a 100644
--- a/ios/Podfile
+++ b/ios/Podfile
@@ -37,5 +37,8 @@ end
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
+ target.build_configurations.each do |config|
+ config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'
+ end
end
end
EOPATCH
rm -f apple_please_fix_your_coreutils
}
### Make release build ###
flutter build ipa --release
### [optional] Install release build ###
[ -n "${FLUFFYCHAT_INSTALL_IPA}" ] && {
TMPDIR=$(mktemp -d)
# 1. Turn the xcarchive that flutter created into a dev-signed IPA
echo '{"compileBitcode":false,"method":"development"}' | plutil -convert xml1 -o "${TMPDIR}/options.plist" -
xcodebuild -exportArchive -archivePath ./build/ios/archive/Runner.xcarchive -exportPath "${TMPDIR}" -exportOptionsPlist "${TMPDIR}/options.plist"
# 2. ...and install it on your connected devices
cfgutil --foreach install-app "${TMPDIR}/fluffychat.ipa"
rm -rf "${TMPDIR}"
}

39
scripts/build-macos.sh Normal file
View File

@@ -0,0 +1,39 @@
#!/usr/bin/env bash
# SPDX-FileCopyrightText: 2019-Present Christian Kußowski
# SPDX-FileCopyrightText: 2019-Present Contributors to FluffyChat
#
# SPDX-License-Identifier: AGPL-3.0-or-later
git apply ./scripts/enable-android-google-services.patch
FLUFFYCHAT_ORIG_GROUP="im.fluffychat"
FLUFFYCHAT_ORIG_TEAM="4NXF6Z997G"
#FLUFFYCHAT_NEW_GROUP="com.example.fluffychat"
#FLUFFYCHAT_NEW_TEAM="ABCDE12345"
# In some cases (ie: running beta XCode releases) some pods haven't updated their minimum version
# but XCode will reject the package for using too old of a minimum version.
# This will fix that, but. Well. Use at your own risk.
# export I_PROMISE_IM_REALLY_SMART=1
# If you want to automatically install the app
# export FLUFFYCHAT_INSTALL_IPA=1
### Rotate IDs ###
[ -n "${FLUFFYCHAT_NEW_GROUP}" ] && {
# App group IDs
sed -i "" "s/group.${FLUFFYCHAT_ORIG_GROUP}.app/group.${FLUFFYCHAT_NEW_GROUP}.app/g" "macos/Runner/Runner.entitlements"
sed -i "" "s/group.${FLUFFYCHAT_ORIG_GROUP}.app/group.${FLUFFYCHAT_NEW_GROUP}.app/g" "macos/Runner.xcodeproj/project.pbxproj"
# Bundle identifiers
sed -i "" "s/${FLUFFYCHAT_ORIG_GROUP}.app/${FLUFFYCHAT_NEW_GROUP}.app/g" "macos/Runner.xcodeproj/project.pbxproj"
}
[ -n "${FLUFFYCHAT_NEW_TEAM}" ] && {
# Code signing team
sed -i "" "s/${FLUFFYCHAT_ORIG_TEAM}/${FLUFFYCHAT_NEW_TEAM}/g" "macos/Runner.xcodeproj/project.pbxproj"
}
### Make release build ###
flutter build macos --release
echo "Build build/macos/Build/Products/Release/FluffyChat.app"

12
scripts/build-windows.ps1 Normal file
View File

@@ -0,0 +1,12 @@
# SPDX-FileCopyrightText: 2019-Present Christian Kußowski
# SPDX-FileCopyrightText: 2019-Present Contributors to FluffyChat
#
# SPDX-License-Identifier: AGPL-3.0-or-later
flutter doctor
flutter config --enable-windows-desktop
flutter clean
flutter pub get
flutter build windows --release -v

View File

@@ -0,0 +1,36 @@
#!/bin/bash
# SPDX-FileCopyrightText: 2019-Present Christian Kußowski
# SPDX-FileCopyrightText: 2019-Present Contributors to FluffyChat
#
# SPDX-License-Identifier: AGPL-3.0-or-later
# Directory containing the ARB files
l10n_dir="./lib/l10n"
# Target directory for the locale_config.xml file
xml_dir="./android/app/src/main/res/xml"
# Create the target directory if it does not exist
mkdir -p "$xml_dir"
# Output file name
xml_file="$xml_dir/locale_config.xml"
rm -rf "$xml_file"
# XML Header
echo '<?xml version="1.0" encoding="utf-8"?>' > "$xml_file"
echo '<locale-config xmlns:android="http://schemas.android.com/apk/res/android">' >> "$xml_file"
# Search for ARB files and extract language codes
for file in "$l10n_dir"/intl_*.arb; do
# Extract language code
language_code=$(basename "$file" | cut -d'_' -f2 | cut -d'.' -f1)
# Write language code to the XML file
echo " <locale android:name=\"$language_code\"/>" >> "$xml_file"
done
# XML Footer
echo '</locale-config>' >> "$xml_file"
echo "locale_config.xml file has been successfully created in the $xml_dir directory."

View File

@@ -0,0 +1,36 @@
#!/usr/bin/env bash
# SPDX-FileCopyrightText: 2019-Present Christian Kußowski
# SPDX-FileCopyrightText: 2019-Present Contributors to FluffyChat
#
# SPDX-License-Identifier: AGPL-3.0-or-later
# Generates some glue code for translation of /command hints.
# How to use this:
# - Add any new hints to assets/l10n/intl_en.arb
# They must be of the form commandHint_<command> with <command> in lowercase.
# - Run this script to regenerate the glue code
# - Run flutter test to see if you did everything right
# Looking to add descriptions for a new command, but don't know what it does?
# It is likely defined here (in registerDefaultCommands()):
# https://github.com/famedly/matrix-dart-sdk/tree/main/lib/src/utils/commands_extension.dart
echo "\
// This file is auto-generated using scripts/generate_command_hints_glue.sh.
import 'package:flutter_gen/gen_l10n/l10n.dart';
String commandHint(L10n l10n, String command) {
switch (command) {
$(sed -n \
's/[[:blank:]]*\"\(commandHint_\([[:lower:]]*\)\)\".*/ case "\2":\
return l10n.\1;/p' \
lib/l10n/intl_en.arb
)
default:
return \"\";
}
}\
" > lib/pages/chat/command_hints.dart

View File

@@ -0,0 +1,19 @@
#!/usr/bin/env bash
# SPDX-FileCopyrightText: 2019-Present Christian Kußowski
# SPDX-FileCopyrightText: 2019-Present Contributors to FluffyChat
#
# SPDX-License-Identifier: AGPL-3.0-or-later
cd android
echo $FDROID_KEY | base64 --decode --ignore-garbage > key.jks
echo "storePassword=${FDROID_KEY_PASS}" >> key.properties
echo "keyPassword=${FDROID_KEY_PASS}" >> key.properties
echo "keyAlias=key" >> key.properties
echo "storeFile=../key.jks" >> key.properties
echo $PLAYSTORE_DEPLOY_KEY >> keys.json
ls | grep key
bundle install
bundle update fastlane
bundle exec fastlane set_build_code_internal
cd ..

50
scripts/prepare-web.sh Normal file
View File

@@ -0,0 +1,50 @@
#!/bin/sh -ve
# SPDX-FileCopyrightText: 2019-Present Christian Kußowski
# SPDX-FileCopyrightText: 2019-Present Contributors to FluffyChat
#
# SPDX-License-Identifier: AGPL-3.0-or-later
SED=$(command -v gsed || command -v sed)
# Compile Vodozemac for web
version=$(yq ".dependencies.flutter_vodozemac" < pubspec.yaml)
version=$(printf "%s" "$version" | tr -d '"^')
git clone https://github.com/famedly/dart-vodozemac.git -b ${version} .vodozemac
cd .vodozemac
cargo install flutter_rust_bridge_codegen
flutter_rust_bridge_codegen build-web --dart-root dart --rust-root $(readlink -f rust) --release
cd ..
rm -f ./assets/vodozemac/vodozemac_bindings_dart*
mkdir -p "./assets/vodozemac/$version/"
mv .vodozemac/dart/web/pkg/vodozemac_bindings_dart* "./assets/vodozemac/$version/"
rm -rf .vodozemac
grep -qF "assets/vodozemac/${version}/" pubspec.yaml || "$SED" -i "\|- assets/sounds/|a\\ - assets/vodozemac/${version}/" pubspec.yaml
"$SED" -i "s/vodozemacVersion = '.*';/vodozemacVersion = '${version}';/" lib/config/app_config.dart
flutter pub get
dart compile js ./web/native_executor.dart -o ./web/native_executor.js -m
# Download native_imaging for web:
version=$(yq ".dependencies.native_imaging" < pubspec.yaml)
version=$(printf "%s" "$version" | tr -d '"^')
curl -L "https://github.com/famedly/dart_native_imaging/releases/download/v${version}/native_imaging.zip" > native_imaging.zip
unzip native_imaging.zip
mv js/* web/
rmdir js
rm native_imaging.zip
# Enable e2ee for LiveKit:
git clone https://github.com/livekit/client-sdk-flutter.git
cd client-sdk-flutter
flutter pub get
# Patch so that LiveKit uses HKDF by default:
# Workaroudn for https://github.com/livekit/client-sdk-flutter/issues/974
"$SED" -i "s/{'name': 'PBKDF2'.toJS}/{'name': 'HKDF'.toJS}/g" web/e2ee.keyhandler.dart
"$SED" -i "s/getAlgoOptions('PBKDF2', salt)/getAlgoOptions('HKDF', salt)/g" web/e2ee.keyhandler.dart
"$SED" -i "s/{'name': 'PBKDF2'}/{'name': 'HKDF'}/g" web/e2ee.utils.dart
dart compile js web/e2ee.worker.dart -o ../web/e2ee.worker.dart.js -m
cd ..
rm -rf client-sdk-flutter

View File

@@ -0,0 +1,10 @@
# SPDX-FileCopyrightText: 2019-Present Christian Kußowski
# SPDX-FileCopyrightText: 2019-Present Contributors to FluffyChat
#
# SPDX-License-Identifier: AGPL-3.0-or-later
choco install flutter cmake --installargs 'ADD_CMAKE_TO_PATH=System' -y
Import-Module "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"
refreshenv
flutter config --no-analytics

View File

@@ -0,0 +1,28 @@
#!/usr/bin/env bash
# SPDX-FileCopyrightText: 2019-Present Christian Kußowski
# SPDX-FileCopyrightText: 2019-Present Contributors to FluffyChat
#
# SPDX-License-Identifier: AGPL-3.0-or-later
source integration_test/data/integration_users.env
docker rm -f synapse 2>/dev/null || true
docker run -d --name synapse --tmpfs /data \
--volume="$(pwd)/integration_test/synapse/data/homeserver.yaml":/data/homeserver.yaml:rw \
--volume="$(pwd)/integration_test/synapse/data/localhost.log.config":/data/localhost.log.config:rw \
-p 80:80 matrixdotorg/synapse:latest
while ! curl -XGET "http://$HOMESERVER/_matrix/client/v3/login" >/dev/null 2>/dev/null; do
echo "Waiting for homeserver to be available... (GET http://$HOMESERVER/_matrix/client/v3/login)"
sleep 2
done
echo "Homeserver is online!"
# create users
curl -fS --retry 3 -XPOST -d "{\"username\":\"$USER1_NAME\", \"password\":\"$USER1_PW\", \"inhibit_login\":true, \"auth\": {\"type\":\"m.login.dummy\"}}" "http://$HOMESERVER/_matrix/client/r0/register"
curl -fS --retry 3 -XPOST -d "{\"username\":\"$USER2_NAME\", \"password\":\"$USER2_PW\", \"inhibit_login\":true, \"auth\": {\"type\":\"m.login.dummy\"}}" "http://$HOMESERVER/_matrix/client/r0/register"
echo "Homeserver is ready! Please rerun this script every time before starting an integration test!"

View File

@@ -0,0 +1,32 @@
#!/bin/sh -ve
# SPDX-FileCopyrightText: 2019-Present Christian Kußowski
# SPDX-FileCopyrightText: 2019-Present Contributors to FluffyChat
#
# SPDX-License-Identifier: AGPL-3.0-or-later
# Enable FCM and get packages
flutter pub add fcm_shared_isolate
sed -i '' 's,//<GOOGLE_SERVICES>,,g' lib/utils/background_push.dart
flutter clean
flutter pub get
# Reload all cocoapods
(
cd ios
rm -rf Pods Podfile.lock
pod install
pod update
)
# pub get hardcodes FlutterGeneratedPluginSwiftPackage to iOS 13.0; regenerate so
# it picks up the project's IPHONEOS_DEPLOYMENT_TARGET before xcodebuild.
flutter build ios --config-only --release
# Build and open archive dialog
xcodebuild \
-workspace ios/Runner.xcworkspace \
-scheme Runner \
-configuration Release \
-archivePath build/Runner.xcarchive \
archive && open -a Xcode build/Runner.xcarchive

View File

@@ -0,0 +1,32 @@
#!/usr/bin/env bash
# SPDX-FileCopyrightText: 2019-Present Christian Kußowski
# SPDX-FileCopyrightText: 2019-Present Contributors to FluffyChat
#
# SPDX-License-Identifier: AGPL-3.0-or-later
find . -type f \
-not -path "*/.*" \
-not -path "*/*.json" \
-not -path "*/pubspec.lock" \
-not -path "*/build/*" \
-not -path "*/assets/*" \
-not -path "*/lib/l10n/*" \
-not -path "*/android/*" \
-not -path "*/ios/*" \
-not -path "*/linux/*" \
-not -path "*/macos/*" \
-not -path "*/LICENSE" \
-not -path "*/LICENSES/*" \
-not -path "*/integration_test/synapse/*" \
-not -path "*/integration_test/data/*" \
-not -path "*/snap/*" \
-not -path "*/web/*" \
-not -path "*/windows/*" \
-exec reuse annotate \
--copyright="Christian Kußowski" \
--copyright="Contributors to FluffyChat" \
--license="AGPL-3.0-or-later" \
--year="2019-Present" \
--merge-copyrights \
{} +