Publishing the source is what asks for it: a modified version has to carry prominent notices saying it was modified, with a date. These files already added a Coffey Labs copyright line beside upstream's, which implies as much without saying it; now they say it. 38 files, found by diffing against the merge base with upstream rather than by guessing. Upstream's own notices are untouched. The build is unchanged.
57 lines
1.5 KiB
TypeScript
57 lines
1.5 KiB
TypeScript
/*
|
|
* SPDX-FileCopyrightText: 2020 Stalwart Labs LLC <[email protected]>
|
|
* SPDX-FileCopyrightText: 2026 Coffey Labs
|
|
*
|
|
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-SEL
|
|
*
|
|
* Modified by Coffey Labs in 2026 for INBUXA.
|
|
*/
|
|
|
|
import {
|
|
findFirstAccessibleLinkInLayout,
|
|
findFirstVisibleLinkInLayout,
|
|
isLinkAccessible,
|
|
type CanGet,
|
|
type HasPermission,
|
|
} from '@/lib/layout';
|
|
import type { Layout, Schema } from '@/types/schema';
|
|
|
|
const STORAGE_KEY = 'inbuxa-last-visited';
|
|
|
|
function readAll(): Record<string, unknown> {
|
|
try {
|
|
const raw = localStorage.getItem(STORAGE_KEY);
|
|
const parsed: unknown = raw ? JSON.parse(raw) : null;
|
|
return parsed && typeof parsed === 'object' && !Array.isArray(parsed) ? (parsed as Record<string, unknown>) : {};
|
|
} catch {
|
|
return {};
|
|
}
|
|
}
|
|
|
|
export function rememberLastVisited(section: string, viewName: string): void {
|
|
try {
|
|
const all = readAll();
|
|
if (all[section] === viewName) return;
|
|
localStorage.setItem(STORAGE_KEY, JSON.stringify({ ...all, [section]: viewName }));
|
|
} catch {
|
|
return;
|
|
}
|
|
}
|
|
|
|
export function sectionLandingLink(
|
|
schema: Schema,
|
|
layout: Layout,
|
|
edition: string,
|
|
canGet: CanGet,
|
|
hasPerm?: HasPermission,
|
|
): string | null {
|
|
const last = readAll()[layout.name];
|
|
if (typeof last === 'string' && isLinkAccessible(schema, last, edition, canGet, hasPerm)) {
|
|
return last;
|
|
}
|
|
return (
|
|
findFirstAccessibleLinkInLayout(schema, layout, edition, canGet, hasPerm) ??
|
|
findFirstVisibleLinkInLayout(schema, layout, edition, canGet, hasPerm)
|
|
);
|
|
}
|