Gate pre-auth UI fetches and batch pending backend/app cleanup changes

This commit is contained in:
Jacob Schmidt 2026-02-28 18:29:18 -06:00
parent b60f42f6fe
commit a436d57ce5
10 changed files with 31 additions and 22 deletions

View File

@ -30,11 +30,15 @@ function runtimeForCurrentPlatform() {
if (arch === "arm64") return "osx-arm64";
return "osx-x64";
}
throw new Error(`Unsupported platform '${process.platform}' for sidecar publish.`);
throw new Error(
`Unsupported platform '${process.platform}' for sidecar publish.`,
);
}
function sidecarFileName() {
return process.platform === "win32" ? "Journal.Sidecar.exe" : "Journal.Sidecar";
return process.platform === "win32"
? "Journal.Sidecar.exe"
: "Journal.Sidecar";
}
const runtime = runtimeForCurrentPlatform();
@ -42,7 +46,9 @@ const sidecarName = sidecarFileName();
const publishedSidecar = path.join(publishOutputDir, sidecarName);
const bundledSidecar = path.join(tauriBinDir, sidecarName);
console.log(`Publishing sidecar for ${process.platform}/${process.arch} (${runtime})...`);
console.log(
`Publishing sidecar for ${process.platform}/${process.arch} (${runtime})...`,
);
const publishArgs = [
"publish",

View File

@ -24,9 +24,7 @@
"bundle": {
"active": true,
"targets": "all",
"resources": [
"bin"
],
"resources": ["bin"],
"icon": [
"icons/32x32.png",
"icons/128x128.png",

View File

@ -30,6 +30,7 @@
todoListsStore,
todosStore,
} from "$lib/stores/todos";
import { vaultUnlocked } from "$lib/stores/session";
import { extractEntryTags } from "$lib/utils/metadata";
export let activeSection = "entries";
@ -338,6 +339,10 @@
calendarError = "";
try {
if (requestId !== calendarRefreshRequestId) return;
if (!$vaultUnlocked) {
calendarTimelineItems = [];
return;
}
const { startDate, endDate } = getActiveDateRange();
const entryItems = await searchEntriesAsItems({
@ -616,6 +621,12 @@
async function refreshTemplates() {
if (activeSection !== "entries") return;
if (!$vaultUnlocked) {
templatesBusy = false;
templateError = "";
templateItems = [];
return;
}
templatesBusy = true;
templateError = "";
try {

View File

@ -176,7 +176,9 @@
function pruneDocumentCache(preserveIds: string[] = []) {
const preserve = new Set(
preserveIds.filter(Boolean).concat(activeDocumentId ? [activeDocumentId] : []),
preserveIds
.filter(Boolean)
.concat(activeDocumentId ? [activeDocumentId] : []),
);
const cachedIds = Object.keys(openDocuments);
if (cachedIds.length <= MAX_CACHED_DOCUMENTS) return;

View File

@ -25,7 +25,7 @@ public class InMemoryFragmentRepository : IFragmentRepository
public void Add(Fragment fragment)
{
if (fragment is null) throw new ArgumentNullException(nameof(fragment));
ArgumentNullException.ThrowIfNull(fragment);
lock (_lock)
{
if (fragment.Tags != null)

View File

@ -266,19 +266,16 @@ public sealed class SqliteFragmentRepository(IDatabaseSessionService session) :
foreach (var tag in tags)
{
// Upsert into tags table
using var upsert = conn.CreateCommand();
upsert.CommandText = "INSERT OR IGNORE INTO tags (name) VALUES (@name);";
upsert.Parameters.AddWithValue("@name", tag);
upsert.ExecuteNonQuery();
// Get tag id
using var getTagId = conn.CreateCommand();
getTagId.CommandText = "SELECT id FROM tags WHERE name = @name;";
getTagId.Parameters.AddWithValue("@name", tag);
var tagId = (long)getTagId.ExecuteScalar()!;
// Link fragment to tag
using var link = conn.CreateCommand();
link.CommandText = "INSERT OR IGNORE INTO fragment_tags (fragment_id, tag_id) VALUES (@fid, @tid);";
link.Parameters.AddWithValue("@fid", fragmentRowId);
@ -289,7 +286,6 @@ public sealed class SqliteFragmentRepository(IDatabaseSessionService session) :
private static Fragment MapRow(SqliteDataReader reader)
{
// columns: id (int), guid (text), type (text), description (text), time (text)
var guid = Guid.Parse(reader.GetString(1));
var type = reader.GetString(2);
var description = reader.IsDBNull(3) ? "" : reader.GetString(3);

View File

@ -75,8 +75,5 @@ public sealed class DatabaseSessionService(IJournalDatabaseService database) : I
}
}
public void Dispose()
{
CloseConnection();
}
public void Dispose() => CloseConnection();
}

View File

@ -136,15 +136,15 @@ public sealed class JournalDatabaseService(IJournalConfigService config) : IJour
public JournalDatabaseStatus GetStatus(string password)
{
var tables = GetSchemaStatements().Keys.OrderBy(x => x, StringComparer.Ordinal).ToArray();
var runtime = ProbeRuntime(password);
var (Ready, Message) = ProbeRuntime(password);
return new JournalDatabaseStatus(
DatabasePath: GetDatabasePath(),
KeyLengthBytes: DeriveDatabaseKey(password).Length,
Iterations: Iterations,
KeyDerivation: "PBKDF2-HMAC-SHA256",
SchemaTables: tables,
RuntimeReady: runtime.Ready,
RuntimeMessage: runtime.Message);
RuntimeReady: Ready,
RuntimeMessage: Message);
}
public JournalDatabaseHydrationResult HydrateWorkspace(string password)

View File

@ -76,6 +76,6 @@ public static partial class HtmlSanitizer
];
if (markers.Any(marker => lowered.Contains(marker, StringComparison.Ordinal)))
return true;
return HtmlTagCountRegex().Matches(lowered).Count >= 8;
return HtmlTagCountRegex().Count(lowered) >= 8;
}
}

View File

@ -17,8 +17,7 @@ public sealed class DisabledSpeechBridgeService(string provider = "none", string
SpeechTranscribeRequestDto request,
CancellationToken cancellationToken = default)
{
if (request is null)
throw new ArgumentNullException(nameof(request));
ArgumentNullException.ThrowIfNull(request);
var engine = string.IsNullOrWhiteSpace(request.Engine) ? "none" : request.Engine.Trim();
var warning = $"{_message} (provider={_provider})";
return Task.FromResult(new SpeechTranscribeResultDto("", engine, warning));