Gate pre-auth UI fetches and batch pending backend/app cleanup changes
This commit is contained in:
parent
b60f42f6fe
commit
a436d57ce5
@ -30,11 +30,15 @@ function runtimeForCurrentPlatform() {
|
|||||||
if (arch === "arm64") return "osx-arm64";
|
if (arch === "arm64") return "osx-arm64";
|
||||||
return "osx-x64";
|
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() {
|
function sidecarFileName() {
|
||||||
return process.platform === "win32" ? "Journal.Sidecar.exe" : "Journal.Sidecar";
|
return process.platform === "win32"
|
||||||
|
? "Journal.Sidecar.exe"
|
||||||
|
: "Journal.Sidecar";
|
||||||
}
|
}
|
||||||
|
|
||||||
const runtime = runtimeForCurrentPlatform();
|
const runtime = runtimeForCurrentPlatform();
|
||||||
@ -42,7 +46,9 @@ const sidecarName = sidecarFileName();
|
|||||||
const publishedSidecar = path.join(publishOutputDir, sidecarName);
|
const publishedSidecar = path.join(publishOutputDir, sidecarName);
|
||||||
const bundledSidecar = path.join(tauriBinDir, 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 = [
|
const publishArgs = [
|
||||||
"publish",
|
"publish",
|
||||||
|
|||||||
@ -24,9 +24,7 @@
|
|||||||
"bundle": {
|
"bundle": {
|
||||||
"active": true,
|
"active": true,
|
||||||
"targets": "all",
|
"targets": "all",
|
||||||
"resources": [
|
"resources": ["bin"],
|
||||||
"bin"
|
|
||||||
],
|
|
||||||
"icon": [
|
"icon": [
|
||||||
"icons/32x32.png",
|
"icons/32x32.png",
|
||||||
"icons/128x128.png",
|
"icons/128x128.png",
|
||||||
|
|||||||
@ -30,6 +30,7 @@
|
|||||||
todoListsStore,
|
todoListsStore,
|
||||||
todosStore,
|
todosStore,
|
||||||
} from "$lib/stores/todos";
|
} from "$lib/stores/todos";
|
||||||
|
import { vaultUnlocked } from "$lib/stores/session";
|
||||||
import { extractEntryTags } from "$lib/utils/metadata";
|
import { extractEntryTags } from "$lib/utils/metadata";
|
||||||
|
|
||||||
export let activeSection = "entries";
|
export let activeSection = "entries";
|
||||||
@ -338,6 +339,10 @@
|
|||||||
calendarError = "";
|
calendarError = "";
|
||||||
try {
|
try {
|
||||||
if (requestId !== calendarRefreshRequestId) return;
|
if (requestId !== calendarRefreshRequestId) return;
|
||||||
|
if (!$vaultUnlocked) {
|
||||||
|
calendarTimelineItems = [];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const { startDate, endDate } = getActiveDateRange();
|
const { startDate, endDate } = getActiveDateRange();
|
||||||
const entryItems = await searchEntriesAsItems({
|
const entryItems = await searchEntriesAsItems({
|
||||||
@ -616,6 +621,12 @@
|
|||||||
|
|
||||||
async function refreshTemplates() {
|
async function refreshTemplates() {
|
||||||
if (activeSection !== "entries") return;
|
if (activeSection !== "entries") return;
|
||||||
|
if (!$vaultUnlocked) {
|
||||||
|
templatesBusy = false;
|
||||||
|
templateError = "";
|
||||||
|
templateItems = [];
|
||||||
|
return;
|
||||||
|
}
|
||||||
templatesBusy = true;
|
templatesBusy = true;
|
||||||
templateError = "";
|
templateError = "";
|
||||||
try {
|
try {
|
||||||
|
|||||||
@ -176,7 +176,9 @@
|
|||||||
|
|
||||||
function pruneDocumentCache(preserveIds: string[] = []) {
|
function pruneDocumentCache(preserveIds: string[] = []) {
|
||||||
const preserve = new Set(
|
const preserve = new Set(
|
||||||
preserveIds.filter(Boolean).concat(activeDocumentId ? [activeDocumentId] : []),
|
preserveIds
|
||||||
|
.filter(Boolean)
|
||||||
|
.concat(activeDocumentId ? [activeDocumentId] : []),
|
||||||
);
|
);
|
||||||
const cachedIds = Object.keys(openDocuments);
|
const cachedIds = Object.keys(openDocuments);
|
||||||
if (cachedIds.length <= MAX_CACHED_DOCUMENTS) return;
|
if (cachedIds.length <= MAX_CACHED_DOCUMENTS) return;
|
||||||
|
|||||||
@ -25,7 +25,7 @@ public class InMemoryFragmentRepository : IFragmentRepository
|
|||||||
|
|
||||||
public void Add(Fragment fragment)
|
public void Add(Fragment fragment)
|
||||||
{
|
{
|
||||||
if (fragment is null) throw new ArgumentNullException(nameof(fragment));
|
ArgumentNullException.ThrowIfNull(fragment);
|
||||||
lock (_lock)
|
lock (_lock)
|
||||||
{
|
{
|
||||||
if (fragment.Tags != null)
|
if (fragment.Tags != null)
|
||||||
|
|||||||
@ -266,19 +266,16 @@ public sealed class SqliteFragmentRepository(IDatabaseSessionService session) :
|
|||||||
|
|
||||||
foreach (var tag in tags)
|
foreach (var tag in tags)
|
||||||
{
|
{
|
||||||
// Upsert into tags table
|
|
||||||
using var upsert = conn.CreateCommand();
|
using var upsert = conn.CreateCommand();
|
||||||
upsert.CommandText = "INSERT OR IGNORE INTO tags (name) VALUES (@name);";
|
upsert.CommandText = "INSERT OR IGNORE INTO tags (name) VALUES (@name);";
|
||||||
upsert.Parameters.AddWithValue("@name", tag);
|
upsert.Parameters.AddWithValue("@name", tag);
|
||||||
upsert.ExecuteNonQuery();
|
upsert.ExecuteNonQuery();
|
||||||
|
|
||||||
// Get tag id
|
|
||||||
using var getTagId = conn.CreateCommand();
|
using var getTagId = conn.CreateCommand();
|
||||||
getTagId.CommandText = "SELECT id FROM tags WHERE name = @name;";
|
getTagId.CommandText = "SELECT id FROM tags WHERE name = @name;";
|
||||||
getTagId.Parameters.AddWithValue("@name", tag);
|
getTagId.Parameters.AddWithValue("@name", tag);
|
||||||
var tagId = (long)getTagId.ExecuteScalar()!;
|
var tagId = (long)getTagId.ExecuteScalar()!;
|
||||||
|
|
||||||
// Link fragment to tag
|
|
||||||
using var link = conn.CreateCommand();
|
using var link = conn.CreateCommand();
|
||||||
link.CommandText = "INSERT OR IGNORE INTO fragment_tags (fragment_id, tag_id) VALUES (@fid, @tid);";
|
link.CommandText = "INSERT OR IGNORE INTO fragment_tags (fragment_id, tag_id) VALUES (@fid, @tid);";
|
||||||
link.Parameters.AddWithValue("@fid", fragmentRowId);
|
link.Parameters.AddWithValue("@fid", fragmentRowId);
|
||||||
@ -289,7 +286,6 @@ public sealed class SqliteFragmentRepository(IDatabaseSessionService session) :
|
|||||||
|
|
||||||
private static Fragment MapRow(SqliteDataReader reader)
|
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 guid = Guid.Parse(reader.GetString(1));
|
||||||
var type = reader.GetString(2);
|
var type = reader.GetString(2);
|
||||||
var description = reader.IsDBNull(3) ? "" : reader.GetString(3);
|
var description = reader.IsDBNull(3) ? "" : reader.GetString(3);
|
||||||
|
|||||||
@ -75,8 +75,5 @@ public sealed class DatabaseSessionService(IJournalDatabaseService database) : I
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose() => CloseConnection();
|
||||||
{
|
|
||||||
CloseConnection();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -136,15 +136,15 @@ public sealed class JournalDatabaseService(IJournalConfigService config) : IJour
|
|||||||
public JournalDatabaseStatus GetStatus(string password)
|
public JournalDatabaseStatus GetStatus(string password)
|
||||||
{
|
{
|
||||||
var tables = GetSchemaStatements().Keys.OrderBy(x => x, StringComparer.Ordinal).ToArray();
|
var tables = GetSchemaStatements().Keys.OrderBy(x => x, StringComparer.Ordinal).ToArray();
|
||||||
var runtime = ProbeRuntime(password);
|
var (Ready, Message) = ProbeRuntime(password);
|
||||||
return new JournalDatabaseStatus(
|
return new JournalDatabaseStatus(
|
||||||
DatabasePath: GetDatabasePath(),
|
DatabasePath: GetDatabasePath(),
|
||||||
KeyLengthBytes: DeriveDatabaseKey(password).Length,
|
KeyLengthBytes: DeriveDatabaseKey(password).Length,
|
||||||
Iterations: Iterations,
|
Iterations: Iterations,
|
||||||
KeyDerivation: "PBKDF2-HMAC-SHA256",
|
KeyDerivation: "PBKDF2-HMAC-SHA256",
|
||||||
SchemaTables: tables,
|
SchemaTables: tables,
|
||||||
RuntimeReady: runtime.Ready,
|
RuntimeReady: Ready,
|
||||||
RuntimeMessage: runtime.Message);
|
RuntimeMessage: Message);
|
||||||
}
|
}
|
||||||
|
|
||||||
public JournalDatabaseHydrationResult HydrateWorkspace(string password)
|
public JournalDatabaseHydrationResult HydrateWorkspace(string password)
|
||||||
|
|||||||
@ -76,6 +76,6 @@ public static partial class HtmlSanitizer
|
|||||||
];
|
];
|
||||||
if (markers.Any(marker => lowered.Contains(marker, StringComparison.Ordinal)))
|
if (markers.Any(marker => lowered.Contains(marker, StringComparison.Ordinal)))
|
||||||
return true;
|
return true;
|
||||||
return HtmlTagCountRegex().Matches(lowered).Count >= 8;
|
return HtmlTagCountRegex().Count(lowered) >= 8;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -17,8 +17,7 @@ public sealed class DisabledSpeechBridgeService(string provider = "none", string
|
|||||||
SpeechTranscribeRequestDto request,
|
SpeechTranscribeRequestDto request,
|
||||||
CancellationToken cancellationToken = default)
|
CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
if (request is null)
|
ArgumentNullException.ThrowIfNull(request);
|
||||||
throw new ArgumentNullException(nameof(request));
|
|
||||||
var engine = string.IsNullOrWhiteSpace(request.Engine) ? "none" : request.Engine.Trim();
|
var engine = string.IsNullOrWhiteSpace(request.Engine) ? "none" : request.Engine.Trim();
|
||||||
var warning = $"{_message} (provider={_provider})";
|
var warning = $"{_message} (provider={_provider})";
|
||||||
return Task.FromResult(new SpeechTranscribeResultDto("", engine, warning));
|
return Task.FromResult(new SpeechTranscribeResultDto("", engine, warning));
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user