Compare commits
9
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7af21aab09
|
||
|
|
e5f2835229 | ||
|
|
76b27e86ed
|
||
|
|
66812dc467
|
||
|
|
e82507db2d | ||
|
|
14f9e63f12 | ||
|
|
e279e94056 | ||
|
|
e2e94c6f5c | ||
|
|
fbc2a3c2b6
|
No files matched your search
@@ -19,6 +19,13 @@ dotnet test OmniDeck.slnx
|
||||
dotnet run --project src/OmniDeck.App
|
||||
```
|
||||
|
||||
To run a development build beside an installed OmniDeck, give it a data root of its own. Only Debug builds read the variable, so the installed copy keeps its settings, sign-ins and database, and the two run side by side:
|
||||
|
||||
```powershell
|
||||
$env:OMNIDECK_DATA_ROOT = "$env:TEMP\OmniDeck.Dev"
|
||||
dotnet run --project src/OmniDeck.App
|
||||
```
|
||||
|
||||
## Code style & quality gates (enforced in CI)
|
||||
|
||||
- `.editorconfig` is authoritative. `dotnet format OmniDeck.slnx --verify-no-changes` must pass.
|
||||
|
||||
@@ -63,7 +63,7 @@
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Meziantou.Analyzer" Version="3.0.317">
|
||||
<PackageReference Include="Meziantou.Analyzer" Version="3.0.318">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"$schema": "./webapps.schema.json",
|
||||
"schemaVersion": 2,
|
||||
"updated": "2026-11-02",
|
||||
"updated": "2026-11-03",
|
||||
"navAllowSets": {
|
||||
"google-account-domains": [
|
||||
"accounts.google.ad",
|
||||
@@ -198,7 +198,8 @@
|
||||
"name": "Spotify",
|
||||
"startUrl": "https://open.spotify.com/",
|
||||
"profile": "spotify",
|
||||
"navAllow": ["spotify.com", "spotifycdn.com", "scdn.co"],
|
||||
"navAllow": ["spotify.com", "spotifycdn.com", "scdn.co", "accounts.google.com", "www.facebook.com", "appleid.apple.com"],
|
||||
"navAllowSets": ["google-account-domains"],
|
||||
"popupAllow": ["accounts.spotify.com"],
|
||||
"notifications": false,
|
||||
"audioPin": true
|
||||
@@ -211,7 +212,7 @@
|
||||
"navAllow": ["discord.com", "discordapp.com", "discord.gg", "discordapp.net"],
|
||||
"popupAllow": ["discord.com"],
|
||||
"notifications": true,
|
||||
"audioPin": false
|
||||
"audioPin": true
|
||||
},
|
||||
{
|
||||
"id": "youtube",
|
||||
@@ -276,7 +277,7 @@
|
||||
"navAllow": ["facebook.com", "fbcdn.net", "fbsbx.com"],
|
||||
"popupAllow": ["facebook.com"],
|
||||
"notifications": true,
|
||||
"audioPin": false
|
||||
"audioPin": true
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -35,7 +35,7 @@ OmniDeck deliberately does **not** allow arbitrary user-added URLs in v1: the cu
|
||||
|
||||
Top-level file fields: `$schema` (optional editor hint), `schemaVersion` (int, currently 2), `updated` (ISO date of the last content change), `navAllowSets` (optional: named lists of domains, each name `[a-z0-9-]`), `apps` (array).
|
||||
|
||||
**Named domain sets.** `google-account-domains` lists Google's account host on every country-code domain, `accounts.google.<ccTLD>`, taken from `https://www.google.com/supported_domains` (186 domains; `google.com` itself is already in each entry's `navAllow`). Google's sign-in hops there to set its cookies, for example `accounts.google.com.vn/accounts/SetSID`. Every `google` entry uses the set, because they share one sign-in. The list lives in the catalog rather than in the app, so a change is a catalog pull request, not a release. Schema v2 (2 November 2026) added `navAllowSets`; no released build read v1, and the app reads v2 only. The JSON Schema is [`catalog/webapps.schema.json`](../catalog/webapps.schema.json); `scripts/validate-catalog.ps1` checks it plus the rules a schema can't express (unique `id` and `name`, every set an entry names exists and every set is used, the coverage rules above, `updated` not in the future), and CI runs it on every pull request. The app checks every catalog it loads or fetches against the same rules (`OdCatalogValidator`, whose test runs on this repository's file), rejects any whose `schemaVersion` it does not understand or that fails them, and keeps the copy it has. A fetched catalog takes effect from the next start.
|
||||
**Named domain sets.** `google-account-domains` lists Google's account host on every country-code domain, `accounts.google.<ccTLD>`, taken from `https://www.google.com/supported_domains` (186 domains; `google.com` itself is already in each entry's `navAllow`). Google's sign-in hops there to set its cookies, for example `accounts.google.com.vn/accounts/SetSID`. Every `google` entry uses the set, because they share one sign-in, and so does `spotify`: its "Continue with Google" signs in to Google on Spotify's own profile, and goes through the same hops. The list lives in the catalog rather than in the app, so a change is a catalog pull request, not a release. Schema v2 (2 November 2026) added `navAllowSets`; no released build read v1, and the app reads v2 only. The JSON Schema is [`catalog/webapps.schema.json`](../catalog/webapps.schema.json); `scripts/validate-catalog.ps1` checks it plus the rules a schema can't express (unique `id` and `name`, every set an entry names exists and every set is used, the coverage rules above, `updated` not in the future), and CI runs it on every pull request. The app checks every catalog it loads or fetches against the same rules (`OdCatalogValidator`, whose test runs on this repository's file), rejects any whose `schemaVersion` it does not understand or that fails them, and keeps the copy it has. A fetched catalog takes effect from the next start.
|
||||
|
||||
## 2. Review rules for new entries (PR checklist)
|
||||
|
||||
@@ -43,7 +43,7 @@ Top-level file fields: `$schema` (optional editor hint), `schemaVersion` (int, c
|
||||
2. `navAllow` is the *minimal* set of domains the app's main frame genuinely navigates to — test sign-in redirects, core flows, and downloads; do not add ad/tracking domains just to silence the default-browser handoff, and do not add CDN/asset domains that are only loaded as subresources.
|
||||
3. `popupAllow` contains only identity/SSO domains actually used by the sign-in flow.
|
||||
4. Isolated `profile` unless there is a concrete single-sign-on reason to share.
|
||||
5. `audioPin: true` only for apps whose primary function is audio/video playback.
|
||||
5. `audioPin: true` only for apps whose primary function is audio/video playback, or voice and video calls (`discord`, `facebook`): a call must not be suspended while it is in progress.
|
||||
6. No services that primarily distribute illegal content, and nothing requiring DRM schemes known not to work in WebView2 (see ROADMAP risk register).
|
||||
7. State in the PR description which flows you manually tested inside OmniDeck (or a WebView2 sample) — sign-in, notifications, a core action.
|
||||
8. `pwsh scripts/validate-catalog.ps1` passes locally (CI runs it too).
|
||||
@@ -52,14 +52,14 @@ Top-level file fields: `$schema` (optional editor hint), `schemaVersion` (int, c
|
||||
|
||||
| id | profile | audioPin | Notes |
|
||||
|---|---|---|---|
|
||||
| spotify | spotify | yes | Web Player; DRM works in the runtime ([spike #1](spikes/01-drm-widevine.md)); the third-party sign-in buttons (Google/Facebook/Apple) are still untested ([spike #2](spikes/02-google-sign-in.md)) |
|
||||
| discord | discord | no | no global PTT on web; host hotkey partial mitigation |
|
||||
| spotify | spotify | yes | Web Player; DRM works in the runtime ([spike #1](spikes/01-drm-widevine.md)). "Continue with Google / Facebook / Apple" move the main frame to `accounts.google.com`, `www.facebook.com` and `appleid.apple.com` and back, so those hosts and the `google-account-domains` set are listed (each hop checked up to the provider's sign-in page on 2 November 2026) |
|
||||
| discord | discord | yes | pinned while a voice or video call plays audio; no global PTT on web; host hotkey partial mitigation |
|
||||
| youtube | google | yes | sign-in hops to Google's country-code domains, allowed through the `google-account-domains` set like every `google` entry ([spike #2](spikes/02-google-sign-in.md)) |
|
||||
| gmail | google | no | |
|
||||
| gcalendar | google | no | |
|
||||
| gdrive | google | no | |
|
||||
| gmaps | google | no | replaces a native map mini-app entirely |
|
||||
| facebook | meta | no | also Meta's web messaging (`facebook.com/messages`) since messenger.com closed in April 2026; the Messenger entry was removed |
|
||||
| facebook | meta | yes | pinned while a call or video plays audio; also Meta's web messaging (`facebook.com/messages`) since messenger.com closed in April 2026; the Messenger entry was removed |
|
||||
|
||||
## 4. Known-good candidates for post-v1 PRs
|
||||
|
||||
|
||||
@@ -35,11 +35,13 @@ namespace OmniDeck.App;
|
||||
public partial class OdApp
|
||||
{
|
||||
private readonly OdSingleInstanceGuard _guard;
|
||||
private readonly OdDataRoot _dataRoot;
|
||||
private ServiceProvider? _services;
|
||||
|
||||
internal OdApp(OdSingleInstanceGuard guard)
|
||||
internal OdApp(OdSingleInstanceGuard guard, OdDataRoot dataRoot)
|
||||
{
|
||||
_guard = guard;
|
||||
_dataRoot = dataRoot;
|
||||
}
|
||||
|
||||
/// <summary>The legal documents that ship next to the executable.</summary>
|
||||
@@ -76,10 +78,14 @@ public partial class OdApp
|
||||
private void Start(string[] args)
|
||||
{
|
||||
var startMinimized = args.Contains(OdRunKeyStartup.MinimizedArgument, StringComparer.OrdinalIgnoreCase);
|
||||
var dataRoot = OdDataRoot.Default;
|
||||
var dataRoot = _dataRoot;
|
||||
dataRoot.EnsureCreated();
|
||||
Log.Logger = OdLogging.CreateLogger(dataRoot);
|
||||
Log.ForContext<OdApp>().Information("OmniDeck {Version} starting", OdVersionInfo.FromAssembly(typeof(OdApp).Assembly).DisplayText);
|
||||
if (!dataRoot.IsDefault)
|
||||
{
|
||||
Log.ForContext<OdApp>().Warning("Development data root in use: {DataRoot}", dataRoot.Root);
|
||||
}
|
||||
|
||||
// The catalog decides which web-app modules exist, so it loads before the container is built.
|
||||
var catalog = OdCatalogService.LoadInstalled(dataRoot, TimeProvider.System, Log.Logger);
|
||||
|
||||
@@ -19,15 +19,30 @@ internal static class Program
|
||||
.OnBeforeUninstallFastCallback(_ => OdDataRoot.Default.TryDelete())
|
||||
.Run();
|
||||
|
||||
using var guard = new OdSingleInstanceGuard();
|
||||
var dataRoot = DataRoot();
|
||||
using var guard = new OdSingleInstanceGuard(dataRoot.InstanceSuffix);
|
||||
if (!guard.IsPrimaryInstance)
|
||||
{
|
||||
guard.SignalPrimaryInstance();
|
||||
return 0;
|
||||
}
|
||||
|
||||
var app = new OdApp(guard);
|
||||
var app = new OdApp(guard, dataRoot);
|
||||
app.InitializeComponent();
|
||||
return app.Run();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The signed-in user's data root. A Debug build can be pointed elsewhere with
|
||||
/// <see cref="OdDataRoot.OverrideVariable"/>, so it runs beside an installed OmniDeck without
|
||||
/// touching its data; a Release build never reads the variable.
|
||||
/// </summary>
|
||||
private static OdDataRoot DataRoot()
|
||||
{
|
||||
#if DEBUG
|
||||
return OdDataRoot.Choose(Environment.GetEnvironmentVariable(OdDataRoot.OverrideVariable));
|
||||
#else
|
||||
return OdDataRoot.Default;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,6 @@
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
|
||||
namespace OmniDeck.Core.Storage;
|
||||
|
||||
/// <summary>
|
||||
@@ -11,6 +14,13 @@ public sealed class OdDataRoot
|
||||
/// <summary>The data root's folder name under <c>%LocalAppData%</c>.</summary>
|
||||
public const string FolderName = "OmniDeck.Data";
|
||||
|
||||
/// <summary>
|
||||
/// The environment variable a Debug build reads to use a data root of its own, so a development
|
||||
/// copy runs beside an installed OmniDeck without touching its data (CONTRIBUTING.md). Release
|
||||
/// builds never read it.
|
||||
/// </summary>
|
||||
public const string OverrideVariable = "OMNIDECK_DATA_ROOT";
|
||||
|
||||
/// <summary>Velopack's install folder name, which the data root must never be.</summary>
|
||||
private const string InstallFolderName = "OmniDeck";
|
||||
|
||||
@@ -28,8 +38,25 @@ public sealed class OdDataRoot
|
||||
public static OdDataRoot Default { get; } = new(Path.Combine(
|
||||
Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), FolderName));
|
||||
|
||||
/// <summary><paramref name="overridePath"/> when it is set, otherwise <see cref="Default"/>.</summary>
|
||||
public static OdDataRoot Choose(string? overridePath) =>
|
||||
string.IsNullOrWhiteSpace(overridePath) ? Default : new OdDataRoot(overridePath);
|
||||
|
||||
public string Root { get; }
|
||||
|
||||
/// <summary>Whether this is the signed-in user's real data root.</summary>
|
||||
public bool IsDefault => string.Equals(
|
||||
Path.TrimEndingDirectorySeparator(Root), Path.TrimEndingDirectorySeparator(Default.Root), StringComparison.OrdinalIgnoreCase);
|
||||
|
||||
/// <summary>
|
||||
/// Tells single-instance guards apart per data root: <see langword="null"/> for the real one and a
|
||||
/// short hash of the path otherwise, so a development build with a root of its own does not hand
|
||||
/// off to the installed OmniDeck.
|
||||
/// </summary>
|
||||
public string? InstanceSuffix => IsDefault
|
||||
? null
|
||||
: "." + Convert.ToHexString(SHA256.HashData(Encoding.UTF8.GetBytes(Path.TrimEndingDirectorySeparator(Root).ToUpperInvariant())), 0, 4);
|
||||
|
||||
public string SettingsFile => Path.Combine(Root, "settings.json");
|
||||
|
||||
public string DatabaseFile => Path.Combine(Root, "omnideck.db");
|
||||
|
||||
@@ -34,6 +34,51 @@ public sealed class OdDataRootTests
|
||||
Assert.Throws<ArgumentException>(() => new OdDataRoot(temp.Combine(name)));
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(null)]
|
||||
[InlineData("")]
|
||||
[InlineData(" ")]
|
||||
public void Choose_WithoutAnOverride_IsTheRealRoot(string? overridePath)
|
||||
{
|
||||
var root = OdDataRoot.Choose(overridePath);
|
||||
|
||||
Assert.Same(OdDataRoot.Default, root);
|
||||
Assert.True(root.IsDefault);
|
||||
Assert.Null(root.InstanceSuffix);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Choose_WithAnOverride_UsesIt_AndGetsAnInstanceOfItsOwn()
|
||||
{
|
||||
using var temp = new OdTempDirectory();
|
||||
var path = temp.Combine("OmniDeck.Dev");
|
||||
|
||||
var root = OdDataRoot.Choose(path);
|
||||
|
||||
Assert.Equal(path, root.Root, StringComparer.OrdinalIgnoreCase);
|
||||
Assert.False(root.IsDefault);
|
||||
Assert.Matches("^\\.[0-9A-F]{8}$", root.InstanceSuffix);
|
||||
Assert.Equal(root.InstanceSuffix, OdDataRoot.Choose(path.ToUpperInvariant() + Path.DirectorySeparatorChar).InstanceSuffix, StringComparer.Ordinal);
|
||||
Assert.NotEqual(root.InstanceSuffix, OdDataRoot.Choose(temp.Combine("OmniDeck.Other")).InstanceSuffix, StringComparer.Ordinal);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Choose_StillRejectsVelopacksInstallFolder()
|
||||
{
|
||||
using var temp = new OdTempDirectory();
|
||||
|
||||
Assert.Throws<ArgumentException>(() => OdDataRoot.Choose(temp.Combine("OmniDeck")));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Choose_TheRealPathItself_CountsAsTheRealRoot()
|
||||
{
|
||||
var root = OdDataRoot.Choose(OdDataRoot.Default.Root + Path.DirectorySeparatorChar);
|
||||
|
||||
Assert.True(root.IsDefault);
|
||||
Assert.Null(root.InstanceSuffix);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void EnsureCreated_ThenTryDelete_LeavesNothing()
|
||||
{
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using System.Globalization;
|
||||
using System.Net;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Text.Json;
|
||||
@@ -97,20 +98,23 @@ public sealed class OdCatalogTests : IDisposable
|
||||
var bundled = _temp.Combine("bundled.json");
|
||||
var saved = Path.Combine(_temp.Path, "saved", "webapps.json");
|
||||
File.WriteAllText(bundled, RepositoryCatalog);
|
||||
var shipped = OdCatalogJson.Parse(RepositoryCatalog).Updated;
|
||||
var today = DateOnly.ParseExact(shipped, "yyyy-MM-dd", CultureInfo.InvariantCulture);
|
||||
var later = today.AddDays(1).ToString("yyyy-MM-dd", CultureInfo.InvariantCulture);
|
||||
|
||||
Assert.Equal("2026-11-02", OdCatalogService.Load(bundled, saved, Today, Logger.None).Updated);
|
||||
Assert.Equal(shipped, OdCatalogService.Load(bundled, saved, today, Logger.None).Updated);
|
||||
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(saved)!);
|
||||
File.WriteAllText(saved, Changed(root => root["updated"] = "2026-11-03"));
|
||||
Assert.Equal("2026-11-03", OdCatalogService.Load(bundled, saved, Today, Logger.None).Updated);
|
||||
File.WriteAllText(saved, Changed(root => root["updated"] = later));
|
||||
Assert.Equal(later, OdCatalogService.Load(bundled, saved, today, Logger.None).Updated);
|
||||
|
||||
File.WriteAllText(saved, Changed(root => root["updated"] = "2026-10-01"));
|
||||
Assert.Equal("2026-11-02", OdCatalogService.Load(bundled, saved, Today, Logger.None).Updated);
|
||||
Assert.Equal(shipped, OdCatalogService.Load(bundled, saved, today, Logger.None).Updated);
|
||||
|
||||
File.WriteAllText(saved, "{ broken");
|
||||
Assert.Equal("2026-11-02", OdCatalogService.Load(bundled, saved, Today, Logger.None).Updated);
|
||||
Assert.Equal(shipped, OdCatalogService.Load(bundled, saved, today, Logger.None).Updated);
|
||||
|
||||
Assert.Empty(OdCatalogService.Load(_temp.Combine("missing.json"), _temp.Combine("missing-too.json"), Today, Logger.None).Apps);
|
||||
Assert.Empty(OdCatalogService.Load(_temp.Combine("missing.json"), _temp.Combine("missing-too.json"), today, Logger.None).Apps);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
@@ -42,7 +42,11 @@ public sealed class OdWebRunnerTests : IDisposable
|
||||
[InlineData("youtube", "https://www.youtube.com/watch?v=1", OdNavDecision.Allow)]
|
||||
[InlineData("youtube", "https://accounts.google.com.vn/accounts/SetSID", OdNavDecision.Allow)]
|
||||
[InlineData("gmail", "https://accounts.google.co.jp/accounts/SetSID", OdNavDecision.Allow)]
|
||||
[InlineData("spotify", "https://accounts.google.com.vn/accounts/SetSID", OdNavDecision.OpenExternally)]
|
||||
[InlineData("spotify", "https://accounts.google.com.vn/accounts/SetSID", OdNavDecision.Allow)]
|
||||
[InlineData("spotify", "https://accounts.google.com/v3/signin/identifier", OdNavDecision.Allow)]
|
||||
[InlineData("spotify", "https://www.facebook.com/login.php", OdNavDecision.Allow)]
|
||||
[InlineData("spotify", "https://appleid.apple.com/auth/authorize", OdNavDecision.Allow)]
|
||||
[InlineData("spotify", "https://mail.google.com/", OdNavDecision.OpenExternally)]
|
||||
[InlineData("gmail", "https://evilgoogle.com/", OdNavDecision.OpenExternally)]
|
||||
[InlineData("gmail", "http://mail.google.com/", OdNavDecision.OpenExternally)]
|
||||
[InlineData("gmail", "mailto:someone@example.com", OdNavDecision.OpenExternally)]
|
||||
|
||||
Reference in new issue
Block a user