Skip to content

armgit / Filee

Public Imported from GitHub
0

Free, open-source file converter. Convert 263 formats offline by drag & drop — images, PDF, Word, Excel, PowerPoint, HWP/HWPX, video, audio, e-books and archives. No upload, no Office needed.

Sponsors and backers listed in the app and the README

KnifeLemonb070d44d2213
diff --git a/README.ko.md b/README.ko.md
index 06da47e4..af1b5e34 100644
--- a/README.ko.md
+++ b/README.ko.md
@@ -228,6 +228,12 @@ Filee의 코드 서명 정책(Code signing policy)과 개인정보 처리 방침
Filee는 앞으로도 무료예요. 개발을 응원하고 싶다면 편한 방법으로 후원해 주세요.
국내 카드·간편결제는 [Fairy](https://fairy.hada.io/@filee)에서 할 수 있어요. 감사합니다!
+**여기에 이름이나 로고를 올려 보세요.** Patreon이나 GitHub Sponsors로 매월 후원하시면 이곳에 이름을, 로고 티어는
+이곳과 Filee 정보 페이지에 로고를 올려 드려요(다음 릴리즈부터, 후원하시는 동안). Ko-fi, PayPal, Fairy로 한 번
+후원하신 분도 원하시면 이름을 올려 드려요.
+
+<!-- sponsors: src/Filee.App/Assets/Sponsors/sponsors.json -->
+
<p align="center">
<a href="https://github.com/sponsors/KnifeLemon"><img src="https://img.shields.io/badge/GitHub%20Sponsors-EA4AAA?style=for-the-badge&logo=githubsponsors&logoColor=white" alt="GitHub Sponsors"></a>
<a href="https://patreon.com/KnifeLemon"><img src="https://img.shields.io/badge/Patreon-000000?style=for-the-badge&logo=patreon&logoColor=white" alt="Patreon"></a>
diff --git a/README.md b/README.md
index df2ad67e..bf2df600 100644
--- a/README.md
+++ b/README.md
@@ -252,6 +252,12 @@ It connects to the internet only:
Filee is free and stays free. If you'd like to support its development, pick whichever way suits you
([Fairy](https://fairy.hada.io/@filee) takes Korean cards and easy-pay). Thank you!
+**Your name or logo here.** Monthly backers on Patreon or GitHub Sponsors are listed here by name, and sponsors with
+their logo, here and in Filee's About page (from the next release, for as long as the sponsorship lasts). One-time
+supporters on Ko-fi, PayPal or Fairy can ask to be listed by name too.
+
+<!-- sponsors: src/Filee.App/Assets/Sponsors/sponsors.json -->
+
<p align="center">
<a href="https://github.com/sponsors/KnifeLemon"><img src="https://img.shields.io/badge/GitHub%20Sponsors-EA4AAA?style=for-the-badge&logo=githubsponsors&logoColor=white" alt="GitHub Sponsors"></a>
<a href="https://patreon.com/KnifeLemon"><img src="https://img.shields.io/badge/Patreon-000000?style=for-the-badge&logo=patreon&logoColor=white" alt="Patreon"></a>
diff --git a/README.zh-CN.md b/README.zh-CN.md
index 745c4ab5..d15a2dfb 100644
--- a/README.zh-CN.md
+++ b/README.zh-CN.md
@@ -215,6 +215,11 @@ Filee 的代码签名政策(Code signing policy)和隐私政策见[英文 RE
Filee 免费,并将一直免费。想支持开发的话,选一种方便的方式即可。谢谢!
+**你的名字或标志可以出现在这里。** 在 Patreon 或 GitHub Sponsors 按月赞助,名字会列在这里,标志档位的标志会显示在这里和
+Filee 的"关于"页面(从下一个版本起,赞助期间有效)。在 Ko-fi、PayPal 或 Fairy 一次性赞助的朋友,也可以要求列出名字。
+
+<!-- sponsors: src/Filee.App/Assets/Sponsors/sponsors.json -->
+
<p align="center">
<a href="https://github.com/sponsors/KnifeLemon"><img src="https://img.shields.io/badge/GitHub%20Sponsors-EA4AAA?style=for-the-badge&logo=githubsponsors&logoColor=white" alt="GitHub Sponsors"></a>
<a href="https://patreon.com/KnifeLemon"><img src="https://img.shields.io/badge/Patreon-000000?style=for-the-badge&logo=patreon&logoColor=white" alt="Patreon"></a>
diff --git a/src/Filee.App/Assets/Sponsors/sponsors.json b/src/Filee.App/Assets/Sponsors/sponsors.json
new file mode 100644
index 00000000..bdace074
--- /dev/null
+++ b/src/Filee.App/Assets/Sponsors/sponsors.json
@@ -0,0 +1,4 @@
+{
+ "sponsors": [],
+ "backers": []
+}
diff --git a/src/Filee.App/Assets/i18n/en.json b/src/Filee.App/Assets/i18n/en.json
index a858d1b4..8ac0cd5f 100644
--- a/src/Filee.App/Assets/i18n/en.json
+++ b/src/Filee.App/Assets/i18n/en.json
@@ -482,6 +482,7 @@
"sponsor.note.patreon": "Monthly membership",
"sponsor.note.kofi": "A one-time coffee, no account needed",
"sponsor.note.paypal": "Any amount with PayPal",
+ "sponsor.thanks": "Thank you to our sponsors",
"sponsor.star": "A ⭐ on GitHub costs nothing and helps other people find Filee.",
"feedback.notice_title": "Is Filee helping you?",
"feedback.notice_text": "A star on GitHub helps other people find Filee. Problems and ideas are welcome too.",
diff --git a/src/Filee.App/Assets/i18n/ko.json b/src/Filee.App/Assets/i18n/ko.json
index 62c82f2e..ff94c6a9 100644
--- a/src/Filee.App/Assets/i18n/ko.json
+++ b/src/Filee.App/Assets/i18n/ko.json
@@ -482,6 +482,7 @@
"sponsor.note.patreon": "매월 멤버십",
"sponsor.note.kofi": "가입 없이 커피 한 잔",
"sponsor.note.paypal": "PayPal로 원하는 금액",
+ "sponsor.thanks": "후원해 주신 분들, 고맙습니다",
"sponsor.star": "돈이 들지 않는 GitHub ⭐도 다른 분들이 Filee를 찾는 데 큰 도움이 돼요.",
"feedback.notice_title": "Filee가 도움이 되고 있나요?",
"feedback.notice_text": "GitHub에 별(⭐)을 남겨 주시면 다른 분들이 Filee를 찾는 데 큰 도움이 돼요. 불편한 점이나 원하는 기능도 알려 주세요.",
diff --git a/src/Filee.App/Assets/i18n/zh-CN.json b/src/Filee.App/Assets/i18n/zh-CN.json
index 14353441..e41398ce 100644
--- a/src/Filee.App/Assets/i18n/zh-CN.json
+++ b/src/Filee.App/Assets/i18n/zh-CN.json
@@ -482,6 +482,7 @@
"sponsor.note.patreon": "按月会员",
"sponsor.note.kofi": "无需注册,请喝一杯咖啡",
"sponsor.note.paypal": "用 PayPal 支付任意金额",
+ "sponsor.thanks": "感谢各位赞助者",
"sponsor.star": "在 GitHub 点个 ⭐ 不花钱,也能让更多人发现 Filee。",
"feedback.notice_title": "Filee 对你有帮助吗?",
"feedback.notice_text": "在 GitHub 上点个星(⭐)能帮助更多人发现 Filee。也欢迎反馈问题或提出想法。",
diff --git a/src/Filee.App/Services/AppJsonContext.cs b/src/Filee.App/Services/AppJsonContext.cs
index a4f7df24..5b87b786 100644
--- a/src/Filee.App/Services/AppJsonContext.cs
+++ b/src/Filee.App/Services/AppJsonContext.cs
@@ -7,4 +7,5 @@ namespace Filee.App.Services;
[JsonSourceGenerationOptions(ReadCommentHandling = System.Text.Json.JsonCommentHandling.Skip, AllowTrailingCommas = true)]
[JsonSerializable(typeof(Dictionary<string, string>))]
[JsonSerializable(typeof(string[]))]
+[JsonSerializable(typeof(SupportersFile))]
internal sealed partial class AppJsonContext : JsonSerializerContext;
diff --git a/src/Filee.App/Services/Supporters.cs b/src/Filee.App/Services/Supporters.cs
new file mode 100644
index 00000000..9e7cc49a
--- /dev/null
+++ b/src/Filee.App/Services/Supporters.cs
@@ -0,0 +1,60 @@
+// The people and companies who sponsor Filee, shown in the Sponsor window and on the About page, and listed in the
+// README's Sponsor section. They ship with each release (Assets/Sponsors/sponsors.json); nothing is downloaded.
+//
+// "sponsors": the logo tier, { "name", "url", "logo", "logoDark" }. The logos are transparent PNGs next to the
+// file; "logoDark" is optional, for the dark theme.
+// "backers": names, { "name", "url" }, "url" optional. One-time supporters who asked to be listed go here too.
+//
+// Someone added starts showing with the next release, someone whose sponsorship ended is removed in the next one.
+
+using System.Text.Json;
+using System.Text.Json.Serialization;
+using Avalonia.Platform;
+
+namespace Filee.App.Services;
+
+public sealed record Supporter(
+ [property: JsonPropertyName("name")] string Name,
+ [property: JsonPropertyName("url")] string? Url = null,
+ [property: JsonPropertyName("logo")] string? Logo = null,
+ [property: JsonPropertyName("logoDark")] string? LogoDark = null);
+
+public sealed record SupporterList(IReadOnlyList<Supporter> Sponsors, IReadOnlyList<Supporter> Backers)
+{
+ public static readonly SupporterList Empty = new([], []);
+
+ public bool IsEmpty => Sponsors.Count == 0 && Backers.Count == 0;
+}
+
+public static class Supporters
+{
+ public const string Folder = "avares://Filee/Assets/Sponsors/";
+
+ private static SupporterList? _bundled;
+
+ /// <summary>The list shipped with this release.</summary>
+ public static SupporterList Bundled => _bundled ??= Load();
+
+ private static SupporterList Load()
+ {
+ var uri = new Uri(Folder + "sponsors.json");
+ if (!AssetLoader.Exists(uri))
+ return SupporterList.Empty;
+ using var stream = AssetLoader.Open(uri);
+ return Parse(new StreamReader(stream).ReadToEnd());
+ }
+
+ public static SupporterList Parse(string json)
+ {
+ var file = JsonSerializer.Deserialize(json, AppJsonContext.Default.SupportersFile);
+ static IReadOnlyList<Supporter> Named(List<Supporter>? list) =>
+ list?.Where(s => !string.IsNullOrWhiteSpace(s.Name)).ToList() ?? [];
+ return file is null ? SupporterList.Empty : new(Named(file.Sponsors), Named(file.Backers));
+ }
+}
+
+internal sealed class SupportersFile
+{
+ [JsonPropertyName("sponsors")] public List<Supporter>? Sponsors { get; set; }
+ [JsonPropertyName("backers")] public List<Supporter>? Backers { get; set; }
+}
diff --git a/src/Filee.App/Views/Pages/AboutPage.axaml b/src/Filee.App/Views/Pages/AboutPage.axaml
index 30610d89..808d0abc 100644
--- a/src/Filee.App/Views/Pages/AboutPage.axaml
+++ b/src/Filee.App/Views/Pages/AboutPage.axaml
@@ -2,6 +2,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:vm="using:Filee.App.ViewModels.Pages"
xmlns:c="using:Filee.App.Controls"
+ xmlns:v="using:Filee.App.Views"
x:Class="Filee.App.Views.Pages.AboutPage"
x:DataType="vm:AboutPageViewModel">
<StackPanel Spacing="18">
@@ -52,6 +53,7 @@
</StackPanel>
</Button>
</WrapPanel>
+ <v:SupportersView Margin="0,6,0,0" />
</StackPanel>
</Border>
<Border Classes="card">
diff --git a/src/Filee.App/Views/SponsorWindow.axaml b/src/Filee.App/Views/SponsorWindow.axaml
index 214894e4..b49617b3 100644
--- a/src/Filee.App/Views/SponsorWindow.axaml
+++ b/src/Filee.App/Views/SponsorWindow.axaml
@@ -50,6 +50,7 @@
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
+ <v:SupportersView x:Name="Supporters" />
<TextBlock Classes="caption" TextWrapping="Wrap" Text="{DynamicResource sponsor.star}" />
</StackPanel>
</Window>
diff --git a/src/Filee.App/Views/SupportersView.axaml b/src/Filee.App/Views/SupportersView.axaml
new file mode 100644
index 00000000..1055b8a3
--- /dev/null
+++ b/src/Filee.App/Views/SupportersView.axaml
@@ -0,0 +1,38 @@
+<!-- The sponsors' logos and the backers' names (Services/Supporters.cs), in the Sponsor window and on the About page.
+ Hidden while the list is empty. -->
+<UserControl xmlns="https://github.com/avaloniaui"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:v="using:Filee.App.Views"
+ x:Class="Filee.App.Views.SupportersView">
+ <UserControl.Styles>
+ <Style Selector="Button.supporter">
+ <Setter Property="Padding" Value="10,6" />
+ <Setter Property="Margin" Value="0,0,6,6" />
+ <Setter Property="Background" Value="{DynamicResource SurfaceAltBrush}" />
+ <Setter Property="BorderThickness" Value="0" />
+ </Style>
+ </UserControl.Styles>
+ <StackPanel Spacing="6">
+ <TextBlock Classes="label" Text="{DynamicResource sponsor.thanks}" />
+ <ItemsControl x:Name="Logos">
+ <ItemsControl.ItemsPanel>
+ <ItemsPanelTemplate>
+ <WrapPanel />
+ </ItemsPanelTemplate>
+ </ItemsControl.ItemsPanel>
+ <ItemsControl.ItemTemplate>
+ <DataTemplate x:DataType="v:SupporterItem">
+ <Button Classes="supporter" Click="OnOpen" Tag="{Binding Url}" ToolTip.Tip="{Binding Name}">
+ <Panel>
+ <Image Source="{Binding Logo}" Height="28" MaxWidth="140" Stretch="Uniform"
+ IsVisible="{Binding Logo, Converter={x:Static ObjectConverters.IsNotNull}}" />
+ <TextBlock Text="{Binding Name}" FontWeight="SemiBold" VerticalAlignment="Center"
+ IsVisible="{Binding Logo, Converter={x:Static ObjectConverters.IsNull}}" />
+ </Panel>
+ </Button>
+ </DataTemplate>
+ </ItemsControl.ItemTemplate>
+ </ItemsControl>
+ <TextBlock x:Name="Names" Classes="caption" TextWrapping="Wrap" />
+ </StackPanel>
+</UserControl>
diff --git a/src/Filee.App/Views/SupportersView.axaml.cs b/src/Filee.App/Views/SupportersView.axaml.cs
new file mode 100644
index 00000000..7a7d7d74
--- /dev/null
+++ b/src/Filee.App/Views/SupportersView.axaml.cs
@@ -0,0 +1,51 @@
+using Avalonia;
+using Avalonia.Controls;
+using Avalonia.Interactivity;
+using Avalonia.Media.Imaging;
+using Avalonia.Platform;
+using Avalonia.Styling;
+using Filee.App.Services;
+
+namespace Filee.App.Views;
+
+/// <summary>A sponsor's logo (or its name when the logo is missing) and where it leads.</summary>
+public sealed record SupporterItem(string Name, string? Url, Bitmap? Logo);
+
+/// <summary>The sponsors' logos and the backers' names shipped with this release; hidden while there are none.</summary>
+public partial class SupportersView : UserControl
+{
+ public SupportersView()
+ {
+ InitializeComponent();
+ Show(Supporters.Bundled, BundledLogo);
+ }
+
+ /// <summary>Shows <paramref name="list"/>, the logos read by <paramref name="logo"/> (null when missing).</summary>
+ public void Show(SupporterList list, Func<string, Bitmap?> logo)
+ {
+ IsVisible = !list.IsEmpty;
+ var dark = Application.Current?.ActualThemeVariant == ThemeVariant.Dark;
+ Logos.ItemsSource = list.Sponsors
+ .Select(s => new SupporterItem(s.Name, s.Url,
+ (dark ? s.LogoDark ?? s.Logo : s.Logo) is { } file ? logo(file) : null))
+ .ToList();
+ Logos.IsVisible = list.Sponsors.Count > 0;
+ Names.Text = string.Join(" · ", list.Backers.Select(b => b.Name));
+ Names.IsVisible = list.Backers.Count > 0;
+ }
+
+ private static Bitmap? BundledLogo(string file)
+ {
+ var uri = new Uri(Supporters.Folder + file);
+ if (!AssetLoader.Exists(uri))
+ return null;
+ using var stream = AssetLoader.Open(uri);
+ return new Bitmap(stream);
+ }
+
+ private async void OnOpen(object? sender, RoutedEventArgs e)
+ {
+ if ((sender as Control)?.Tag is string url && TopLevel.GetTopLevel(this) is { } top)
+ await top.Launcher.LaunchUriAsync(new Uri(url));
+ }
+}
diff --git a/tests/Filee.App.Tests/RenderTests.cs b/tests/Filee.App.Tests/RenderTests.cs
index 26c886bb..8dccdab6 100644
--- a/tests/Filee.App.Tests/RenderTests.cs
+++ b/tests/Filee.App.Tests/RenderTests.cs
@@ -374,6 +374,33 @@ public class RenderTests
window.Close();
}
+ [AvaloniaFact]
+ public void Sponsor_window_with_supporters_renders()
+ {
+ TestServices.EnsureInitialized("en");
+ var window = Filee.App.Views.SponsorWindow.Create(AppHost.Get<Filee.Core.Localization.ILocalizer>());
+ var view = window.Supporters;
+ view.Show(new SupporterList(
+ [new Supporter("Acme", "https://acme.example", "acme.png"), new Supporter("Globex", "https://globex.example")],
+ [new("Kim"), new("Lee"), new("Park")]), _ => Logo());
+ window.Show();
+ Pump();
+ Save(window, "window-sponsor-supporters-en.png");
+ window.Close();
+
+ // A stand-in logo: a wide coloured mark like a company's.
+ static Avalonia.Media.Imaging.Bitmap Logo()
+ {
+ var bitmap = new Avalonia.Media.Imaging.RenderTargetBitmap(new Avalonia.PixelSize(120, 32));
+ using (var context = bitmap.CreateDrawingContext())
+ {
+ context.DrawRectangle(new Avalonia.Media.SolidColorBrush(Avalonia.Media.Color.Parse("#3B6FD8")), null, new Avalonia.Rect(0, 4, 24, 24), 6, 6);
+ context.DrawRectangle(new Avalonia.Media.SolidColorBrush(Avalonia.Media.Color.Parse("#7A8699")), null, new Avalonia.Rect(32, 10, 84, 12), 3, 3);
+ }
+ return bitmap;
+ }
+ }
+
[AvaloniaTheory]
[InlineData("en")]
[InlineData("ko")]
diff --git a/tests/Filee.App.Tests/SupportersTests.cs b/tests/Filee.App.Tests/SupportersTests.cs
new file mode 100644
index 00000000..eee2c714
--- /dev/null
+++ b/tests/Filee.App.Tests/SupportersTests.cs
@@ -0,0 +1,69 @@
+// The sponsors and backers shipped with a release (Assets/Sponsors/sponsors.json): shown in the app while there are
+// any, and listed in every README.
+
+using Avalonia.Headless.XUnit;
+using Filee.App.Services;
+using Filee.App.Views;
+
+namespace Filee.App.Tests;
+
+public class SupportersTests
+{
+ private static readonly string RepoRoot = FindRepoRoot();
+
+ private static string FindRepoRoot()
+ {
+ var dir = new DirectoryInfo(AppContext.BaseDirectory);
+ while (dir is not null && !File.Exists(Path.Combine(dir.FullName, "Filee.slnx")))
+ dir = dir.Parent;
+ return dir?.FullName ?? throw new DirectoryNotFoundException("Filee.slnx");
+ }
+
+ [Fact]
+ public void The_list_reads_logos_and_names_and_skips_unnamed_entries()
+ {
+ var list = Supporters.Parse("""
+ {
+ "sponsors": [ { "name": "Acme", "url": "https://acme.example", "logo": "acme.png", "logoDark": "acme-dark.png" } ],
+ "backers": [ { "name": "Kim" }, { "name": " " } ]
+ }
+ """);
+
+ var acme = Assert.Single(list.Sponsors);
+ Assert.Equal(new Supporter("Acme", "https://acme.example", "acme.png", "acme-dark.png"), acme);
+ Assert.Equal("Kim", Assert.Single(list.Backers).Name);
+ Assert.True(Supporters.Parse("""{ "sponsors": [], "backers": [] }""").IsEmpty);
+ }
+
+ [Fact]
+ public void Every_listed_supporter_is_in_every_readme_and_has_its_logo()
+ {
+ var folder = Path.Combine(RepoRoot, "src", "Filee.App", "Assets", "Sponsors");
+ var list = Supporters.Parse(File.ReadAllText(Path.Combine(folder, "sponsors.json")));
+
+ foreach (var readme in new[] { "README.md", "README.ko.md", "README.zh-CN.md" })
+ {
+ var text = File.ReadAllText(Path.Combine(RepoRoot, readme));
+ Assert.Contains("<!-- sponsors: src/Filee.App/Assets/Sponsors/sponsors.json -->", text);
+ Assert.All(list.Sponsors.Concat(list.Backers), s => Assert.Contains(s.Name, text));
+ }
+ Assert.All(list.Sponsors.SelectMany(s => new[] { s.Logo, s.LogoDark }).OfType<string>(),
+ logo => Assert.True(File.Exists(Path.Combine(folder, logo)), logo));
+ }
+
+ [AvaloniaFact]
+ public void Nothing_shows_while_nobody_is_listed()
+ {
+ TestServices.EnsureInitialized("en");
+ var view = new SupportersView();
+
+ view.Show(SupporterList.Empty, _ => null);
+ Assert.False(view.IsVisible);
+
+ view.Show(new SupporterList([new Supporter("Acme", "https://acme.example", "acme.png")], [new("Kim"), new("Lee")]), _ => null);
+ Assert.True(view.IsVisible);
+ var acme = Assert.IsAssignableFrom<IEnumerable<SupporterItem>>(view.Logos.ItemsSource).Single();
+ Assert.Null(acme.Logo); // a missing logo shows the name instead
+ Assert.Equal("Kim · Lee", view.Names.Text);
+ }
+}