Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

feat: email in watermark (#4699)

Liu Ji303602a6f163
diff --git a/frontend/src/components/misc/Watermark.vue b/frontend/src/components/misc/Watermark.vue
index 17417d539d..4bda06caeb 100644
--- a/frontend/src/components/misc/Watermark.vue
+++ b/frontend/src/components/misc/Watermark.vue
@@ -1,17 +1,19 @@
<template>
<NWatermark
- v-if="watermark"
+ v-for="(line, i) in lines"
+ :key="i"
style="z-index: 10000000"
- :content="watermark"
+ :content="line"
:cross="true"
:fullscreen="true"
- :font-size="16"
- :line-height="16"
- :width="384"
- :height="384"
- :x-offset="12"
- :y-offset="60"
+ :font-size="SIZE"
+ :line-height="SIZE"
+ :width="GAP"
+ :height="GAP"
+ :x-offset="0"
+ :y-offset="calcYOffset(i)"
:rotate="-15"
+ :debug="false"
/>
</template>
@@ -22,14 +24,33 @@ import { NWatermark } from "naive-ui";
import { featureToRef, useCurrentUser, useSettingByName } from "@/store";
import { UNKNOWN_ID } from "@/types";
+const GAP = 320;
+const SIZE = 16;
+const PADDING = 6;
+
const currentUser = useCurrentUser();
const setting = useSettingByName("bb.workspace.watermark");
const hasWatermarkFeature = featureToRef("bb.feature.watermark");
-const watermark = computed(() => {
- if (currentUser.value.id === UNKNOWN_ID) return "";
- if (!hasWatermarkFeature.value) return "";
- if (setting.value?.value !== "1") return "";
- return `${currentUser.value.name} (${currentUser.value.id})`;
+const lines = computed(() => {
+ const user = currentUser.value;
+ if (user.id === UNKNOWN_ID) return [];
+ if (!hasWatermarkFeature.value) return [];
+ if (setting.value?.value !== "1") return [];
+
+ const lines: string[] = [];
+ lines.push(`${user.name} (${user.id})`);
+ if (user.email) {
+ lines.push(user.email);
+ }
+
+ return lines;
});
+
+const calcYOffset = (i: number) => {
+ const total = lines.value.length;
+ const base = GAP - PADDING;
+ const offset = (total - i) * (SIZE * 1.25);
+ return base - offset;
+};
</script>