diff --git a/public/index.html b/public/index.html
index 8e96f76..698c636 100644
--- a/public/index.html
+++ b/public/index.html
@@ -6,11 +6,9 @@
Loading...
-
-
-
+
diff --git a/rollup.config.js b/rollup.config.js
index 1569fae..a67d429 100644
--- a/rollup.config.js
+++ b/rollup.config.js
@@ -34,9 +34,9 @@ export default {
input: 'web/main.ts',
output: {
sourcemap: true,
- format: 'iife',
+ format: 'es',
name: 'app',
- file: 'public/build/bundle.js'
+ dir: "public/build"
},
plugins: [
svelte({
diff --git a/web/App.svelte b/web/App.svelte
index 2f63d03..81c760f 100644
--- a/web/App.svelte
+++ b/web/App.svelte
@@ -1,27 +1,46 @@
- { slug }
+ {slug}
- {#if data === null}
- Loading data...
- {:else}
- {data}
- {/if}
+ {#if component === null}
+ Loading data...
+ {:else}
+ {#await component}
+ Loading data...
+ {:then v }
+
+ {/await}
+ {/if}
\ No newline at end of file
+
diff --git a/web/contentType.ts b/web/contentType.ts
new file mode 100644
index 0000000..3be0cb1
--- /dev/null
+++ b/web/contentType.ts
@@ -0,0 +1,68 @@
+
+export default function getComponentForShare(contentType: string, filename: string) {
+ if (contentType.startsWith("image/")) {
+ return import("./opener/Default.svelte");
+ }
+
+ if (contentType.startsWith("video/")) {
+ return import("./opener/Default.svelte");
+ }
+
+ if (contentType.startsWith("audio/")) {
+ return import("./opener/Default.svelte");
+ }
+
+ if (contentType.startsWith("application/pdf")) {
+ return import("./opener/Default.svelte");
+ }
+
+ if (contentType.startsWith("text/")) {
+ return import("./opener/Text.svelte");
+ }
+
+ switch (contentType) {
+ case "application/json":
+ case "application/ld+json":
+ case "application/xhtml+xml":
+ case "application/xml":
+ return import("./opener/Default.svelte");
+ case "application/ogg":
+ return import("./opener/Default.svelte");
+ }
+
+ const extension = filename.split(".").pop();
+ if (extension === undefined) {
+ return import("./opener/Default.svelte");
+ }
+
+ switch (extension) {
+ case "png":
+ case "jpg":
+ case "jpeg":
+ case "gif":
+ return import("./opener/Default.svelte");
+ case "mp4":
+ case "mov":
+ case "avi":
+ case "mkv":
+ case "wmv":
+ case "flv":
+ case "mpg":
+ case "mpeg":
+ return import("./opener/Default.svelte");
+ case "mp3":
+ case "wav":
+ case "ogg":
+ case "flac":
+ return import("./opener/Default.svelte");
+ case "pdf":
+ return import("./opener/Default.svelte");
+ case "txt":
+ case "md":
+ case "markdown":
+ return import("./opener/Default.svelte");
+ }
+
+ return import("./opener/Text.svelte");
+
+}
diff --git a/web/opener/Default.svelte b/web/opener/Default.svelte
new file mode 100644
index 0000000..4cda31e
--- /dev/null
+++ b/web/opener/Default.svelte
@@ -0,0 +1,10 @@
+
+
+
+ Default opener
+
diff --git a/web/opener/Text.svelte b/web/opener/Text.svelte
new file mode 100644
index 0000000..be26505
--- /dev/null
+++ b/web/opener/Text.svelte
@@ -0,0 +1,11 @@
+
+
+
+ Text opener
+