TabLogger Uninstall Feedback Page

卸载反馈页面(uninstall.astro),当用户卸载 TabLogger 扩展时自动打开。已从独立 Vite+React 项目迁移为 Astro 页面,路由为 /tablogger/uninstall

技术栈

本地预览

cd media/frontend
pnpm dev

访问地址:http://localhost:4321/tablogger/uninstall

可附加 URL 参数模拟插件传入的数据:

http://localhost:4321/tablogger/uninstall?v=0.1.1&lang=zh_CN&installed=1700000000000
参数说明
v插件版本号
lang用户语言(en / zh_CN / zh_TW / ko / ja),缺省时使用浏览器 locale
installed安装时间戳(毫秒),用于计算安装天数

语言检测逻辑

优先级:?lang= URL 参数 → navigator.languagenavigator.languages[] → 兜底 en

支持的语言:English(en)、简体中文(zh_CN)、繁體中文(zh_TW)、한국어(ko)、日本語(ja)

数据存储

反馈数据写入 Supabase uninstall_feedback 表:

字段说明
product_id固定值 tablogger
product_version插件版本号(来自 URL 参数 v,缺省取 TABLOGGER_VERSION
reason卸载原因(枚举)
comment可选补充说明(最多 500 字)
email可选联系邮箱(最多 254 字符)
browser_locale浏览器语言
browser_name浏览器品牌(Chrome / Firefox / Safari / Edge / Opera 等)
browser_version浏览器版本号字符串
install_duration_days安装使用了多少天

安全说明:Anon Key 嵌入前端是安全的,Supabase RLS 只允许匿名 INSERT,无法读取或修改数据。

Supabase 数据库变更

初始建表 SQL

create table if not exists uninstall_feedback (
  id                    bigint generated always as identity primary key,
  created_at            timestamptz not null default now(),
  product_id            text        not null,
  product_version       text,
  reason                text        not null,
  comment               text,
  email                 text,
  browser_locale        text        not null,
  browser_name          text,
  browser_version       text,
  install_duration_days integer
);

-- 限制匿名用户只能 INSERT,不能读写其他行
alter table uninstall_feedback enable row level security;

create policy "allow anon insert"
  on uninstall_feedback
  for insert
  to anon
  with check (true);

已有表增加 email / browser 列(迁移 SQL)

alter table uninstall_feedback
  add column if not exists email text check (char_length(email) <= 254);

alter table uninstall_feedback
  add column if not exists browser_name    text;

alter table uninstall_feedback
  add column if not exists browser_version text;