mirror of
https://github.com/mickael-kerjean/filestash.git
synced 2025-10-29 09:07:30 +08:00
feature (3d): embed 3d viewer anywhere
This contains a bunch of things packaged in 1: 1) UI improvements for the 3D viewer to support all sort of file types and create a nice rendering in a clean way with all sort of options 2) enable people to use Filestash as an SDK so we can embed the 3d viewer elsewhere
This commit is contained in:
15
public/assets/helpers/sdk.js
Normal file
15
public/assets/helpers/sdk.js
Normal file
@ -0,0 +1,15 @@
|
||||
// feature detection if we're using Filestash as a standalone app or as an SDK
|
||||
// see: ../index.js
|
||||
|
||||
export function isSDK() {
|
||||
const importURL = new URL(import.meta.url);
|
||||
return location.origin !== importURL.origin;
|
||||
}
|
||||
|
||||
export function urlSDK(url) {
|
||||
const importURL = new URL(import.meta.url);
|
||||
if (new RegExp("^/").test(url) === false) {
|
||||
url = "/" + url
|
||||
}
|
||||
return importURL.origin + url;
|
||||
}
|
||||
Reference in New Issue
Block a user