update: availability to string encryption.

This commit is contained in:
Darshan
2025-07-10 15:56:30 +05:30
parent c8057c80ff
commit 92ecfd2f3b
5 changed files with 52 additions and 62 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
PUBLIC_CONSOLE_MODE=self-hosted
PUBLIC_CONSOLE_FEATURE_FLAGS=sites,attribute-encrypt,index-lengths
PUBLIC_CONSOLE_FEATURE_FLAGS=sites,index-lengths
PUBLIC_APPWRITE_MULTI_REGION=false
PUBLIC_APPWRITE_ENDPOINT=http://localhost/v1
PUBLIC_STRIPE_KEY=
+3 -3
View File
@@ -79,7 +79,7 @@ jobs:
labels: ${{ steps.meta.outputs.labels }}
build-args: |
"PUBLIC_CONSOLE_MODE=cloud"
"PUBLIC_CONSOLE_FEATURE_FLAGS=sites,attribute-encrypt,index-lengths"
"PUBLIC_CONSOLE_FEATURE_FLAGS=sites,index-lengths"
"PUBLIC_APPWRITE_MULTI_REGION=true"
"PUBLIC_GROWTH_ENDPOINT=${{ secrets.PUBLIC_GROWTH_ENDPOINT }}"
"PUBLIC_STRIPE_KEY=${{ secrets.PUBLIC_STRIPE_KEY_STAGE }}"
@@ -118,7 +118,7 @@ jobs:
build-args: |
"PUBLIC_CONSOLE_MODE=self-hosted"
"PUBLIC_APPWRITE_MULTI_REGION=false"
"PUBLIC_CONSOLE_FEATURE_FLAGS=sites,attribute-encrypt,index-lengths"
"PUBLIC_CONSOLE_FEATURE_FLAGS=sites,index-lengths"
"PUBLIC_GROWTH_ENDPOINT=${{ secrets.PUBLIC_GROWTH_ENDPOINT }}"
publish-cloud-no-regions:
@@ -156,6 +156,6 @@ jobs:
build-args: |
"PUBLIC_CONSOLE_MODE=cloud"
"PUBLIC_APPWRITE_MULTI_REGION=false"
"PUBLIC_CONSOLE_FEATURE_FLAGS=sites,attribute-encrypt,index-lengths"
"PUBLIC_CONSOLE_FEATURE_FLAGS=sites,index-lengths"
"PUBLIC_STRIPE_KEY=${{ secrets.PUBLIC_STRIPE_KEY_STAGE }}"
"PUBLIC_GROWTH_ENDPOINT=${{ secrets.PUBLIC_GROWTH_ENDPOINT }}"
-1
View File
@@ -20,6 +20,5 @@ function isFlagEnabled(name: string) {
export const flags = {
showSites: isFlagEnabled('sites'),
showAttributeEncrypt: isFlagEnabled('attribute-encrypt'),
showIndexLengths: isFlagEnabled('index-lengths')
};
@@ -50,7 +50,6 @@
import { ActionMenu, Selector } from '@appwrite.io/pink-svelte';
import { InputNumber, InputText, InputTextarea } from '$lib/elements/forms';
import { Popover, Layout, Tag, Typography, Link } from '@appwrite.io/pink-svelte';
import { flags } from '$lib/flags';
export let data: Partial<Models.AttributeString> = {
required: false,
@@ -63,8 +62,6 @@
let savedDefault = data.default;
const showEncrypt = flags.showAttributeEncrypt(page.data);
function handleDefaultState(hideDefault: boolean) {
if (hideDefault) {
savedDefault = data.default;
@@ -128,58 +125,55 @@
disabled={data.required || editing}
description="Indicate whether this attribute is an array. Defaults to an empty array." />
{#if showEncrypt}
<Layout.Stack gap="xs" direction="column">
<div
class="popover-holder"
class:cursor-not-allowed={editing}
class:disabled-checkbox={!supportsStringEncryption || editing}>
<Layout.Stack inline gap="s" alignItems="flex-start" direction="row">
<Popover let:toggle placement="bottom-start">
<Selector.Checkbox
size="s"
id="encrypt"
bind:checked={data.encrypt}
disabled={!supportsStringEncryption || editing} />
<Layout.Stack gap="xs" direction="column">
<div
class="popover-holder"
class:cursor-not-allowed={editing}
class:disabled-checkbox={!supportsStringEncryption || editing}>
<Layout.Stack inline gap="s" alignItems="flex-start" direction="row">
<Popover let:toggle placement="bottom-start">
<Selector.Checkbox
size="s"
id="encrypt"
bind:checked={data.encrypt}
disabled={!supportsStringEncryption || editing} />
<Layout.Stack gap="xxs" direction="column">
<button
type="button"
disabled={editing}
class:cursor-pointer={!editing}
class:cursor-not-allowed={editing}
on:click={(e) => {
if (!supportsStringEncryption) {
toggle(e);
} else {
data.encrypt = !data.encrypt;
}
}}>
<Layout.Stack inline gap="xxs" direction="row" alignItems="center">
<Typography.Text variant="m-500">Encrypted</Typography.Text>
{#if !supportsStringEncryption}
<Tag variant="default" size="xs" on:click={toggle}>Pro</Tag>
{/if}
</Layout.Stack>
</button>
<Typography.Text color="--fgcolor-neutral-tertiary">
Protect attribute against data leaks for best privacy compliance.
Encrypted attributes cannot be queried.
</Typography.Text>
</Layout.Stack>
<Layout.Stack gap="xxs" direction="column">
<button
type="button"
disabled={editing}
class:cursor-pointer={!editing}
class:cursor-not-allowed={editing}
on:click={(e) => {
if (!supportsStringEncryption) {
toggle(e);
} else {
data.encrypt = !data.encrypt;
}
}}>
<Layout.Stack inline gap="xxs" direction="row" alignItems="center">
<Typography.Text variant="m-500">Encrypted</Typography.Text>
{#if !supportsStringEncryption}
<Tag variant="default" size="xs" on:click={toggle}>Pro</Tag>
{/if}
</Layout.Stack>
</button>
<Typography.Text color="--fgcolor-neutral-tertiary">
Protect attribute against data leaks for best privacy compliance. Encrypted
attributes cannot be queried.
</Typography.Text>
</Layout.Stack>
<ActionMenu.Root width="180px" slot="tooltip">
<Typography.Text variant="m-500">
Available on Pro plan. <Link.Anchor href={$upgradeURL}
>Upgrade</Link.Anchor>
to enable encrypted attributes.
</Typography.Text>
</ActionMenu.Root>
</Popover>
</Layout.Stack>
</div>
</Layout.Stack>
{/if}
<ActionMenu.Root width="180px" slot="tooltip">
<Typography.Text variant="m-500">
Available on Pro plan. <Link.Anchor href={$upgradeURL}>Upgrade</Link.Anchor>
to enable encrypted attributes.
</Typography.Text>
</ActionMenu.Root>
</Popover>
</Layout.Stack>
</div>
</Layout.Stack>
<style lang="scss">
.popover-holder {
@@ -32,7 +32,6 @@
} from '@appwrite.io/pink-svelte';
import { toLocaleDateTime } from '$lib/helpers/date';
import DualTimeView from '$lib/components/dualTimeView.svelte';
import { flags } from '$lib/flags';
export let data: PageData;
@@ -155,8 +154,6 @@
) as Models.AttributeRelationship[];
let checked = false;
const showEncrypt = flags.showAttributeEncrypt(data);
</script>
<Table.Root
@@ -248,7 +245,7 @@
<span slot="title">Timestamp</span>
{toLocaleDateTime(datetime, true)}
</DualTimeView>
{:else if isEncryptedAttribute && showEncrypt}
{:else if isEncryptedAttribute}
<button on:click={(e) => e.preventDefault()}>
<InteractiveText
copy={false}