diff --git a/src/IntroDownloader.svelte b/src/IntroDownloader.svelte
index d0dff23..fa28ab8 100644
--- a/src/IntroDownloader.svelte
+++ b/src/IntroDownloader.svelte
@@ -1,2 +1,90 @@
-
Download New Intro
-
+
+
+{#if canDownloadAny}
+
+
Download New Intro
+ {#if !!downloadPromise}
+ {#await downloadPromise}
+
downloading...
+ {:then result}
+
Downloaded
+
+ {:catch err}
+
{err}
+
+ {/await}
+ {:else}
+
+
+
+
+ {/if}
+
+{/if}
+
+
diff --git a/src/IntroSelector.svelte b/src/IntroSelector.svelte
index 9d32471..da56ff1 100644
--- a/src/IntroSelector.svelte
+++ b/src/IntroSelector.svelte
@@ -16,7 +16,6 @@
let filteredIntroList = [];
const getFiltered = () => {
- console.log("GET FILTERD");
const guildIntros = Array.from($intros.get(guild).entries()).map(([index, intro]) => {
return {
index: index,
@@ -49,7 +48,6 @@
$: if (!!($intros.get(guild)) && (!!include || !!exclude)) {
filteredIntroList = getFiltered();
- console.log(filteredIntroList);
};
const dispatch = createEventDispatcher();
diff --git a/src/app.html b/src/app.html
index a840d74..677af68 100644
--- a/src/app.html
+++ b/src/app.html
@@ -25,6 +25,7 @@
align-items: center;
background-color: #323259;
padding: 0.5em;
+ box-shadow: 1px 3px 15px 1px #1f1f36;
}
div#guild-settings {
@@ -33,6 +34,7 @@
align-items: center;
background-color: #2a2a4a;
margin: 1em;
+ box-shadow: 1px 3px 4px 1px #1f1f36;
}
div#channel-settings {
diff --git a/src/permissions.ts b/src/permissions.ts
index c1985cf..a7af141 100644
--- a/src/permissions.ts
+++ b/src/permissions.ts
@@ -1,8 +1,8 @@
-type Permission = {
- None: 1,
- CanDownload: 2,
+export const Permission = {
+ None: 0,
+ CanDownload: 1,
}
-export const member_can = (member, perm) => {
- return (member.permission & perm) > 0;
+export const member_can = (permissions, perm) => {
+ return (permissions & perm) > 0;
};
diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte
index b48f9bd..3530a05 100644
--- a/src/routes/+page.svelte
+++ b/src/routes/+page.svelte
@@ -67,7 +67,7 @@
{/await}
{#await removeIntroPromise then result}
{:catch err}
- Failed to add remove
+ Failed to remove intro
{/await}
{
- console.debug('Fetching intros');
- console.log(guilds)
+ addIntro: async (guild, url, title, token) => {
+ const response = await fetch(`http://localhost:7756/intros/${guild}/add/${encodeURIComponent(url)}?name=${encodeURIComponent(title)}`,
+ { method: 'GET', headers: { 'token': token } });
+ if (!response.ok) {
+ throw new Error(await response.body);
+ }
+ },
+ fetchIntros: async (guilds) => {
let intros = new Map();
for (const guild of guilds) {
@@ -50,13 +55,9 @@ function createIntroStore() {
}
}
- console.debug('Setting Intros store');
- console.debug(intros);
set(intros)
}
}
-
-
}
export const intros = createIntroStore()