From 47f10d07491072a3b1f032dc10d9571a3c967588 Mon Sep 17 00:00:00 2001 From: Arman Date: Thu, 24 Nov 2022 14:17:08 +0100 Subject: [PATCH 01/34] fix: account deletion --- src/routes/console/account/delete.svelte | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/routes/console/account/delete.svelte b/src/routes/console/account/delete.svelte index a64b1321f..bf1a7d2a3 100644 --- a/src/routes/console/account/delete.svelte +++ b/src/routes/console/account/delete.svelte @@ -1,17 +1,19 @@ {#if $collection} - - {$collection.name} - - -
    - -
-
-

Created: {toLocaleDateTime($collection.$createdAt)}

-

Last Updated: {toLocaleDateTime($collection.$updatedAt)}

-
-
- - - - -
- - - Update Name - - -
    - - {#if showError === 'name'} - {errorMessage} - {/if} -
-
- - - - -
- - - Update Permissions -

- Choose who can access your collection and documents. For more information, check out - the Permissions Guide in our documentation. -

- - {#if collectionPermissions} - - {/if} - - - - -
- - - Update Document Security - - - - -

- When document security is enabled, users will be able to access documents for - which they have been granted either Document or Collection permissions. -

-

- If document security is disabled, users can access documents only if they have Collection permissions. Document permissions will be ignored. -

-
- - - -
- - - Delete Collection -

- The collection will be permanently deleted, including all the documents within it. - This action is irreversible. -

- - - -
{$collection.name}
-
-

Last Updated: {toLocaleDateTime($collection.$updatedAt)}

-
-
- - - - -
+ + + + + {/if}
- - diff --git a/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/settings/dangerZone.svelte b/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/settings/dangerZone.svelte new file mode 100644 index 000000000..53653a2d4 --- /dev/null +++ b/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/settings/dangerZone.svelte @@ -0,0 +1,31 @@ + + + + Delete Collection +

+ The collection will be permanently deleted, including all the documents within it. This + action is irreversible. +

+ + + +
{$collection.name}
+
+

Last Updated: {toLocaleDateTime($collection.$updatedAt)}

+
+
+ + + + +
+ + diff --git a/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/settings/updateName.svelte b/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/settings/updateName.svelte new file mode 100644 index 000000000..e98422453 --- /dev/null +++ b/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/settings/updateName.svelte @@ -0,0 +1,66 @@ + + +
+ + Update Name + + +
    + +
+
+ + + + +
+
diff --git a/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/settings/updatePermissions.svelte b/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/settings/updatePermissions.svelte new file mode 100644 index 000000000..9548472e3 --- /dev/null +++ b/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/settings/updatePermissions.svelte @@ -0,0 +1,74 @@ + + + + Update Permissions +

+ Choose who can access your collection and documents. For more information, check out the Permissions Guide in our documentation. +

+ + {#if collectionPermissions} + + {/if} + + + + +
diff --git a/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/settings/updateSecurity.svelte b/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/settings/updateSecurity.svelte new file mode 100644 index 000000000..87d601be6 --- /dev/null +++ b/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/settings/updateSecurity.svelte @@ -0,0 +1,70 @@ + + + + Update Document Security + + + + +

+ When document security is enabled, users will be able to access documents for which they + have been granted either Document or Collection permissions. +

+

+ If document security is disabled, users can access documents only if they have Collection permissions. Document permissions will be ignored. +

+
+ + + +
diff --git a/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/settings/updateStatus.svelte b/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/settings/updateStatus.svelte new file mode 100644 index 000000000..6c1353320 --- /dev/null +++ b/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/settings/updateStatus.svelte @@ -0,0 +1,68 @@ + + + + {$collection.name} + + +
    + +
+
+

Created: {toLocaleDateTime($collection.$createdAt)}

+

Last Updated: {toLocaleDateTime($collection.$updatedAt)}

+
+
+ + + + +
From 7f315c19d7007385079d4935f95d229cc8b6343b Mon Sep 17 00:00:00 2001 From: Arman Date: Fri, 25 Nov 2022 16:27:34 +0100 Subject: [PATCH 11/34] fix: add missing class --- .../collection-[collection]/settings/updatePermissions.svelte | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/settings/updatePermissions.svelte b/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/settings/updatePermissions.svelte index 9548472e3..6589c22c0 100644 --- a/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/settings/updatePermissions.svelte +++ b/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/settings/updatePermissions.svelte @@ -61,7 +61,8 @@ Choose who can access your collection and documents. For more information, check out the Permissions Guide in our documentation. + rel="noopener noreferrer" + class="link">Permissions Guide in our documentation.

{#if collectionPermissions} From 3c0ff70ea13a2abc939e6deb0fc44e49d03c9b3e Mon Sep 17 00:00:00 2001 From: Arman Date: Mon, 5 Dec 2022 16:06:14 +0100 Subject: [PATCH 12/34] feat: unbundle webhooks page --- .../settings/webhooks/[webhook]/+page.svelte | 359 +----------------- .../webhooks/[webhook]/dangerZone.svelte | 30 ++ .../webhooks/[webhook]/updateEvents.svelte | 109 ++++++ .../webhooks/[webhook]/updateName.svelte | 66 ++++ .../webhooks/[webhook]/updateSecurity.svelte | 110 ++++++ .../webhooks/[webhook]/updateSignature.svelte | 30 ++ .../webhooks/[webhook]/updateURL.svelte | 66 ++++ 7 files changed, 423 insertions(+), 347 deletions(-) create mode 100644 src/routes/console/project-[project]/settings/webhooks/[webhook]/dangerZone.svelte create mode 100644 src/routes/console/project-[project]/settings/webhooks/[webhook]/updateEvents.svelte create mode 100644 src/routes/console/project-[project]/settings/webhooks/[webhook]/updateName.svelte create mode 100644 src/routes/console/project-[project]/settings/webhooks/[webhook]/updateSecurity.svelte create mode 100644 src/routes/console/project-[project]/settings/webhooks/[webhook]/updateSignature.svelte create mode 100644 src/routes/console/project-[project]/settings/webhooks/[webhook]/updateURL.svelte diff --git a/src/routes/console/project-[project]/settings/webhooks/[webhook]/+page.svelte b/src/routes/console/project-[project]/settings/webhooks/[webhook]/+page.svelte index 9b7195420..ab3bd3c63 100644 --- a/src/routes/console/project-[project]/settings/webhooks/[webhook]/+page.svelte +++ b/src/routes/console/project-[project]/settings/webhooks/[webhook]/+page.svelte @@ -1,353 +1,18 @@ - - Signature Key -

- Add the Signature Key to the X-Appwrite-Webhook-Signature header to validate your - webhooks. Learn more about webhook validation. -

- -
-

Key

- -
-
- - - -
-
- - Update Name -

Choose any name that will help you distinguish between Webhooks.

- - - - - - - - - -
-
- -
- - Update Url - - - - - - - - - - - -
- -
- - Update Events -

- Set the events that will trigger your webhook. Maximum 100 events allowed. -

- - {#if $eventSet.size} - - {#each Array.from($eventSet) as event} -
  • - - {event} - - - - -
  • - {/each} -
    -
    - -
    - {:else} - (showCreateEvent = true)}> - Add an event to get started - - {/if} -
    - - - - -
    -
    - -
    - - Security -

    - Set an optional basic HTTP authentication username and password to protect your - endpoint from unauthorized access. -

    - - -
    - HTTP Authentication -

    Use to secure your endpoint from untrusted sources.

    -
    - - - - - Warning: Untrusted or self-signed certificates - may not be secure. - - Learn more - -
    -
    - - - - -
    -
    - - -
    - Delete Webhook -
    -

    The webhook will be permanently deleted. This action is irreversible.

    - - - -
    {$webhook.name}
    -
    -

    Last updated: {toLocaleDateTime($webhook.$updatedAt)}

    -
    -
    - - - - -
    + + + + + +
    - - - - - diff --git a/src/routes/console/project-[project]/settings/webhooks/[webhook]/dangerZone.svelte b/src/routes/console/project-[project]/settings/webhooks/[webhook]/dangerZone.svelte new file mode 100644 index 000000000..c531b91a4 --- /dev/null +++ b/src/routes/console/project-[project]/settings/webhooks/[webhook]/dangerZone.svelte @@ -0,0 +1,30 @@ + + + +
    + Delete Webhook +
    +

    The webhook will be permanently deleted. This action is irreversible.

    + + + +
    {$webhook.name}
    +
    +

    Last updated: {toLocaleDateTime($webhook.$updatedAt)}

    +
    +
    + + + + +
    + + diff --git a/src/routes/console/project-[project]/settings/webhooks/[webhook]/updateEvents.svelte b/src/routes/console/project-[project]/settings/webhooks/[webhook]/updateEvents.svelte new file mode 100644 index 000000000..919d21402 --- /dev/null +++ b/src/routes/console/project-[project]/settings/webhooks/[webhook]/updateEvents.svelte @@ -0,0 +1,109 @@ + + +
    + + Update Events +

    + Set the events that will trigger your webhook. Maximum 100 events allowed. +

    + + {#if $eventSet.size} + + {#each Array.from($eventSet) as event} +
  • + + {event} + + + + +
  • + {/each} +
    +
    + +
    + {:else} + (showCreateEvent = true)}>Add an event to get started + {/if} +
    + + + + +
    +
    + + diff --git a/src/routes/console/project-[project]/settings/webhooks/[webhook]/updateName.svelte b/src/routes/console/project-[project]/settings/webhooks/[webhook]/updateName.svelte new file mode 100644 index 000000000..1d4fcd0cf --- /dev/null +++ b/src/routes/console/project-[project]/settings/webhooks/[webhook]/updateName.svelte @@ -0,0 +1,66 @@ + + +
    + + Update Name +

    Choose any name that will help you distinguish between Webhooks.

    + + + + + + + + + +
    +
    diff --git a/src/routes/console/project-[project]/settings/webhooks/[webhook]/updateSecurity.svelte b/src/routes/console/project-[project]/settings/webhooks/[webhook]/updateSecurity.svelte new file mode 100644 index 000000000..dc1d1d8ce --- /dev/null +++ b/src/routes/console/project-[project]/settings/webhooks/[webhook]/updateSecurity.svelte @@ -0,0 +1,110 @@ + + +
    + + Security +

    + Set an optional basic HTTP authentication username and password to protect your endpoint + from unauthorized access. +

    + + +
    + HTTP Authentication +

    Use to secure your endpoint from untrusted sources.

    +
    + + + + + Warning: Untrusted or self-signed certificates may + not be secure. + + Learn more + +
    +
    + + + + +
    +
    diff --git a/src/routes/console/project-[project]/settings/webhooks/[webhook]/updateSignature.svelte b/src/routes/console/project-[project]/settings/webhooks/[webhook]/updateSignature.svelte new file mode 100644 index 000000000..7f65c7677 --- /dev/null +++ b/src/routes/console/project-[project]/settings/webhooks/[webhook]/updateSignature.svelte @@ -0,0 +1,30 @@ + + + + Signature Key +

    + Add the Signature Key to the X-Appwrite-Webhook-Signature header to validate your webhooks. Learn more about webhook validation. +

    + +
    +

    Key

    + +
    +
    + + + +
    + + diff --git a/src/routes/console/project-[project]/settings/webhooks/[webhook]/updateURL.svelte b/src/routes/console/project-[project]/settings/webhooks/[webhook]/updateURL.svelte new file mode 100644 index 000000000..ff775045d --- /dev/null +++ b/src/routes/console/project-[project]/settings/webhooks/[webhook]/updateURL.svelte @@ -0,0 +1,66 @@ + + +
    + + Update Url + + + + + + + + + + + +
    From ca4344698ca7ce54dc9814451a1e9e01dcca3103 Mon Sep 17 00:00:00 2001 From: Arman Date: Mon, 5 Dec 2022 16:39:48 +0100 Subject: [PATCH 13/34] feat: growth is now an enviroment variable --- .env.example | 1 + src/lib/actions/analytics.ts | 4 ++-- src/lib/constants.ts | 2 ++ src/lib/stores/app.ts | 3 ++- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.env.example b/.env.example index 06149b167..e9457b89f 100644 --- a/.env.example +++ b/.env.example @@ -1,4 +1,5 @@ VITE_APPWRITE_ENDPOINT= +VITE_APPWRITE_GROWTH_ENDPOINT= VITE_GA_PROJECT= VITE_SENTRY_DSN= VITE_CONSOLE_MODE=self-hosted \ No newline at end of file diff --git a/src/lib/actions/analytics.ts b/src/lib/actions/analytics.ts index d169790ac..a57000024 100644 --- a/src/lib/actions/analytics.ts +++ b/src/lib/actions/analytics.ts @@ -3,7 +3,7 @@ import googleAnalytics from '@analytics/google-analytics'; import { get } from 'svelte/store'; import { page } from '$app/stores'; import { user } from '$lib/stores/user'; -import { Mode } from '$lib/constants'; +import { growthEndpoint, Mode } from '$lib/constants'; const analytics = Analytics({ app: 'appwrite', @@ -40,7 +40,7 @@ function sendEventToGrowth(event: string, path: string, data: object = null): vo email = userStore.email; name = userStore.name; } - fetch('https://growth.appwrite.io/v1/analytics', { + fetch(`${growthEndpoint}/analytics`, { method: 'POST', headers: { 'Content-Type': 'application/json' diff --git a/src/lib/constants.ts b/src/lib/constants.ts index 721c3db12..b2835c96d 100644 --- a/src/lib/constants.ts +++ b/src/lib/constants.ts @@ -7,6 +7,8 @@ export enum Mode { SELF_HOSTED = 'mode:self-hosted' } +export const growthEndpoint = import.meta.env.VITE_APPWRITE_GROWTH_ENDPOINT; + export enum Dependencies { ORGANIZATION = 'dependency:organization', PROJECT = 'dependency:project', diff --git a/src/lib/stores/app.ts b/src/lib/stores/app.ts index 555d36415..f3b03e36b 100644 --- a/src/lib/stores/app.ts +++ b/src/lib/stores/app.ts @@ -1,4 +1,5 @@ import { browser } from '$app/environment'; +import { growthEndpoint } from '$lib/constants'; import { writable } from 'svelte/store'; export type AppStore = { @@ -59,7 +60,7 @@ function createFeedbackStore() { email?: string, value?: number ) => { - const response = await fetch('https://growth.appwrite.io/v1/feedback', { + const response = await fetch(`${growthEndpoint}/feedback`, { method: 'POST', headers: { 'Content-Type': 'application/json' From c2b139f8173f12169440666c9ec337356e6a3438 Mon Sep 17 00:00:00 2001 From: tglide <26071571+TGlide@users.noreply.github.com> Date: Mon, 5 Dec 2022 17:19:44 +0000 Subject: [PATCH 14/34] fix: enums no longer creatable without elements --- src/lib/elements/forms/inputTags.svelte | 15 +++++++++++---- .../attributes/enum.svelte | 4 +++- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/lib/elements/forms/inputTags.svelte b/src/lib/elements/forms/inputTags.svelte index 93d31f8ac..82528258e 100644 --- a/src/lib/elements/forms/inputTags.svelte +++ b/src/lib/elements/forms/inputTags.svelte @@ -10,9 +10,11 @@ export let autofocus = false; export let disabled = false; export let readonly = false; + export let required = false; let value = ''; let element: HTMLInputElement; + let hiddenEl: HTMLInputElement; let error: string; onMount(() => { @@ -54,11 +56,11 @@ const handleInvalid = (event: Event) => { event.preventDefault(); - if (element.validity.valueMissing) { + if (hiddenEl.validity.valueMissing) { error = 'This field is required'; return; } - error = element.validationMessage; + error = hiddenEl.validationMessage; }; $: if (value) { @@ -67,6 +69,12 @@ +
    @@ -98,8 +106,7 @@ bind:value bind:this={element} on:keydown={handleInput} - on:blur={addValue} - on:invalid={handleInvalid} /> + on:blur={addValue} />
    {#if error} diff --git a/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/enum.svelte b/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/enum.svelte index 52a45d972..e61b3c030 100644 --- a/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/enum.svelte +++ b/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/enum.svelte @@ -40,6 +40,7 @@ default: data.default } = selectedAttribute); } + $: if (data.required || data.array) { data.default = null; } @@ -50,7 +51,8 @@ label="Elements" bind:tags={data.elements} placeholder="Add elements here" - readonly={!!selectedAttribute} /> + readonly={!!selectedAttribute} + required /> Date: Mon, 5 Dec 2022 17:41:39 +0000 Subject: [PATCH 15/34] fix: copy not working on http --- src/lib/components/copy.svelte | 51 +++++++++++++++++++++++++++------- 1 file changed, 41 insertions(+), 10 deletions(-) diff --git a/src/lib/components/copy.svelte b/src/lib/components/copy.svelte index 1f0e5dfd8..e9272af34 100644 --- a/src/lib/components/copy.svelte +++ b/src/lib/components/copy.svelte @@ -9,23 +9,54 @@ let content = 'Click to copy'; - const copy = async () => { + async function securedCopy() { try { await navigator.clipboard.writeText(value); + } catch { + return false; + } + + return true; + } + + function unsecuredCopy() { + const textArea = document.createElement('textarea'); + textArea.value = value; + document.body.appendChild(textArea); + textArea.focus(); + textArea.select(); + + let success = true; + try { + document.execCommand('copy'); + } catch { + success = false; + } finally { + document.body.removeChild(textArea); + } + + return success; + } + + async function copy() { + // Because of how JS works, unsecuredCopy only runs if securedCopy fails + const success = (await securedCopy()) || unsecuredCopy(); + + if (success) { content = 'Copied'; - } catch (error) { + } else { addNotification({ - message: error.message, + message: 'Unable to copy to clipboard', type: 'error' }); - } finally { - if (event) { - trackEvent('click_id_tag', { - name: event - }); - } } - }; + + if (event) { + trackEvent('click_id_tag', { + name: event + }); + } + } Date: Tue, 6 Dec 2022 13:27:28 +0100 Subject: [PATCH 16/34] feat: add compression algorithm setting --- .../bucket-[bucket]/settings/+page.svelte | 66 +++++++++++++++---- 1 file changed, 54 insertions(+), 12 deletions(-) diff --git a/src/routes/console/project-[project]/storage/bucket-[bucket]/settings/+page.svelte b/src/routes/console/project-[project]/storage/bucket-[bucket]/settings/+page.svelte index b7fd139e5..5d1aa0c48 100644 --- a/src/routes/console/project-[project]/storage/bucket-[bucket]/settings/+page.svelte +++ b/src/routes/console/project-[project]/storage/bucket-[bucket]/settings/+page.svelte @@ -36,8 +36,9 @@ arePermsDisabled = true, encryption: boolean = null, antivirus: boolean = null, - maxSize: number; - let byteUnit = writable('KB'); + maxSize: number, + compression: string = null; + let byteUnit = writable('MB'); let sizeInBytes: number = null; const options = [ { label: 'Bytes', value: 'Bytes' }, @@ -45,6 +46,11 @@ { label: 'Megabytes', value: 'MB' }, { label: 'Gigabytes', value: 'GB' } ]; + const compressionOptions = [ + { label: 'None', value: 'none' }, + { label: 'Gzip', value: 'gzip' }, + { label: 'Zstd', value: 'zstd' } + ]; let suggestedExtensions = ['jpg', 'png', 'svg', 'gif', 'html', 'pdf', 'mp4']; let extensions = $bucket.allowedFileExtensions; let isExtensionsDisabled = true; @@ -57,8 +63,10 @@ bucketPermissions ??= $bucket.$permissions; encryption ??= $bucket.encryption; antivirus ??= $bucket.antivirus; - maxSize = $bucket.maximumFileSize / 1024; + maxSize = $bucket.maximumFileSize / 1024 / 1024; + compression ??= $bucket.compression; }); + $: if (bucketPermissions) { if (symmetricDifference(bucketPermissions, $bucket.$permissions).length) { arePermsDisabled = false; @@ -192,6 +200,17 @@ ); } + function updateCompression() { + updateBucket( + { + compression + }, + { + trackEventName: 'submit_bucket_update_size' + } + ); + } + function updateAllowedExtensions() { updateBucket( { @@ -234,8 +253,8 @@ id="toggle" bind:value={enabled} /> -

    Created: {toLocaleDateTime($bucket.$createdAt)}

    -

    Last Updated: {toLocaleDateTime($bucket.$updatedAt)}

    +

    Created: {toLocaleDateTime($bucket.$createdAt)}

    +

    Last Updated: {toLocaleDateTime($bucket.$updatedAt)}

    @@ -320,7 +339,7 @@
    Update Security Settings -

    +

    Enable or disable security services for the bucket including Ecryption and Antivirus scanning.

    @@ -381,17 +400,40 @@
    +
    + + Update Compression Algorithm +

    + Choose an algorithm for compression. For files larger than 20MB, compression + will be skipped even if it's enabled. +

    + + + + + + + + + +
    +
    +
    Update Maximum File Size -

    Set the maximum file size allowed in the bucket.

    +

    Set the maximum file size allowed in the bucket.

      Update Allowed File Extensions -

      +

      A maximum of 100 file extensions can be added. Leave blank to allow all file types.

      @@ -453,7 +495,7 @@ Delete Bucket -

      +

      The bucket will be permanently deleted, including all the files within it. This action is irreversible.

      @@ -462,7 +504,7 @@
      {$bucket.name}
      -

      Last Updated: {toLocaleDateTime($bucket.$updatedAt)}

      +

      Last Updated: {toLocaleDateTime($bucket.$updatedAt)}

      From 2970863a9570e0657b8e009bff2f57e877e29494 Mon Sep 17 00:00:00 2001 From: tglide <26071571+TGlide@users.noreply.github.com> Date: Tue, 6 Dec 2022 16:44:28 +0000 Subject: [PATCH 17/34] refactor: update copy comment --- src/lib/components/copy.svelte | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lib/components/copy.svelte b/src/lib/components/copy.svelte index e9272af34..2bfa61ddd 100644 --- a/src/lib/components/copy.svelte +++ b/src/lib/components/copy.svelte @@ -39,7 +39,8 @@ } async function copy() { - // Because of how JS works, unsecuredCopy only runs if securedCopy fails + // securedCopy works only in HTTPS environment. + // unsecuredCopy works in HTTP and only runs if securedCopy fails. const success = (await securedCopy()) || unsecuredCopy(); if (success) { From 15372038c2ad241a3022f1ff2c182c15151c8adb Mon Sep 17 00:00:00 2001 From: tglide <26071571+TGlide@users.noreply.github.com> Date: Tue, 6 Dec 2022 17:02:46 +0000 Subject: [PATCH 18/34] fix: incorrect origin for non-web platforms --- .../platforms/wizard/apple/step1.svelte | 6 ++-- .../platforms/wizard/flutter/step1.svelte | 35 ++++++++++++------- 2 files changed, 25 insertions(+), 16 deletions(-) diff --git a/src/routes/console/project-[project]/overview/platforms/wizard/apple/step1.svelte b/src/routes/console/project-[project]/overview/platforms/wizard/apple/step1.svelte index 08052981f..49cdcd687 100644 --- a/src/routes/console/project-[project]/overview/platforms/wizard/apple/step1.svelte +++ b/src/routes/console/project-[project]/overview/platforms/wizard/apple/step1.svelte @@ -41,9 +41,9 @@ projectId, platform, $createPlatform.name, + $createPlatform.key, undefined, - undefined, - $createPlatform.hostname + undefined ); $createPlatform.$id = response.$id; @@ -95,6 +95,6 @@ placeholder="com.company.appname" tooltip="You can find your Bundle Identifier in the General tab for your app's primary target in Xcode." required - bind:value={$createPlatform.hostname} /> + bind:value={$createPlatform.key} /> diff --git a/src/routes/console/project-[project]/overview/platforms/wizard/flutter/step1.svelte b/src/routes/console/project-[project]/overview/platforms/wizard/flutter/step1.svelte index df6f60ad0..a638b0d60 100644 --- a/src/routes/console/project-[project]/overview/platforms/wizard/flutter/step1.svelte +++ b/src/routes/console/project-[project]/overview/platforms/wizard/flutter/step1.svelte @@ -97,9 +97,9 @@ projectId, platform, $createPlatform.name, + platform !== Platform.Web ? $createPlatform.key : undefined, undefined, - undefined, - $createPlatform.hostname + platform === Platform.Web ? $createPlatform.hostname : undefined ); $createPlatform.$id = response.$id; @@ -160,15 +160,16 @@ placeholder={placeholder[platform].name} required bind:value={$createPlatform.name} /> -
      - - {#if platform === Platform.Web} + {#if platform === Platform.Web} +
      + +
      {#each suggestions as suggestion} {/each}
      - {/if} -
      +
      + {:else} + + {/if} From 19af6d3d6a93be297cf3ed514acf04e14e74f885 Mon Sep 17 00:00:00 2001 From: tglide <26071571+TGlide@users.noreply.github.com> Date: Tue, 6 Dec 2022 18:02:09 +0000 Subject: [PATCH 19/34] fix: falsy default values not registering on create attribute --- .../collection-[collection]/attributes/+page.svelte | 2 +- .../collection-[collection]/attributes/float.svelte | 2 +- .../collection-[collection]/attributes/integer.svelte | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/+page.svelte b/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/+page.svelte index 1b7c7501e..391bc4e9e 100644 --- a/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/+page.svelte +++ b/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/+page.svelte @@ -65,7 +65,7 @@ {attribute.type} - {attribute.default ? attribute.default : '-'} + {attribute.default !== null ? attribute.default : '-'} Date: Wed, 7 Dec 2022 10:22:52 +0000 Subject: [PATCH 20/34] Fix Gitpod hostname suggestion --- .../overview/platforms/wizard/flutter/step1.svelte | 2 +- .../overview/platforms/wizard/web/step1.svelte | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/routes/console/project-[project]/overview/platforms/wizard/flutter/step1.svelte b/src/routes/console/project-[project]/overview/platforms/wizard/flutter/step1.svelte index df6f60ad0..530a4cd0a 100644 --- a/src/routes/console/project-[project]/overview/platforms/wizard/flutter/step1.svelte +++ b/src/routes/console/project-[project]/overview/platforms/wizard/flutter/step1.svelte @@ -25,7 +25,7 @@ let platform: Platform = Platform.Android; const projectId = $page.params.project; - const suggestions = ['*.vercel.app', '*.netlify.app', '*.gitpod.app']; + const suggestions = ['*.vercel.app', '*.netlify.app', '*.gitpod.io']; const placeholder: Record< Platform, { diff --git a/src/routes/console/project-[project]/overview/platforms/wizard/web/step1.svelte b/src/routes/console/project-[project]/overview/platforms/wizard/web/step1.svelte index aa1ff28ea..5a3e555da 100644 --- a/src/routes/console/project-[project]/overview/platforms/wizard/web/step1.svelte +++ b/src/routes/console/project-[project]/overview/platforms/wizard/web/step1.svelte @@ -12,7 +12,7 @@ import Dark from './dark.svg'; const projectId = $page.params.project; - const suggestions = ['*.vercel.app', '*.netlify.app', '*.gitpod.app']; + const suggestions = ['*.vercel.app', '*.netlify.app', '*.gitpod.io']; $wizard.media = $app.themeInUse === 'dark' ? Dark : Light; async function beforeSubmit() { From c95eea440d709c436b3c5bde85785224f54e8730 Mon Sep 17 00:00:00 2001 From: tglide <26071571+TGlide@users.noreply.github.com> Date: Wed, 7 Dec 2022 13:16:28 +0000 Subject: [PATCH 21/34] fix: missing brackets on array attributes --- src/lib/elements/table/cellText.svelte | 2 +- .../collection-[collection]/attributes/+page.svelte | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/lib/elements/table/cellText.svelte b/src/lib/elements/table/cellText.svelte index 59b8fe2e3..94f36b389 100644 --- a/src/lib/elements/table/cellText.svelte +++ b/src/lib/elements/table/cellText.svelte @@ -4,6 +4,6 @@ export let showOverflow = false; -
      +
      diff --git a/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/+page.svelte b/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/+page.svelte index 1b7c7501e..b5ca8beac 100644 --- a/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/+page.svelte +++ b/src/routes/console/project-[project]/databases/database-[database]/collection-[collection]/attributes/+page.svelte @@ -63,7 +63,9 @@ {/if}
      - {attribute.type} + + {`${attribute.type}${attribute.array ? '[]' : ''}`} + {attribute.default ? attribute.default : '-'} From b7b6fd7ebe4d47ee8f72a6403cda519a2fe788ec Mon Sep 17 00:00:00 2001 From: Arman Date: Wed, 7 Dec 2022 14:52:37 +0100 Subject: [PATCH 22/34] fix: accept invite while logged in --- src/lib/layout/unauthenticated.svelte | 3 ++- src/routes/+layout.svelte | 7 ++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/lib/layout/unauthenticated.svelte b/src/lib/layout/unauthenticated.svelte index 62d9e923b..1028e4f0a 100644 --- a/src/lib/layout/unauthenticated.svelte +++ b/src/lib/layout/unauthenticated.svelte @@ -4,6 +4,7 @@ import LoginDark from '$lib/images/login/login-dark-mode.svg'; import { app } from '$lib/stores/app'; import { base } from '$app/paths'; + import { user } from '$lib/stores/user'; const technologies = [ 'js', @@ -25,7 +26,7 @@ diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index 43965143d..bdaa9a1ad 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -49,11 +49,16 @@ if (!$page.url.pathname.startsWith('/auth')) { const acceptedRoutes = ['/login', '/register', '/recover', '/invite']; if ($user) { - if (!$page.url.pathname.startsWith('/console')) { + if ( + !$page.url.pathname.startsWith('/console') && + !$page.url.pathname.startsWith('/invite') + ) { + console.log('test'); await goto(`${base}/console`, { replaceState: true }); } + loading.set(false); } else { if (acceptedRoutes.includes($page.url.pathname)) { await goto(`${base}${$page.url.pathname}${$page.url.search}`); From 31e0a6b317ef16d4870c727eb4cceedce700adbc Mon Sep 17 00:00:00 2001 From: tglide <26071571+TGlide@users.noreply.github.com> Date: Wed, 7 Dec 2022 17:52:32 +0000 Subject: [PATCH 23/34] fix: fixes copy on permission role popover --- src/lib/components/permissions/row.svelte | 92 ++++++++++++----------- 1 file changed, 47 insertions(+), 45 deletions(-) diff --git a/src/lib/components/permissions/row.svelte b/src/lib/components/permissions/row.svelte index 66dbbca67..e69f66616 100644 --- a/src/lib/components/permissions/row.svelte +++ b/src/lib/components/permissions/row.svelte @@ -53,59 +53,61 @@ }) .finally(() => { tick().then(() => { - instance.setContent(content.innerHTML); + instance.setContent(content); }); }); } }}> {role} -
      - {#if data} - {@const isUser = role.startsWith('user')} - {@const isTeam = role.startsWith('team')} - {@const isAnonymous = !data.email && !data.phone} - {/if}
      From e5f5e370fe4710b8f03a5d781f8db5efbc01208f Mon Sep 17 00:00:00 2001 From: tglide <26071571+TGlide@users.noreply.github.com> Date: Wed, 7 Dec 2022 18:07:54 +0000 Subject: [PATCH 24/34] fix: change android package name field to use key instead of hostname --- .../overview/platforms/[platform]/android.svelte | 14 +++++++------- .../overview/platforms/wizard/android/step1.svelte | 8 ++++---- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/routes/console/project-[project]/overview/platforms/[platform]/android.svelte b/src/routes/console/project-[project]/overview/platforms/[platform]/android.svelte index ebcd4ce21..b3d93c638 100644 --- a/src/routes/console/project-[project]/overview/platforms/[platform]/android.svelte +++ b/src/routes/console/project-[project]/overview/platforms/[platform]/android.svelte @@ -10,10 +10,10 @@ import { project } from '../../../store'; import { platform } from './store'; - let hostname: string = null; + let packageName: string = null; onMount(() => { - hostname ??= $platform.hostname; + packageName ??= $platform.key; }); const updateHostname = async () => { @@ -22,9 +22,9 @@ $project.$id, $platform.$id, $platform.name, - $platform.key, + packageName, $platform.store, - hostname + $platform.hostname ); invalidate(Dependencies.PLATFORM); trackEvent('submit_platform_update', { @@ -52,16 +52,16 @@ - +
      diff --git a/src/routes/console/project-[project]/overview/platforms/wizard/android/step1.svelte b/src/routes/console/project-[project]/overview/platforms/wizard/android/step1.svelte index 2ff8ac01c..7971b24e6 100644 --- a/src/routes/console/project-[project]/overview/platforms/wizard/android/step1.svelte +++ b/src/routes/console/project-[project]/overview/platforms/wizard/android/step1.svelte @@ -31,9 +31,9 @@ projectId, 'android', $createPlatform.name, + $createPlatform.key, undefined, - undefined, - $createPlatform.hostname + undefined ); $createPlatform.$id = platform.$id; @@ -50,11 +50,11 @@ required bind:value={$createPlatform.name} /> + bind:value={$createPlatform.key} /> From a14a60fe50addb14c69a35e4b6489826044826df Mon Sep 17 00:00:00 2001 From: tglide <26071571+TGlide@users.noreply.github.com> Date: Wed, 7 Dec 2022 18:09:42 +0000 Subject: [PATCH 25/34] refactor: rename android overview fields --- .../overview/platforms/[platform]/android.svelte | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/routes/console/project-[project]/overview/platforms/[platform]/android.svelte b/src/routes/console/project-[project]/overview/platforms/[platform]/android.svelte index b3d93c638..fa23169a1 100644 --- a/src/routes/console/project-[project]/overview/platforms/[platform]/android.svelte +++ b/src/routes/console/project-[project]/overview/platforms/[platform]/android.svelte @@ -10,10 +10,10 @@ import { project } from '../../../store'; import { platform } from './store'; - let packageName: string = null; + let key: string = null; onMount(() => { - packageName ??= $platform.key; + key ??= $platform.key; }); const updateHostname = async () => { @@ -22,7 +22,7 @@ $project.$id, $platform.$id, $platform.name, - packageName, + key, $platform.store, $platform.hostname ); @@ -52,16 +52,16 @@ - +
      From 9b7895c11de4772b8ccd1847198482ce4e4e020d Mon Sep 17 00:00:00 2001 From: tglide <26071571+TGlide@users.noreply.github.com> Date: Fri, 9 Dec 2022 11:44:38 +0000 Subject: [PATCH 26/34] refactor: add copy helper & fix copyInput --- src/lib/components/copy.svelte | 38 +++-------------------------- src/lib/components/copyInput.svelte | 14 ++++++----- src/lib/helpers/copy.ts | 36 +++++++++++++++++++++++++++ 3 files changed, 48 insertions(+), 40 deletions(-) create mode 100644 src/lib/helpers/copy.ts diff --git a/src/lib/components/copy.svelte b/src/lib/components/copy.svelte index 2bfa61ddd..0e859e79c 100644 --- a/src/lib/components/copy.svelte +++ b/src/lib/components/copy.svelte @@ -2,6 +2,7 @@ import { trackEvent } from '$lib/actions/analytics'; import { tooltip } from '$lib/actions/tooltip'; import { clickOnEnter } from '$lib/helpers/a11y'; + import { copy } from '$lib/helpers/copy'; import { addNotification } from '$lib/stores/notifications'; export let value: string; @@ -9,39 +10,8 @@ let content = 'Click to copy'; - async function securedCopy() { - try { - await navigator.clipboard.writeText(value); - } catch { - return false; - } - - return true; - } - - function unsecuredCopy() { - const textArea = document.createElement('textarea'); - textArea.value = value; - document.body.appendChild(textArea); - textArea.focus(); - textArea.select(); - - let success = true; - try { - document.execCommand('copy'); - } catch { - success = false; - } finally { - document.body.removeChild(textArea); - } - - return success; - } - - async function copy() { - // securedCopy works only in HTTPS environment. - // unsecuredCopy works in HTTP and only runs if securedCopy fails. - const success = (await securedCopy()) || unsecuredCopy(); + async function handleClick() { + const success = await copy(value); if (success) { content = 'Copied'; @@ -61,7 +31,7 @@ setTimeout(() => (content = 'Click to copy'))} use:tooltip={{ diff --git a/src/lib/components/copyInput.svelte b/src/lib/components/copyInput.svelte index 65bd6bb81..b06f1ae36 100644 --- a/src/lib/components/copyInput.svelte +++ b/src/lib/components/copyInput.svelte @@ -1,5 +1,6 @@