feat: rebrand Netify to BackOne and resolve lookup database bug
This commit is contained in:
1 parent
8e22884464
commit
739ca8934e
7 files changed
+82
-40
No files matched your search
@@ -218,7 +218,7 @@ export default function AgentsPage() {
|
||||
<li>Buka dan login ke portal <a href="https://portal.netify.ai" target="_blank" rel="noopener noreferrer" className="text-primary hover:underline font-medium">BackOne Portal</a>.</li>
|
||||
<li>Di menu sebelah kiri, navigasikan ke <strong>Settings</strong> > <strong>API Keys</strong>.</li>
|
||||
<li>Buat atau salin kunci tipe <strong>Standard API Key</strong>.</li>
|
||||
<li>Buka file <code className="text-slate-200">.env.local</code> di proyek Anda, lalu ganti nilai <code className="text-slate-200">NETIFY_API_KEY</code> dengan kunci baru tersebut.</li>
|
||||
<li>Buka file <code className="text-slate-200">.env.local</code> di proyek Anda, lalu ganti nilai <code className="text-slate-200">BACKONE_API_KEY</code> (atau <code className="text-slate-200">NETIFY_API_KEY</code>) dengan kunci baru tersebut.</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -83,15 +83,23 @@ export default function LookupPage() {
|
||||
<div className="flex items-start justify-between">
|
||||
<div className="h-10 w-10 rounded-lg bg-secondary/80 flex items-center justify-center overflow-hidden border border-border/40 group-hover:border-primary/20 transition-all">
|
||||
{app.favicon || app.logo ? (
|
||||
<img
|
||||
src={app.favicon || app.logo}
|
||||
alt={app.label}
|
||||
className="h-6 w-6 object-contain"
|
||||
onError={(e) => {
|
||||
// If image fails, replace with default icon
|
||||
(e.target as HTMLElement).style.display = 'none';
|
||||
}}
|
||||
/>
|
||||
<>
|
||||
<img
|
||||
src={app.favicon || app.logo}
|
||||
alt={app.label}
|
||||
className="h-6 w-6 object-contain"
|
||||
onError={(e) => {
|
||||
// If image fails, hide it and show the sibling icon
|
||||
const img = e.target as HTMLElement;
|
||||
img.style.display = 'none';
|
||||
const sibling = img.nextSibling as HTMLElement;
|
||||
if (sibling) {
|
||||
sibling.style.display = 'block';
|
||||
}
|
||||
}}
|
||||
/>
|
||||
<AppWindow className="h-5 w-5 text-slate-400" style={{ display: 'none' }} />
|
||||
</>
|
||||
) : (
|
||||
<AppWindow className="h-5 w-5 text-slate-400" />
|
||||
)}
|
||||
|
||||
@@ -32,7 +32,7 @@ async function handleProxy(req: NextRequest, { params }: { params: Promise<{ rou
|
||||
const localBase = process.env.NEXT_PUBLIC_API_URL || 'http://127.0.0.1:3001';
|
||||
destinationUrl = `${localBase}/api/${route}${url.search}`;
|
||||
} else {
|
||||
const baseUrl = process.env.NETIFY_BASE_URL || 'https://manager.netify.ai/api/v1';
|
||||
const baseUrl = process.env.BACKONE_BASE_URL || process.env.NETIFY_BASE_URL || 'https://manager.netify.ai/api/v1';
|
||||
destinationUrl = `${baseUrl}/${route}${url.search}`;
|
||||
}
|
||||
|
||||
@@ -41,11 +41,15 @@ async function handleProxy(req: NextRequest, { params }: { params: Promise<{ rou
|
||||
headers.set('Content-Type', 'application/json');
|
||||
|
||||
if (routeArray[0] !== 'auth' && routeArray[0] !== 'dashboard') {
|
||||
if (process.env.NETIFY_JWT_TOKEN && process.env.NETIFY_SITE_UUID) {
|
||||
headers.set('x-api-key', process.env.NETIFY_JWT_TOKEN);
|
||||
headers.set('x-net-site', process.env.NETIFY_SITE_UUID);
|
||||
} else if (process.env.NETIFY_API_KEY) {
|
||||
headers.set('x-api-key', process.env.NETIFY_API_KEY);
|
||||
const jwtToken = process.env.BACKONE_JWT_TOKEN || process.env.NETIFY_JWT_TOKEN;
|
||||
const siteUuid = process.env.BACKONE_SITE_UUID || process.env.NETIFY_SITE_UUID;
|
||||
const apiKey = process.env.BACKONE_API_KEY || process.env.NETIFY_API_KEY;
|
||||
|
||||
if (jwtToken && siteUuid) {
|
||||
headers.set('x-api-key', jwtToken);
|
||||
headers.set('x-net-site', siteUuid);
|
||||
} else if (apiKey) {
|
||||
headers.set('x-api-key', apiKey);
|
||||
}
|
||||
} else {
|
||||
// For local auth/dashboard routes, pass along the cookie for authentication
|
||||
|
||||
+16
-11
@@ -2,16 +2,21 @@
|
||||
|
||||
import { revalidatePath } from "next/cache";
|
||||
|
||||
const API_URL = process.env.NETIFY_BASE_URL ? `${process.env.NETIFY_BASE_URL}/assets/agents` : "https://manager.netify.ai/api/v1/assets/agents";
|
||||
const BASE_URL = process.env.BACKONE_BASE_URL || process.env.NETIFY_BASE_URL;
|
||||
const API_URL = BASE_URL ? `${BASE_URL}/assets/agents` : "https://manager.netify.ai/api/v1/assets/agents";
|
||||
|
||||
const getApiKey = () => process.env.BACKONE_API_KEY || process.env.NETIFY_API_KEY;
|
||||
const getJwtToken = () => process.env.BACKONE_JWT_TOKEN || process.env.NETIFY_JWT_TOKEN;
|
||||
const getSiteUuid = () => process.env.BACKONE_SITE_UUID || process.env.NETIFY_SITE_UUID;
|
||||
|
||||
// Helper function to get headers
|
||||
const getHeaders = () => {
|
||||
const API_KEY = process.env.NETIFY_API_KEY;
|
||||
const JWT_TOKEN = process.env.NETIFY_JWT_TOKEN;
|
||||
const SITE_UUID = process.env.NETIFY_SITE_UUID;
|
||||
const API_KEY = getApiKey();
|
||||
const JWT_TOKEN = getJwtToken();
|
||||
const SITE_UUID = getSiteUuid();
|
||||
|
||||
if (!API_KEY && !JWT_TOKEN) {
|
||||
throw new Error("NETIFY_API_KEY or NETIFY_JWT_TOKEN is not set in environment variables");
|
||||
throw new Error("BACKONE_API_KEY or BACKONE_JWT_TOKEN is not set in environment variables");
|
||||
}
|
||||
|
||||
const headers: Record<string, string> = {
|
||||
@@ -49,8 +54,8 @@ export interface Agent {
|
||||
|
||||
export async function getAgents(): Promise<Agent[]> {
|
||||
try {
|
||||
const API_KEY = process.env.NETIFY_API_KEY;
|
||||
const SITE_UUID = process.env.NETIFY_SITE_UUID;
|
||||
const API_KEY = getApiKey();
|
||||
const SITE_UUID = getSiteUuid();
|
||||
|
||||
// Fallback to Informatics Scorecard Agent if site-scoped API key is used
|
||||
if (API_KEY && API_KEY.startsWith("sk_db_")) {
|
||||
@@ -182,7 +187,7 @@ export async function getAgents(): Promise<Agent[]> {
|
||||
|
||||
export async function getAgent(agentId: string): Promise<Agent | null> {
|
||||
try {
|
||||
const API_KEY = process.env.NETIFY_API_KEY;
|
||||
const API_KEY = getApiKey();
|
||||
if (API_KEY && API_KEY.startsWith("sk_db_")) {
|
||||
const agents = await getAgents();
|
||||
return agents.find(a => a.uuid === agentId || String(a.id) === agentId) || null;
|
||||
@@ -208,7 +213,7 @@ export async function getAgent(agentId: string): Promise<Agent | null> {
|
||||
|
||||
export async function createAgent(agentId: string, label: string) {
|
||||
try {
|
||||
const API_KEY = process.env.NETIFY_API_KEY;
|
||||
const API_KEY = getApiKey();
|
||||
if (API_KEY && API_KEY.startsWith("sk_db_")) {
|
||||
return { success: false, message: "Aksi ditolak: Site-scoped API Key tidak diperbolehkan membuat Agents." };
|
||||
}
|
||||
@@ -236,7 +241,7 @@ export async function createAgent(agentId: string, label: string) {
|
||||
|
||||
export async function updateAgent(agentId: string, label: string) {
|
||||
try {
|
||||
const API_KEY = process.env.NETIFY_API_KEY;
|
||||
const API_KEY = getApiKey();
|
||||
if (API_KEY && API_KEY.startsWith("sk_db_")) {
|
||||
return { success: false, message: "Aksi ditolak: Site-scoped API Key tidak diperbolehkan mengubah Agents." };
|
||||
}
|
||||
@@ -260,7 +265,7 @@ export async function updateAgent(agentId: string, label: string) {
|
||||
|
||||
export async function deleteAgent(agentId: string) {
|
||||
try {
|
||||
const API_KEY = process.env.NETIFY_API_KEY;
|
||||
const API_KEY = getApiKey();
|
||||
if (API_KEY && API_KEY.startsWith("sk_db_")) {
|
||||
return { success: false, message: "Aksi ditolak: Site-scoped API Key tidak diperbolehkan menghapus Agents." };
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user