diff --git a/.forgejo/workflows/lint.yml b/.forgejo/workflows/lint.yml index 90eb268dda..4edebbce86 100644 --- a/.forgejo/workflows/lint.yml +++ b/.forgejo/workflows/lint.yml @@ -15,7 +15,7 @@ on: - packages/misskey-bubble-game/** - packages/misskey-reversi/** - packages/shared/eslint.config.js - - .github/workflows/lint.yml + - .forgejo/workflows/lint.yml pull_request: paths: - packages/backend/** @@ -27,7 +27,7 @@ on: - packages/misskey-bubble-game/** - packages/misskey-reversi/** - packages/shared/eslint.config.js - - .github/workflows/lint.yml + - .forgejo/workflows/lint.yml jobs: pnpm_install: runs-on: ubuntu-latest diff --git a/update.sql b/update.sql new file mode 100644 index 0000000000..b533b416fb --- /dev/null +++ b/update.sql @@ -0,0 +1,21 @@ +CREATE TEMPORARY TABLE "user_avatar_update" ( + "id" CHARACTER VARYING(32) PRIMARY KEY NOT NULL, + "updatedAvatarUrl" CHARACTER VARYING(512) NOT NULL +) + +CREATE INDEX "user_avatar_update_url" ON "user_avatar_update" ("updatedAvatarUrl") + +with typed as ( + select *, + case when "avatarUrl" ~ '%2Fproxy%2F' then 'nested' + when "avatarUrl" ~ '^https://mproxy\.mi\.yumechi\.jp' then 'proxied' + when "avatarUrl" ~ '^https://mi\.yumechi\.jp' then 'direct' + else 'unknown' end + AS proxy_type + FROM "user" WHERE "avatarUrl" IS NOT NULL) +INSERT INTO "user_avatar_update" ("id", "updatedAvatarUrl") +SELECT "id", 'https://mproxy.mi.yumechi.jp/' || SUBSTRING("avatarUrl" FROM 1 + LENGTH('https://mi.yumechi.jp/')) AS "updatedAvatarUrl" FROM typed WHERE proxy_type = 'direct' + +UPDATE "user" SET "avatarUrl" = "user_avatar_update"."updatedAvatarUrl" FROM "user_avatar_update" WHERE "user"."id" = "user_avatar_update"."id" + +SELECT typed."id", "avatarUrl", 'https://mproxy.mi.yumechi.jp/' || SUBSTRING("avatarUrl" FROM 1 + LENGTH('https://mi.yumechi.jp/')) AS aft from typed where proxy_type = 'direct' \ No newline at end of file