From 54fcec26052cf71edf2e6018bf7eec7f7b368a70 Mon Sep 17 00:00:00 2001
From: neo773 <62795688+neo773@users.noreply.github.com>
Date: Sat, 26 Aug 2023 22:56:47 +0530
Subject: [PATCH 1/3] Fix Settings i18n not working
---
src/components/TabSidebar.vue | 4 +++-
src/layouts/settings.vue | 12 ++++++------
2 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/src/components/TabSidebar.vue b/src/components/TabSidebar.vue
index ef62b814c2..58db10ee84 100644
--- a/src/components/TabSidebar.vue
+++ b/src/components/TabSidebar.vue
@@ -2,6 +2,7 @@
import { watch } from 'vue'
import { useRouter } from 'vue-router'
import type { Tab } from './comp_def'
+import { useI18n } from 'vue-i18n';
const props = defineProps<{
tabs: Tab[]
@@ -11,6 +12,7 @@ const props = defineProps<{
const emit = defineEmits(['update:activeTab'])
const router = useRouter()
+const { t } = useI18n()
function openLink(link: string) {
emit('update:activeTab', link)
@@ -47,7 +49,7 @@ watch(props, (p) => {
diff --git a/src/layouts/settings.vue b/src/layouts/settings.vue
index ad6fe15cb8..9236afd7cb 100644
--- a/src/layouts/settings.vue
+++ b/src/layouts/settings.vue
@@ -24,29 +24,29 @@ const ActiveTab = ref('')
const tabs = ref([
{
- label: t('account'),
+ label: 'account',
icon: shallowRef(IconAcount),
key: '/dashboard/settings/account',
},
{
- label: t('password'),
+ label: 'password',
icon: shallowRef(IconPassword),
key: '/dashboard/settings/changepassword',
},
{
- label: t('notifications'),
+ label: 'notifications',
icon: shallowRef(IconNotification),
key: '/dashboard/settings/notifications',
},
{
- label: t('plans'),
+ label: 'plans',
icon: shallowRef(IconPlans),
key: '/dashboard/settings/plans',
},
])
if (!Capacitor.isNativePlatform()) {
tabs.value.push({
- label: t('billing'),
+ label: 'billing',
icon: shallowRef(IconBilling) as any,
key: '/billing',
onClick: openPortal,
@@ -56,7 +56,7 @@ if (main.user?.id) {
isAdmin(main.user?.id).then((res) => {
if (!!res || isSpoofed()) {
tabs.value.push({
- label: t('admin'),
+ label: 'admin',
icon: shallowRef(IconAdmin) as any,
key: '/dashboard/settings/admin',
})
From 67326b2f994016f0320ae7da6523aef47daacf40 Mon Sep 17 00:00:00 2001
From: neo773 <62795688+neo773@users.noreply.github.com>
Date: Sun, 27 Aug 2023 02:19:42 +0530
Subject: [PATCH 2/3] add track_event edge function
---
supabase/config.toml | 3 ++
supabase/functions/track_event/index.ts | 45 +++++++++++++++++++++++++
2 files changed, 48 insertions(+)
create mode 100644 supabase/functions/track_event/index.ts
diff --git a/supabase/config.toml b/supabase/config.toml
index 65f7b6a098..b6f2f245cb 100644
--- a/supabase/config.toml
+++ b/supabase/config.toml
@@ -178,3 +178,6 @@ verify_jwt = false
[functions.website_stats]
verify_jwt = false
+
+[functions.track_event]
+verify_jwt = false
diff --git a/supabase/functions/track_event/index.ts b/supabase/functions/track_event/index.ts
new file mode 100644
index 0000000000..371a3ca197
--- /dev/null
+++ b/supabase/functions/track_event/index.ts
@@ -0,0 +1,45 @@
+import { serve } from 'https://deno.land/std@0.199.0/http/server.ts'
+import { supabaseAdmin } from '../_utils/supabase.ts'
+import { sendOptionsRes, sendRes } from '../_utils/utils.ts'
+
+import { LogSnag, PublishOptions } from 'https://cdn.logsnag.com/deno/0.1.8/index.ts';
+import { getEnv } from "../_utils/utils.ts";
+
+interface Body {
+ payload: PublishOptions
+ apiKey: string
+}
+
+serve(async (request: Request) => {
+ if (request.method === 'OPTIONS')
+ return sendOptionsRes()
+
+ try {
+ const { payload, apiKey } = await request.json() as Body
+
+ const data = await supabaseAdmin()
+ .from('apikeys')
+ .select()
+ .eq('key', apiKey)
+ .single()
+
+ if (data.error) {
+ return sendRes({ status: 'failed', message: 'Unauthorized' }, 400)
+ }
+
+ const logsnag = new LogSnag({
+ token: getEnv('LOGSNAG_TOKEN'),
+ project: getEnv('LOGSNAG_PROJECT'),
+ })
+
+ await logsnag.publish({
+ ...payload
+ })
+ return sendRes({ status: 'success', message: 'Event logged' }, 200)
+
+ } catch (error) {
+ console.log(error);
+
+ return sendRes({ status: 'failed', message: (error as Error).message }, 400)
+ }
+})
\ No newline at end of file
From 21d11cc1ddabc1d14059947653d7e38632eda4a5 Mon Sep 17 00:00:00 2001
From: neo773 <62795688+neo773@users.noreply.github.com>
Date: Sun, 27 Aug 2023 02:20:33 +0530
Subject: [PATCH 3/3] Revert "add track_event edge function"
This reverts commit 67326b2f994016f0320ae7da6523aef47daacf40.
---
supabase/config.toml | 3 --
supabase/functions/track_event/index.ts | 45 -------------------------
2 files changed, 48 deletions(-)
delete mode 100644 supabase/functions/track_event/index.ts
diff --git a/supabase/config.toml b/supabase/config.toml
index b6f2f245cb..65f7b6a098 100644
--- a/supabase/config.toml
+++ b/supabase/config.toml
@@ -178,6 +178,3 @@ verify_jwt = false
[functions.website_stats]
verify_jwt = false
-
-[functions.track_event]
-verify_jwt = false
diff --git a/supabase/functions/track_event/index.ts b/supabase/functions/track_event/index.ts
deleted file mode 100644
index 371a3ca197..0000000000
--- a/supabase/functions/track_event/index.ts
+++ /dev/null
@@ -1,45 +0,0 @@
-import { serve } from 'https://deno.land/std@0.199.0/http/server.ts'
-import { supabaseAdmin } from '../_utils/supabase.ts'
-import { sendOptionsRes, sendRes } from '../_utils/utils.ts'
-
-import { LogSnag, PublishOptions } from 'https://cdn.logsnag.com/deno/0.1.8/index.ts';
-import { getEnv } from "../_utils/utils.ts";
-
-interface Body {
- payload: PublishOptions
- apiKey: string
-}
-
-serve(async (request: Request) => {
- if (request.method === 'OPTIONS')
- return sendOptionsRes()
-
- try {
- const { payload, apiKey } = await request.json() as Body
-
- const data = await supabaseAdmin()
- .from('apikeys')
- .select()
- .eq('key', apiKey)
- .single()
-
- if (data.error) {
- return sendRes({ status: 'failed', message: 'Unauthorized' }, 400)
- }
-
- const logsnag = new LogSnag({
- token: getEnv('LOGSNAG_TOKEN'),
- project: getEnv('LOGSNAG_PROJECT'),
- })
-
- await logsnag.publish({
- ...payload
- })
- return sendRes({ status: 'success', message: 'Event logged' }, 200)
-
- } catch (error) {
- console.log(error);
-
- return sendRes({ status: 'failed', message: (error as Error).message }, 400)
- }
-})
\ No newline at end of file