Skip to content

Commit f117e20

Browse files
authored
Merge branch 'develop' into l10n_develop
2 parents c831c46 + 4bda363 commit f117e20

71 files changed

Lines changed: 2310 additions & 636 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/build.yml

Lines changed: 208 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -940,3 +940,211 @@ jobs:
940940
version: ${{ needs.deploy.outputs.version }}
941941
release-tag: v${{ needs.deploy.outputs.version }}
942942
token: ${{ secrets.CI_PAT }}
943+
update-flathub-beta:
944+
name: Update Flathub beta
945+
needs:
946+
- deploy
947+
if: >-
948+
${{
949+
github.event_name == 'release' &&
950+
github.event.action == 'published' &&
951+
github.event.release.prerelease == true
952+
}}
953+
runs-on: ubuntu-24.04
954+
955+
permissions:
956+
contents: read
957+
958+
concurrency:
959+
group: flathub-beta-${{ github.event.release.tag_name }}
960+
cancel-in-progress: false
961+
962+
env:
963+
FLATHUB_REPOSITORY: flathub/dev.linwood.butterfly
964+
FLATHUB_MANIFEST: dev.linwood.butterfly.json
965+
RELEASE_TAG: ${{ github.event.release.tag_name }}
966+
967+
steps:
968+
- name: Download release checksums
969+
env:
970+
GH_TOKEN: ${{ github.token }}
971+
run: |
972+
mkdir -p release
973+
974+
for attempt in {1..12}; do
975+
rm -f release/checksums.txt
976+
977+
if gh release download "$RELEASE_TAG" \
978+
--repo "$GITHUB_REPOSITORY" \
979+
--pattern checksums.txt \
980+
--dir release; then
981+
break
982+
fi
983+
984+
echo "Release assets are not available yet, retrying..."
985+
sleep 10
986+
done
987+
988+
test -s release/checksums.txt
989+
990+
- name: Read Linux checksums
991+
id: checksums
992+
run: |
993+
X86_64_SHA="$(
994+
awk '$2 == "linwood-butterfly-linux-x86_64.tar.gz" {
995+
print $1
996+
}' release/checksums.txt
997+
)"
998+
999+
ARM64_SHA="$(
1000+
awk '$2 == "linwood-butterfly-linux-arm64.tar.gz" {
1001+
print $1
1002+
}' release/checksums.txt
1003+
)"
1004+
1005+
if [[ ! "$X86_64_SHA" =~ ^[0-9a-f]{64}$ ]]; then
1006+
echo "Invalid or missing x86_64 checksum"
1007+
exit 1
1008+
fi
1009+
1010+
if [[ ! "$ARM64_SHA" =~ ^[0-9a-f]{64}$ ]]; then
1011+
echo "Invalid or missing arm64 checksum"
1012+
exit 1
1013+
fi
1014+
1015+
echo "x86_64=$X86_64_SHA" >> "$GITHUB_OUTPUT"
1016+
echo "arm64=$ARM64_SHA" >> "$GITHUB_OUTPUT"
1017+
1018+
- name: Checkout Flathub beta branch
1019+
uses: actions/checkout@v6
1020+
with:
1021+
repository: flathub/dev.linwood.butterfly
1022+
ref: beta
1023+
token: ${{ secrets.CI_PAT }}
1024+
fetch-depth: 0
1025+
path: flathub
1026+
1027+
- name: Update Flathub manifest
1028+
env:
1029+
X86_64_SHA: ${{ steps.checksums.outputs.x86_64 }}
1030+
ARM64_SHA: ${{ steps.checksums.outputs.arm64 }}
1031+
run: |
1032+
python3 <<'PY'
1033+
import os
1034+
import re
1035+
from pathlib import Path
1036+
1037+
manifest = Path("flathub") / os.environ["FLATHUB_MANIFEST"]
1038+
release_tag = os.environ["RELEASE_TAG"]
1039+
1040+
files = {
1041+
"linwood-butterfly-linux-x86_64.tar.gz": os.environ["X86_64_SHA"],
1042+
"linwood-butterfly-linux-arm64.tar.gz": os.environ["ARM64_SHA"],
1043+
}
1044+
1045+
lines = manifest.read_text(encoding="utf-8").splitlines()
1046+
updated = set()
1047+
1048+
for index, line in enumerate(lines):
1049+
for filename, checksum in files.items():
1050+
if '"url":' not in line or filename not in line:
1051+
continue
1052+
1053+
indent = line[: len(line) - len(line.lstrip())]
1054+
lines[index] = (
1055+
f'{indent}"url": '
1056+
f'"https://github.com/LinwoodDev/Butterfly/'
1057+
f'releases/download/{release_tag}/{filename}",'
1058+
)
1059+
1060+
for checksum_index in range(
1061+
index + 1,
1062+
min(index + 6, len(lines)),
1063+
):
1064+
if '"sha256":' not in lines[checksum_index]:
1065+
continue
1066+
1067+
lines[checksum_index] = re.sub(
1068+
r'"sha256":\s*"[^"]+"',
1069+
f'"sha256": "{checksum}"',
1070+
lines[checksum_index],
1071+
)
1072+
updated.add(filename)
1073+
break
1074+
1075+
missing = set(files) - updated
1076+
if missing:
1077+
raise RuntimeError(
1078+
f"Could not update manifest entries: {sorted(missing)}"
1079+
)
1080+
1081+
manifest.write_text(
1082+
"\n".join(lines) + "\n",
1083+
encoding="utf-8",
1084+
)
1085+
PY
1086+
1087+
- name: Commit and push update branch
1088+
id: push
1089+
working-directory: flathub
1090+
run: |
1091+
VERSION="${RELEASE_TAG#v}"
1092+
BRANCH="automation/butterfly-$VERSION"
1093+
1094+
echo "branch=$BRANCH" >> "$GITHUB_OUTPUT"
1095+
1096+
if git diff --quiet -- "$FLATHUB_MANIFEST"; then
1097+
echo "Manifest already contains this release"
1098+
echo "changed=false" >> "$GITHUB_OUTPUT"
1099+
exit 0
1100+
fi
1101+
1102+
git config user.name "Linwood CI"
1103+
git config user.email "ci@linwood.dev"
1104+
1105+
git checkout -B "$BRANCH"
1106+
git add "$FLATHUB_MANIFEST"
1107+
git commit -m "Update Butterfly to $VERSION"
1108+
git push --force origin "HEAD:refs/heads/$BRANCH"
1109+
1110+
echo "changed=true" >> "$GITHUB_OUTPUT"
1111+
1112+
- name: Create Flathub beta pull request
1113+
if: steps.push.outputs.changed == 'true'
1114+
env:
1115+
GH_TOKEN: ${{ secrets.CI_PAT }}
1116+
BRANCH: ${{ steps.push.outputs.branch }}
1117+
run: |
1118+
EXISTING_PR="$(
1119+
gh pr list \
1120+
--repo "$FLATHUB_REPOSITORY" \
1121+
--base beta \
1122+
--head "$BRANCH" \
1123+
--state open \
1124+
--json number \
1125+
--jq '.[0].number // empty'
1126+
)"
1127+
1128+
if [[ -n "$EXISTING_PR" ]]; then
1129+
echo "Pull request #$EXISTING_PR already exists"
1130+
exit 0
1131+
fi
1132+
1133+
VERSION="${RELEASE_TAG#v}"
1134+
1135+
cat > /tmp/flathub-pr.md <<EOF
1136+
Automated update for Butterfly $VERSION.
1137+
1138+
Release:
1139+
$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/releases/tag/$RELEASE_TAG
1140+
1141+
The download URLs and SHA256 checksums for the x86_64 and arm64
1142+
Linux archives were generated from the published release assets.
1143+
EOF
1144+
1145+
gh pr create \
1146+
--repo "$FLATHUB_REPOSITORY" \
1147+
--base beta \
1148+
--head "$BRANCH" \
1149+
--title "Update Butterfly to $VERSION" \
1150+
--body-file /tmp/flathub-pr.md

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Changelog
22

3-
<!--ENTER CHANGELOG HERE-->
3+
<!--ENTER CHANGELOG HERE-->
44

55
## 2.6.0-beta.2 (2026-07-13)
66

api/lib/src/models/data.dart

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,8 @@ final class NoteData extends NoteDisplay<NoteData> {
528528

529529
@useResult
530530
Uint8List? getFont(String fontName) =>
531-
getAsset('$kFontsArchiveDirectory/$fontName');
531+
getAsset('$kFontsArchiveDirectory/$fontName') ??
532+
parent?.getFont(fontName);
532533

533534
@useResult
534535
Uint8List? getBundledPackData(String packName) =>
@@ -572,6 +573,18 @@ final class NoteData extends NoteDisplay<NoteData> {
572573
...getAssets(path, recursive),
573574
};
574575

576+
@useResult
577+
Iterable<String> getFonts() =>
578+
_getPackAssets('$kFontsArchiveDirectory/', false);
579+
580+
@useResult
581+
NoteData setFont(String name, Uint8List font) =>
582+
setAsset('$kFontsArchiveDirectory/$name', font);
583+
584+
@useResult
585+
NoteData removeFont(String name) =>
586+
removeAsset('$kFontsArchiveDirectory/$name');
587+
575588
@useResult
576589
Iterable<String> getComponents() =>
577590
_getPackAssets('$kComponentsArchiveDirectory/');

api/lib/src/models/element.dart

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ sealed class PadElement with _$PadElement {
8585
@Implements<PathElement>()
8686
factory PadElement.pen({
8787
@Default(0) double rotation,
88+
@Default(0) double shear,
8889
@Default('') String collection,
8990
@IdJsonConverter() String? id,
9091
double? zoom,
@@ -97,6 +98,7 @@ sealed class PadElement with _$PadElement {
9798
@With<LabelElement>()
9899
factory PadElement.text({
99100
@Default(0) double rotation,
101+
@Default(0) double shear,
100102
@Default('') String collection,
101103
@IdJsonConverter() String? id,
102104
@DoublePointJsonConverter()
@@ -113,6 +115,7 @@ sealed class PadElement with _$PadElement {
113115
@With<LabelElement>()
114116
factory PadElement.markdown({
115117
@Default(0) double rotation,
118+
@Default(0) double shear,
116119
@Default('') String collection,
117120
@IdJsonConverter() String? id,
118121
@DoublePointJsonConverter()
@@ -130,6 +133,7 @@ sealed class PadElement with _$PadElement {
130133
@Implements<SourcedElement>()
131134
factory PadElement.image({
132135
@Default(0) double rotation,
136+
@Default(0) double shear,
133137
@Default('') String collection,
134138
@IdJsonConverter() String? id,
135139
@DoublePointJsonConverter()
@@ -146,6 +150,7 @@ sealed class PadElement with _$PadElement {
146150
@Implements<SourcedElement>()
147151
factory PadElement.pdf({
148152
@Default(0) double rotation,
153+
@Default(0) double shear,
149154
@Default('') String collection,
150155
@IdJsonConverter() String? id,
151156
@DoublePointJsonConverter()
@@ -165,6 +170,7 @@ sealed class PadElement with _$PadElement {
165170
@Implements<SourcedElement>()
166171
factory PadElement.svg({
167172
@Default(0) double rotation,
173+
@Default(0) double shear,
168174
@Default('') String collection,
169175
@IdJsonConverter() String? id,
170176
@DoublePointJsonConverter()
@@ -180,6 +186,7 @@ sealed class PadElement with _$PadElement {
180186

181187
factory PadElement.shape({
182188
@Default(0) double rotation,
189+
@Default(0) double shear,
183190
@Default('') String collection,
184191
@IdJsonConverter() String? id,
185192
@DoublePointJsonConverter()
@@ -194,6 +201,7 @@ sealed class PadElement with _$PadElement {
194201

195202
factory PadElement.texture({
196203
@Default(0) double rotation,
204+
@Default(0) double shear,
197205
@Default('') String collection,
198206
@IdJsonConverter() String? id,
199207
@Default(SurfaceTexture.pattern()) SurfaceTexture texture,
@@ -208,6 +216,7 @@ sealed class PadElement with _$PadElement {
208216

209217
factory PadElement.polygon({
210218
@Default(0) double rotation,
219+
@Default(0) double shear,
211220
@Default('') String collection,
212221
@IdJsonConverter() String? id,
213222
@Default([]) List<PolygonPoint> points,

0 commit comments

Comments
 (0)