@promptbook/cli 0.103.0-52 → 0.103.0-54
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/apps/agents-server/README.md +1 -1
- package/apps/agents-server/config.ts +3 -3
- package/apps/agents-server/next.config.ts +1 -1
- package/apps/agents-server/public/sw.js +16 -0
- package/apps/agents-server/src/app/AddAgentButton.tsx +24 -4
- package/apps/agents-server/src/app/actions.ts +15 -13
- package/apps/agents-server/src/app/admin/api-tokens/ApiTokensClient.tsx +186 -0
- package/apps/agents-server/src/app/admin/api-tokens/page.tsx +13 -0
- package/apps/agents-server/src/app/admin/chat-feedback/ChatFeedbackClient.tsx +541 -0
- package/apps/agents-server/src/app/admin/chat-feedback/page.tsx +22 -0
- package/apps/agents-server/src/app/admin/chat-history/ChatHistoryClient.tsx +532 -0
- package/apps/agents-server/src/app/admin/chat-history/page.tsx +21 -0
- package/apps/agents-server/src/app/admin/metadata/MetadataClient.tsx +241 -27
- package/apps/agents-server/src/app/admin/models/page.tsx +22 -0
- package/apps/agents-server/src/app/admin/users/[userId]/UserDetailClient.tsx +131 -0
- package/apps/agents-server/src/app/admin/users/[userId]/page.tsx +21 -0
- package/apps/agents-server/src/app/admin/users/page.tsx +18 -0
- package/apps/agents-server/src/app/agents/[agentName]/AgentChatWrapper.tsx +10 -2
- package/apps/agents-server/src/app/agents/[agentName]/ClearAgentChatFeedbackButton.tsx +63 -0
- package/apps/agents-server/src/app/agents/[agentName]/ClearAgentChatHistoryButton.tsx +63 -0
- package/apps/agents-server/src/app/agents/[agentName]/CloneAgentButton.tsx +41 -0
- package/apps/agents-server/src/app/agents/[agentName]/InstallPwaButton.tsx +74 -0
- package/apps/agents-server/src/app/agents/[agentName]/ServiceWorkerRegister.tsx +24 -0
- package/apps/agents-server/src/app/agents/[agentName]/_utils.ts +19 -0
- package/apps/agents-server/src/app/agents/[agentName]/api/agents/route.ts +67 -0
- package/apps/agents-server/src/app/agents/[agentName]/api/openai/chat/completions/route.ts +176 -0
- package/apps/agents-server/src/app/agents/[agentName]/api/profile/route.ts +3 -0
- package/apps/agents-server/src/app/agents/[agentName]/api/voice/route.ts +177 -0
- package/apps/agents-server/src/app/agents/[agentName]/book/page.tsx +3 -0
- package/apps/agents-server/src/app/agents/[agentName]/book+chat/AgentBookAndChat.tsx +53 -1
- package/apps/agents-server/src/app/agents/[agentName]/generateAgentMetadata.ts +11 -11
- package/apps/agents-server/src/app/agents/[agentName]/history/RestoreVersionButton.tsx +46 -0
- package/apps/agents-server/src/app/agents/[agentName]/history/actions.ts +12 -0
- package/apps/agents-server/src/app/agents/[agentName]/history/page.tsx +62 -0
- package/apps/agents-server/src/app/agents/[agentName]/images/icon-256.png/route.tsx +80 -0
- package/apps/agents-server/src/app/agents/[agentName]/images/screenshot-fullhd.png/route.tsx +92 -0
- package/apps/agents-server/src/app/agents/[agentName]/images/screenshot-phone.png/route.tsx +92 -0
- package/apps/agents-server/src/app/agents/[agentName]/integration/page.tsx +61 -0
- package/apps/agents-server/src/app/agents/[agentName]/opengraph-image.tsx +102 -0
- package/apps/agents-server/src/app/agents/[agentName]/page.tsx +64 -24
- package/apps/agents-server/src/app/api/agents/[agentName]/clone/route.ts +47 -0
- package/apps/agents-server/src/app/api/agents/[agentName]/route.ts +19 -0
- package/apps/agents-server/src/app/api/agents/route.ts +22 -13
- package/apps/agents-server/src/app/api/api-tokens/route.ts +76 -0
- package/apps/agents-server/src/app/api/auth/login/route.ts +6 -44
- package/apps/agents-server/src/app/api/chat-feedback/[id]/route.ts +38 -0
- package/apps/agents-server/src/app/api/chat-feedback/route.ts +157 -0
- package/apps/agents-server/src/app/api/chat-history/[id]/route.ts +37 -0
- package/apps/agents-server/src/app/api/chat-history/route.ts +147 -0
- package/apps/agents-server/src/app/api/federated-agents/route.ts +17 -0
- package/apps/agents-server/src/app/api/upload/route.ts +9 -1
- package/apps/agents-server/src/app/docs/[docId]/page.tsx +63 -0
- package/apps/agents-server/src/app/docs/page.tsx +34 -0
- package/apps/agents-server/src/app/layout.tsx +29 -3
- package/apps/agents-server/src/app/manifest.ts +109 -0
- package/apps/agents-server/src/app/page.tsx +8 -45
- package/apps/agents-server/src/app/recycle-bin/RestoreAgentButton.tsx +40 -0
- package/apps/agents-server/src/app/recycle-bin/actions.ts +27 -0
- package/apps/agents-server/src/app/recycle-bin/page.tsx +58 -0
- package/apps/agents-server/src/app/restricted/page.tsx +33 -0
- package/apps/agents-server/src/app/test/og-image/README.md +1 -0
- package/apps/agents-server/src/app/test/og-image/opengraph-image.tsx +37 -0
- package/apps/agents-server/src/app/test/og-image/page.tsx +22 -0
- package/apps/agents-server/src/components/Footer/Footer.tsx +175 -0
- package/apps/agents-server/src/components/Header/Header.tsx +450 -79
- package/apps/agents-server/src/components/Homepage/AgentCard.tsx +46 -14
- package/apps/agents-server/src/components/Homepage/AgentsList.tsx +58 -0
- package/apps/agents-server/src/components/Homepage/Card.tsx +1 -1
- package/apps/agents-server/src/components/Homepage/ExternalAgentsSection.tsx +21 -0
- package/apps/agents-server/src/components/Homepage/ExternalAgentsSectionClient.tsx +183 -0
- package/apps/agents-server/src/components/Homepage/ModelsSection.tsx +75 -0
- package/apps/agents-server/src/components/LayoutWrapper/LayoutWrapper.tsx +29 -3
- package/apps/agents-server/src/components/LoginDialog/LoginDialog.tsx +18 -17
- package/apps/agents-server/src/components/Portal/Portal.tsx +38 -0
- package/apps/agents-server/src/components/UsersList/UsersList.tsx +82 -131
- package/apps/agents-server/src/components/UsersList/useUsersAdmin.ts +139 -0
- package/apps/agents-server/src/database/metadataDefaults.ts +38 -6
- package/apps/agents-server/src/database/migrations/2025-12-0010-llm-cache.sql +12 -0
- package/apps/agents-server/src/database/migrations/2025-12-0060-api-tokens.sql +13 -0
- package/apps/agents-server/src/database/schema.ts +51 -0
- package/apps/agents-server/src/middleware.ts +193 -92
- package/apps/agents-server/src/tools/$provideCdnForServer.ts +3 -7
- package/apps/agents-server/src/tools/$provideExecutionToolsForServer.ts +10 -1
- package/apps/agents-server/src/tools/$provideServer.ts +2 -2
- package/apps/agents-server/src/utils/authenticateUser.ts +42 -0
- package/apps/agents-server/src/utils/cache/SupabaseCacheStorage.ts +55 -0
- package/apps/agents-server/src/utils/cdn/classes/VercelBlobStorage.ts +63 -0
- package/apps/agents-server/src/utils/chatFeedbackAdmin.ts +96 -0
- package/apps/agents-server/src/utils/chatHistoryAdmin.ts +96 -0
- package/apps/agents-server/src/utils/getEffectiveFederatedServers.ts +22 -0
- package/apps/agents-server/src/utils/getFederatedAgents.ts +31 -8
- package/apps/agents-server/src/utils/getFederatedServersFromMetadata.ts +10 -0
- package/apps/agents-server/src/utils/getVisibleCommitmentDefinitions.ts +12 -0
- package/apps/agents-server/src/utils/isUserAdmin.ts +2 -2
- package/apps/agents-server/vercel.json +7 -0
- package/esm/index.es.js +279 -2
- package/esm/index.es.js.map +1 -1
- package/esm/typings/servers.d.ts +8 -1
- package/esm/typings/src/_packages/components.index.d.ts +2 -0
- package/esm/typings/src/_packages/core.index.d.ts +6 -0
- package/esm/typings/src/_packages/types.index.d.ts +2 -0
- package/esm/typings/src/_packages/utils.index.d.ts +2 -0
- package/esm/typings/src/book-2.0/agent-source/AgentModelRequirements.d.ts +7 -0
- package/esm/typings/src/book-components/Chat/Chat/ChatProps.d.ts +4 -0
- package/esm/typings/src/book-components/_common/HamburgerMenu/HamburgerMenu.d.ts +12 -0
- package/esm/typings/src/book-components/icons/MicIcon.d.ts +8 -0
- package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentCollectionInSupabase.d.ts +17 -0
- package/esm/typings/src/commitments/ACTION/ACTION.d.ts +4 -0
- package/esm/typings/src/commitments/DELETE/DELETE.d.ts +4 -0
- package/esm/typings/src/commitments/FORMAT/FORMAT.d.ts +4 -0
- package/esm/typings/src/commitments/GOAL/GOAL.d.ts +4 -0
- package/esm/typings/src/commitments/KNOWLEDGE/KNOWLEDGE.d.ts +4 -0
- package/esm/typings/src/commitments/MEMORY/MEMORY.d.ts +4 -0
- package/esm/typings/src/commitments/MESSAGE/AgentMessageCommitmentDefinition.d.ts +32 -0
- package/esm/typings/src/commitments/MESSAGE/InitialMessageCommitmentDefinition.d.ts +4 -0
- package/esm/typings/src/commitments/MESSAGE/MESSAGE.d.ts +4 -0
- package/esm/typings/src/commitments/MESSAGE/UserMessageCommitmentDefinition.d.ts +32 -0
- package/esm/typings/src/commitments/META/META.d.ts +4 -0
- package/esm/typings/src/commitments/META_COLOR/META_COLOR.d.ts +4 -0
- package/esm/typings/src/commitments/META_IMAGE/META_IMAGE.d.ts +4 -0
- package/esm/typings/src/commitments/META_LINK/META_LINK.d.ts +4 -0
- package/esm/typings/src/commitments/MODEL/MODEL.d.ts +4 -0
- package/esm/typings/src/commitments/NOTE/NOTE.d.ts +4 -0
- package/esm/typings/src/commitments/PERSONA/PERSONA.d.ts +4 -0
- package/esm/typings/src/commitments/RULE/RULE.d.ts +4 -0
- package/esm/typings/src/commitments/SAMPLE/SAMPLE.d.ts +4 -0
- package/esm/typings/src/commitments/SCENARIO/SCENARIO.d.ts +4 -0
- package/esm/typings/src/commitments/STYLE/STYLE.d.ts +4 -0
- package/esm/typings/src/commitments/_base/BaseCommitmentDefinition.d.ts +5 -0
- package/esm/typings/src/commitments/_base/CommitmentDefinition.d.ts +5 -0
- package/esm/typings/src/commitments/_base/NotYetImplementedCommitmentDefinition.d.ts +4 -0
- package/esm/typings/src/commitments/index.d.ts +20 -1
- package/esm/typings/src/execution/LlmExecutionTools.d.ts +9 -0
- package/esm/typings/src/llm-providers/agent/AgentLlmExecutionTools.d.ts +2 -1
- package/esm/typings/src/llm-providers/agent/RemoteAgent.d.ts +10 -1
- package/esm/typings/src/utils/normalization/normalizeMessageText.d.ts +9 -0
- package/esm/typings/src/utils/normalization/normalizeMessageText.test.d.ts +1 -0
- package/esm/typings/src/version.d.ts +1 -1
- package/package.json +2 -2
- package/umd/index.umd.js +279 -2
- package/umd/index.umd.js.map +1 -1
- package/apps/agents-server/src/utils/cdn/classes/DigitalOceanSpaces.ts +0 -119
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import type { AgentsServerDatabase } from '../database/schema';
|
|
2
|
+
|
|
3
|
+
export type ChatHistoryRow = AgentsServerDatabase['public']['Tables']['ChatHistory']['Row'];
|
|
4
|
+
export type ChatHistorySortField = 'createdAt' | 'agentName' | 'id';
|
|
5
|
+
export type ChatHistorySortOrder = 'asc' | 'desc';
|
|
6
|
+
|
|
7
|
+
export type ChatHistoryListResponse = {
|
|
8
|
+
items: ChatHistoryRow[];
|
|
9
|
+
total: number;
|
|
10
|
+
page: number;
|
|
11
|
+
pageSize: number;
|
|
12
|
+
sortBy: ChatHistorySortField;
|
|
13
|
+
sortOrder: ChatHistorySortOrder;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export type ChatHistoryListParams = {
|
|
17
|
+
page?: number;
|
|
18
|
+
pageSize?: number;
|
|
19
|
+
agentName?: string;
|
|
20
|
+
search?: string;
|
|
21
|
+
sortBy?: ChatHistorySortField;
|
|
22
|
+
sortOrder?: ChatHistorySortOrder;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Build query string for chat history listing.
|
|
27
|
+
*/
|
|
28
|
+
function buildQuery(params: ChatHistoryListParams): string {
|
|
29
|
+
const searchParams = new URLSearchParams();
|
|
30
|
+
|
|
31
|
+
if (params.page && params.page > 0) searchParams.set('page', String(params.page));
|
|
32
|
+
if (params.pageSize && params.pageSize > 0) searchParams.set('pageSize', String(params.pageSize));
|
|
33
|
+
if (params.agentName) searchParams.set('agentName', params.agentName);
|
|
34
|
+
if (params.search) searchParams.set('search', params.search);
|
|
35
|
+
if (params.sortBy) searchParams.set('sortBy', params.sortBy);
|
|
36
|
+
if (params.sortOrder) searchParams.set('sortOrder', params.sortOrder);
|
|
37
|
+
|
|
38
|
+
const qs = searchParams.toString();
|
|
39
|
+
return qs ? `?${qs}` : '';
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Fetch chat history from the admin API.
|
|
44
|
+
*
|
|
45
|
+
* This is shared between the admin page and other admin UIs (e.g. per-agent tools)
|
|
46
|
+
* to keep the API surface DRY.
|
|
47
|
+
*/
|
|
48
|
+
export async function $fetchChatHistory(params: ChatHistoryListParams = {}): Promise<ChatHistoryListResponse> {
|
|
49
|
+
const qs = buildQuery(params);
|
|
50
|
+
const response = await fetch(`/api/chat-history${qs}`, {
|
|
51
|
+
method: 'GET',
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
if (!response.ok) {
|
|
55
|
+
const data = await response.json().catch(() => ({}));
|
|
56
|
+
throw new Error(data.error || 'Failed to load chat history');
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return (await response.json()) as ChatHistoryListResponse;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Clear chat history for a specific agent.
|
|
64
|
+
*/
|
|
65
|
+
export async function $clearAgentChatHistory(agentName: string): Promise<void> {
|
|
66
|
+
if (!agentName) {
|
|
67
|
+
throw new Error('agentName is required to clear chat history');
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const response = await fetch(`/api/chat-history?agentName=${encodeURIComponent(agentName)}`, {
|
|
71
|
+
method: 'DELETE',
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
if (!response.ok) {
|
|
75
|
+
const data = await response.json().catch(() => ({}));
|
|
76
|
+
throw new Error(data.error || 'Failed to clear chat history');
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Delete a single chat history row by ID.
|
|
82
|
+
*/
|
|
83
|
+
export async function $deleteChatHistoryRow(id: number): Promise<void> {
|
|
84
|
+
if (!id || id <= 0) {
|
|
85
|
+
throw new Error('Valid id is required to delete chat history row');
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
const response = await fetch(`/api/chat-history/${encodeURIComponent(String(id))}`, {
|
|
89
|
+
method: 'DELETE',
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
if (!response.ok) {
|
|
93
|
+
const data = await response.json().catch(() => ({}));
|
|
94
|
+
throw new Error(data.error || 'Failed to delete chat history row');
|
|
95
|
+
}
|
|
96
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { string_promptbook_server_url } from '../../../../src/types/typeAliases';
|
|
2
|
+
import { AUTO_FEDERATED_AGENT_SERVER_URLS } from '../../../../servers';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Computes the effective list of federated servers for the current Agents Server.
|
|
6
|
+
*
|
|
7
|
+
* - Combines servers listed in the FEDERATED_SERVERS metadata (comma-separated)
|
|
8
|
+
* with a set of auto-federated servers defined in the root servers.ts config.
|
|
9
|
+
* - Ensures uniqueness and trims whitespace.
|
|
10
|
+
*/
|
|
11
|
+
export function getEffectiveFederatedServers(federatedServersString: string): Array<string_promptbook_server_url> {
|
|
12
|
+
const manualFederatedServers = federatedServersString
|
|
13
|
+
.split(',')
|
|
14
|
+
.map((s) => s.trim())
|
|
15
|
+
.filter((s): s is string_promptbook_server_url => s !== '');
|
|
16
|
+
|
|
17
|
+
const merged = Array.from(
|
|
18
|
+
new Set<string_promptbook_server_url>([...manualFederatedServers, ...AUTO_FEDERATED_AGENT_SERVER_URLS]),
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
return merged;
|
|
22
|
+
}
|
|
@@ -11,13 +11,18 @@ type AgentsApiResponse = {
|
|
|
11
11
|
federatedServers: string[];
|
|
12
12
|
};
|
|
13
13
|
|
|
14
|
+
export type AgentsByServer = {
|
|
15
|
+
serverUrl: string;
|
|
16
|
+
agents: AgentWithUrl[];
|
|
17
|
+
};
|
|
18
|
+
|
|
14
19
|
/**
|
|
15
20
|
* Fetches agents from federated servers recursively
|
|
16
21
|
*/
|
|
17
|
-
export async function getFederatedAgents(initialServers: string[]): Promise<
|
|
22
|
+
export async function getFederatedAgents(initialServers: string[]): Promise<AgentsByServer[]> {
|
|
18
23
|
const visited = new Set<string>();
|
|
19
24
|
const queue = [...initialServers];
|
|
20
|
-
const
|
|
25
|
+
const agentsByServer = new Map<string, AgentWithUrl[]>();
|
|
21
26
|
const MAX_SERVERS = 20;
|
|
22
27
|
|
|
23
28
|
while (queue.length > 0 && visited.size < MAX_SERVERS) {
|
|
@@ -30,10 +35,10 @@ export async function getFederatedAgents(initialServers: string[]): Promise<Agen
|
|
|
30
35
|
|
|
31
36
|
try {
|
|
32
37
|
// TODO: [🧠] Should we use some shorter timeout?
|
|
33
|
-
const response = await fetch(`${normalizedUrl}/api/agents`, {
|
|
34
|
-
next: { revalidate: 600 } // Cache for 10 minutes
|
|
38
|
+
const response = await fetch(`${normalizedUrl}/api/agents`, {
|
|
39
|
+
next: { revalidate: 600 }, // Cache for 10 minutes
|
|
35
40
|
});
|
|
36
|
-
|
|
41
|
+
|
|
37
42
|
if (!response.ok) {
|
|
38
43
|
console.warn(`Failed to fetch agents from ${normalizedUrl}: ${response.status} ${response.statusText}`);
|
|
39
44
|
continue;
|
|
@@ -42,11 +47,26 @@ export async function getFederatedAgents(initialServers: string[]): Promise<Agen
|
|
|
42
47
|
const data: AgentsApiResponse = await response.json();
|
|
43
48
|
|
|
44
49
|
if (data.agents && Array.isArray(data.agents)) {
|
|
50
|
+
const serverAgents: AgentWithUrl[] = [];
|
|
51
|
+
const existingAgentUrls = new Set<string>();
|
|
52
|
+
|
|
53
|
+
// Collect all existing agent URLs across all servers
|
|
54
|
+
for (const agents of agentsByServer.values()) {
|
|
55
|
+
for (const agent of agents) {
|
|
56
|
+
existingAgentUrls.add(agent.url);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
45
60
|
for (const agent of data.agents) {
|
|
46
|
-
if (agent.url && !
|
|
47
|
-
|
|
61
|
+
if (agent.url && !existingAgentUrls.has(agent.url)) {
|
|
62
|
+
serverAgents.push(agent);
|
|
63
|
+
existingAgentUrls.add(agent.url);
|
|
48
64
|
}
|
|
49
65
|
}
|
|
66
|
+
|
|
67
|
+
if (serverAgents.length > 0) {
|
|
68
|
+
agentsByServer.set(normalizedUrl, serverAgents);
|
|
69
|
+
}
|
|
50
70
|
}
|
|
51
71
|
|
|
52
72
|
if (data.federatedServers && Array.isArray(data.federatedServers)) {
|
|
@@ -62,5 +82,8 @@ export async function getFederatedAgents(initialServers: string[]): Promise<Agen
|
|
|
62
82
|
}
|
|
63
83
|
}
|
|
64
84
|
|
|
65
|
-
return Array.from(
|
|
85
|
+
return Array.from(agentsByServer.entries()).map(([serverUrl, agents]) => ({
|
|
86
|
+
serverUrl,
|
|
87
|
+
agents,
|
|
88
|
+
}));
|
|
66
89
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { getMetadata } from '../database/getMetadata';
|
|
2
|
+
import { getEffectiveFederatedServers } from './getEffectiveFederatedServers';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Reads FEDERATED_SERVERS metadata and returns a normalized list of server URLs.
|
|
6
|
+
*/
|
|
7
|
+
export async function getFederatedServersFromMetadata(): Promise<string[]> {
|
|
8
|
+
const federatedServersString = (await getMetadata('FEDERATED_SERVERS')) || '';
|
|
9
|
+
return getEffectiveFederatedServers(federatedServersString);
|
|
10
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { getGroupedCommitmentDefinitions } from '../../../../src/commitments';
|
|
2
|
+
import { NotYetImplementedCommitmentDefinition } from '../../../../src/commitments/_base/NotYetImplementedCommitmentDefinition';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Gets visible commitment definitions for documentation
|
|
6
|
+
* Excluding those that are not yet implemented
|
|
7
|
+
*/
|
|
8
|
+
export function getVisibleCommitmentDefinitions() {
|
|
9
|
+
return getGroupedCommitmentDefinitions().filter(
|
|
10
|
+
(group) => !(group.primary instanceof NotYetImplementedCommitmentDefinition),
|
|
11
|
+
);
|
|
12
|
+
}
|
|
@@ -4,13 +4,13 @@ import { getSession } from './session';
|
|
|
4
4
|
/**
|
|
5
5
|
* Checks if the current user is an admin
|
|
6
6
|
*
|
|
7
|
-
* Note: If `process.env.ADMIN_PASSWORD` is not set,
|
|
7
|
+
* Note: If `process.env.ADMIN_PASSWORD` is not set, no one is admin
|
|
8
8
|
*
|
|
9
9
|
* @returns true if the user is admin
|
|
10
10
|
*/
|
|
11
11
|
export async function isUserAdmin(): Promise<boolean> {
|
|
12
12
|
if (!process.env.ADMIN_PASSWORD) {
|
|
13
|
-
return
|
|
13
|
+
return false;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
// Check legacy admin token
|