From 4bc638277d53d13036b7d69b71a8c2442fad3664 Mon Sep 17 00:00:00 2001 From: Pavlo Kulyk Date: Thu, 26 Mar 2026 13:46:18 +0200 Subject: [PATCH] feat: add API for to determine our link or from a third-party source --- adminforth/types/adapters/StorageAdapter.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/adminforth/types/adapters/StorageAdapter.ts b/adminforth/types/adapters/StorageAdapter.ts index 6e8b36dba..bac18295f 100644 --- a/adminforth/types/adapters/StorageAdapter.ts +++ b/adminforth/types/adapters/StorageAdapter.ts @@ -70,6 +70,18 @@ export interface StorageAdapter { * @returns A promise that resolves to a string containing the data URL */ getKeyAsDataURL(key: string): Promise; + + /** + * Determines whether the given URL points to a resource managed by this storage adapter. + * * This method is important for plugins (such as MarkdownPlugin) to distinguish between + * "own" resources (stored in your S3 bucket or local storage) and external links * (such as images from Unsplash or Google). + * * The implementation logic typically includes: + * 1. Checking whether the hostname of the URL matches the configured bucket domain or custom CDN. + * 2. Checking whether the URL path contains the adapter's specific download prefix. + * * @param url - The full URL string to check (can be a public URL or a pre-signed URL). + * @returns A promise that returns true if the URL belongs to this adapter, false otherwise. + */ + isInternalUrl (url: string): Promise; } \ No newline at end of file