Skip to content

Commit 49e90c7

Browse files
authored
Merge pull request #525 from devforth/feature/AdminForth/1247/we-need-api-for-upload-plugin-
feat: add API for to determine our link or from a third-party source
2 parents f557bac + 4bc6382 commit 49e90c7

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

adminforth/types/adapters/StorageAdapter.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,18 @@ export interface StorageAdapter {
7070
* @returns A promise that resolves to a string containing the data URL
7171
*/
7272
getKeyAsDataURL(key: string): Promise<string>;
73+
74+
/**
75+
* Determines whether the given URL points to a resource managed by this storage adapter.
76+
* * This method is important for plugins (such as MarkdownPlugin) to distinguish between
77+
* "own" resources (stored in your S3 bucket or local storage) and external links * (such as images from Unsplash or Google).
78+
* * The implementation logic typically includes:
79+
* 1. Checking whether the hostname of the URL matches the configured bucket domain or custom CDN.
80+
* 2. Checking whether the URL path contains the adapter's specific download prefix.
81+
* * @param url - The full URL string to check (can be a public URL or a pre-signed URL).
82+
* @returns A promise that returns true if the URL belongs to this adapter, false otherwise.
83+
*/
84+
isInternalUrl (url: string): Promise<boolean>;
7385
}
7486

7587

0 commit comments

Comments
 (0)