refactor: 个人自用,移除登录与云同步全链路

站点只给本人用,云乐坊 SSO 授权、收藏/历史云同步、获客归因和账号切换记账都没有收益,却被登录状态检查和同步失败提示持续打扰。

- 删除 useYunlefunAuth / yunlefunAuth / yunlefunSsoConfig / yunlefunAuth 适配器、useUserDataSync / userDataSync / userData 适配器、三个 client 插件与 /auth/callback 回调页
- 抽出 adapters/cloudbase.ts,让「反馈一下」和匿名筛选信号不再依赖登录态;cook-feedback 云函数保留
- 删除 cook-user-data 云函数与 cook_user_data 权限规则,移除 @yunlefun/sso 依赖
- 「我的」页删掉登录按钮、账号卡、四个统计格和退出登录;「关于」页删掉项目作者、致谢名单和上游宣传链接
- 本地收藏/历史与导出导入保留,删除同步专用的 lastUid 记账

取舍见 docs/decisions/0005-drop-login-and-sync.md
This commit is contained in:
toor
2026-10-22 15:52:54 +08:00
committed by trae-solo-agent
parent 7408591fac
commit 8ff7b879b9
54 changed files with 214 additions and 3049 deletions
@@ -1,6 +0,0 @@
{
"action": "updateResourcePermission",
"resourceType": "noSqlDatabase",
"resourceId": "cook_user_data",
"permission": "ADMINONLY"
}
-50
View File
@@ -1,50 +0,0 @@
import assert from 'node:assert/strict'
import { execFileSync } from 'node:child_process'
import { lstatSync, mkdtempSync, readdirSync, renameSync, rmSync, symlinkSync } from 'node:fs'
import { tmpdir } from 'node:os'
import { join, resolve } from 'node:path'
import process from 'node:process'
import { fileURLToPath } from 'node:url'
const argument = process.argv.find(value => value.startsWith('--sdk-root='))
assert(argument, 'Pass --sdk-root=/path/to/ylf (a local checkout containing packages/sso)')
const sdkRoot = resolve(argument.slice('--sdk-root='.length))
const cookRoot = fileURLToPath(new URL('../../', import.meta.url))
const dependency = join(cookRoot, 'node_modules/@yunlefun/sso')
assert(lstatSync(dependency).isSymbolicLink(), 'Expected the existing pnpm SSO dependency symlink')
const temporary = mkdtempSync(join(tmpdir(), 'cook-acquisition-sdk-'))
const previous = join(temporary, 'previous-sso-link')
let replaced = false
const run = (args, cwd) => execFileSync('pnpm', args, { cwd, stdio: 'inherit' })
// Invoke installed tools directly: newer pnpm can auto-install on `exec` when the release lock is pending.
function runCookTool(tool, args) {
return execFileSync(join(cookRoot, 'node_modules/.bin', tool), args, {
cwd: cookRoot,
stdio: 'inherit',
})
}
try {
run(['--filter', '@yunlefun/sso', 'build'], sdkRoot)
run(['pack', '--pack-destination', temporary], join(sdkRoot, 'packages/sso'))
const archive = readdirSync(temporary).find(value => value.endsWith('.tgz'))
assert(archive, 'SDK pack must produce a tarball')
execFileSync('tar', ['-xzf', join(temporary, archive), '-C', temporary])
symlinkSync(join(sdkRoot, 'packages/sso/node_modules'), join(temporary, 'package/node_modules'), 'dir')
renameSync(dependency, previous)
replaced = true
symlinkSync(join(temporary, 'package'), dependency, 'dir')
runCookTool('vitest', ['run', 'test/acquisition.test.ts', 'test/yunlefunAuthAdapter.test.ts', 'test/yunlefunAuth.test.ts', 'test/yunlefunSsoConfig.test.ts'])
runCookTool('eslint', ['apps/web/app/utils/acquisition.ts', 'apps/web/app/plugins/acquisition.client.ts', 'apps/web/app/plugins/yunlefun-auth.client.ts', 'apps/web/app/adapters/yunlefunAuth.ts', 'test/acquisition.test.ts', 'test/yunlefunAuthAdapter.test.ts', 'test/yunlefunAuth.test.ts', 'scripts/qa/verify-acquisition-sdk.mjs'])
if (process.argv.includes('--build'))
runCookTool('nuxt', ['build'])
if (process.argv.includes('--typecheck'))
runCookTool('nuxt', ['typecheck'])
}
finally {
if (replaced) {
rmSync(dependency, { force: true })
renameSync(previous, dependency)
}
rmSync(temporary, { recursive: true, force: true })
}