Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

開発中の新カスタム絵文字管理画面(β)の取り込み #239

Merged
merged 192 commits into from
Dec 29, 2024

Conversation

Sayamame-beans
Copy link

What

misskey-dev#13473

Why

カスタム絵文字の大掃除をしたいので

Additional info (optional)

余計な変更が紛れ込んでいないかなどが確認出来ていません!
pnpm devだけ試しました

Checklist

  • Read the contribution guide
  • Test working in a local environment
  • (If needed) Add story of storybook
  • (If needed) Update CHANGELOG.md
  • (If possible) Add tests

# Conflicts:
#	packages/misskey-js/src/api.types.ts
#	packages/misskey-js/src/autogen/apiClientJSDoc.ts
#	packages/misskey-js/src/autogen/endpoint.ts
#	packages/misskey-js/src/autogen/entities.ts
#	packages/misskey-js/src/autogen/models.ts
#	packages/misskey-js/src/autogen/types.ts
# Conflicts:
#	packages/frontend/package.json
#	packages/misskey-js/src/autogen/apiClientJSDoc.ts
#	packages/misskey-js/src/autogen/endpoint.ts
#	packages/misskey-js/src/autogen/entities.ts
#	packages/misskey-js/src/autogen/models.ts
#	packages/misskey-js/src/autogen/types.ts
#	pnpm-lock.yaml
# Conflicts:
#	packages/misskey-js/src/autogen/apiClientJSDoc.ts
#	packages/misskey-js/src/autogen/endpoint.ts
#	packages/misskey-js/src/autogen/entities.ts
#	packages/misskey-js/src/autogen/models.ts
#	packages/misskey-js/src/autogen/types.ts
Copy link

github-actions bot commented Dec 29, 2024

このPRによるapi.jsonの差分

差分はこちら
--- base
+++ head
@@ -6453,6 +6453,15 @@
                       }
                     }
                   },
+                  "UNSUPPORTED_FILE_TYPE": {
+                    "value": {
+                      "error": {
+                        "message": "Unsupported file type.",
+                        "code": "UNSUPPORTED_FILE_TYPE",
+                        "id": "f7599d96-8750-af68-1633-9575d625c1a7"
+                      }
+                    }
+                  },
                   "DUPLICATE_NAME": {
                     "value": {
                       "error": {
@@ -8482,6 +8491,295 @@
         }
       }
     },
+    "/v2/admin/emoji/list": {
+      "post": {
+        "operationId": "v2___admin___emoji___list",
+        "summary": "v2/admin/emoji/list",
+        "description": "No description provided.\n\n**Credential required**: *Yes* / **Permission**: *read:admin:emoji*",
+        "externalDocs": {
+          "description": "Source code",
+          "url": "https://github.com/misskey-dev/misskey/blob/develop/packages/backend/src/server/api/endpoints/v2/admin/emoji/list.ts"
+        },
+        "tags": [
+          "admin"
+        ],
+        "security": [
+          {
+            "bearerAuth": []
+          }
+        ],
+        "requestBody": {
+          "required": true,
+          "content": {
+            "application/json": {
+              "schema": {
+                "type": "object",
+                "properties": {
+                  "query": {
+                    "type": [
+                      "object",
+                      "null"
+                    ],
+                    "properties": {
+                      "updatedAtFrom": {
+                        "type": "string"
+                      },
+                      "updatedAtTo": {
+                        "type": "string"
+                      },
+                      "name": {
+                        "type": "string"
+                      },
+                      "host": {
+                        "type": "string"
+                      },
+                      "uri": {
+                        "type": "string"
+                      },
+                      "publicUrl": {
+                        "type": "string"
+                      },
+                      "originalUrl": {
+                        "type": "string"
+                      },
+                      "type": {
+                        "type": "string"
+                      },
+                      "aliases": {
+                        "type": "string"
+                      },
+                      "category": {
+                        "type": "string"
+                      },
+                      "license": {
+                        "type": "string"
+                      },
+                      "isSensitive": {
+                        "type": "boolean"
+                      },
+                      "localOnly": {
+                        "type": "boolean"
+                      },
+                      "hostType": {
+                        "type": "string",
+                        "enum": [
+                          "local",
+                          "remote",
+                          "all"
+                        ],
+                        "default": "all"
+                      },
+                      "roleIds": {
+                        "type": "array",
+                        "items": {
+                          "type": "string",
+                          "format": "misskey:id"
+                        }
+                      }
+                    }
+                  },
+                  "sinceId": {
+                    "type": "string",
+                    "format": "misskey:id"
+                  },
+                  "untilId": {
+                    "type": "string",
+                    "format": "misskey:id"
+                  },
+                  "limit": {
+                    "type": "integer",
+                    "minimum": 1,
+                    "maximum": 100,
+                    "default": 10
+                  },
+                  "page": {
+                    "type": "integer"
+                  },
+                  "sortKeys": {
+                    "type": "array",
+                    "default": [
+                      "-id"
+                    ],
+                    "items": {
+                      "type": "string",
+                      "enum": [
+                        "+id",
+                        "-id",
+                        "+updatedAt",
+                        "-updatedAt",
+                        "+name",
+                        "-name",
+                        "+host",
+                        "-host",
+                        "+uri",
+                        "-uri",
+                        "+publicUrl",
+                        "-publicUrl",
+                        "+type",
+                        "-type",
+                        "+aliases",
+                        "-aliases",
+                        "+category",
+                        "-category",
+                        "+license",
+                        "-license",
+                        "+isSensitive",
+                        "-isSensitive",
+                        "+localOnly",
+                        "-localOnly",
+                        "+roleIdsThatCanBeUsedThisEmojiAsReaction",
+                        "-roleIdsThatCanBeUsedThisEmojiAsReaction"
+                      ]
+                    }
+                  }
+                }
+              }
+            }
+          }
+        },
+        "responses": {
+          "200": {
+            "description": "OK (with results)",
+            "content": {
+              "application/json": {
+                "schema": {
+                  "type": "object",
+                  "properties": {
+                    "emojis": {
+                      "type": "array",
+                      "items": {
+                        "type": "object",
+                        "$ref": "#/components/schemas/EmojiDetailedAdmin"
+                      }
+                    },
+                    "count": {
+                      "type": "integer"
+                    },
+                    "allCount": {
+                      "type": "integer"
+                    },
+                    "allPages": {
+                      "type": "integer"
+                    }
+                  },
+                  "required": [
+                    "emojis",
+                    "count",
+                    "allCount",
+                    "allPages"
+                  ]
+                }
+              }
+            }
+          },
+          "400": {
+            "description": "Client error",
+            "content": {
+              "application/json": {
+                "schema": {
+                  "$ref": "#/components/schemas/Error"
+                },
+                "examples": {
+                  "INVALID_PARAM": {
+                    "value": {
+                      "error": {
+                        "message": "Invalid param.",
+                        "code": "INVALID_PARAM",
+                        "id": "3d81ceae-475f-4600-b2a8-2bc116157532"
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          },
+          "401": {
+            "description": "Authentication error",
+            "content": {
+              "application/json": {
+                "schema": {
+                  "$ref": "#/components/schemas/Error"
+                },
+                "examples": {
+                  "CREDENTIAL_REQUIRED": {
+                    "value": {
+                      "error": {
+                        "message": "Credential required.",
+                        "code": "CREDENTIAL_REQUIRED",
+                        "id": "1384574d-a912-4b81-8601-c7b1c4085df1"
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          },
+          "403": {
+            "description": "Forbidden error",
+            "content": {
+              "application/json": {
+                "schema": {
+                  "$ref": "#/components/schemas/Error"
+                },
+                "examples": {
+                  "AUTHENTICATION_FAILED": {
+                    "value": {
+                      "error": {
+                        "message": "Authentication failed. Please ensure your token is correct.",
+                        "code": "AUTHENTICATION_FAILED",
+                        "id": "b0a7f5f8-dc2f-4171-b91f-de88ad238e14"
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          },
+          "418": {
+            "description": "I'm Ai",
+            "content": {
+              "application/json": {
+                "schema": {
+                  "$ref": "#/components/schemas/Error"
+                },
+                "examples": {
+                  "I_AM_AI": {
+                    "value": {
+                      "error": {
+                        "message": "You sent a request to Ai-chan, Misskey's showgirl, instead of the server.",
+                        "code": "I_AM_AI",
+                        "id": "60c46cd1-f23a-46b1-bebe-5d2b73951a84"
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          },
+          "500": {
+            "description": "Internal server error",
+            "content": {
+              "application/json": {
+                "schema": {
+                  "$ref": "#/components/schemas/Error"
+                },
+                "examples": {
+                  "INTERNAL_ERROR": {
+                    "value": {
+                      "error": {
+                        "message": "Internal error occurred. Please contact us if the error persists.",
+                        "code": "INTERNAL_ERROR",
+                        "id": "5d37dbcb-891e-41ca-a3d6-e690c97775ac"
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+    },
     "/admin/federation/delete-all-files": {
       "post": {
         "operationId": "admin___federation___delete-all-files",
@@ -82164,6 +82462,110 @@
           "roleIdsThatCanBeUsedThisEmojiAsReaction"
         ]
       },
+      "EmojiDetailedAdmin": {
+        "type": "object",
+        "properties": {
+          "id": {
+            "type": "string",
+            "format": "id"
+          },
+          "updatedAt": {
+            "type": [
+              "string",
+              "null"
+            ],
+            "format": "date-time"
+          },
+          "name": {
+            "type": "string"
+          },
+          "host": {
+            "type": [
+              "string",
+              "null"
+            ],
+            "description": "The local host is represented with `null`."
+          },
+          "publicUrl": {
+            "type": "string"
+          },
+          "originalUrl": {
+            "type": "string"
+          },
+          "uri": {
+            "type": [
+              "string",
+              "null"
+            ]
+          },
+          "type": {
+            "type": [
+              "string",
+              "null"
+            ]
+          },
+          "aliases": {
+            "type": "array",
+            "items": {
+              "type": "string",
+              "format": "id"
+            }
+          },
+          "category": {
+            "type": [
+              "string",
+              "null"
+            ]
+          },
+          "license": {
+            "type": [
+              "string",
+              "null"
+            ]
+          },
+          "localOnly": {
+            "type": "boolean"
+          },
+          "isSensitive": {
+            "type": "boolean"
+          },
+          "roleIdsThatCanBeUsedThisEmojiAsReaction": {
+            "type": "array",
+            "items": {
+              "type": "object",
+              "properties": {
+                "id": {
+                  "type": "string",
+                  "format": "misskey:id"
+                },
+                "name": {
+                  "type": "string"
+                }
+              },
+              "required": [
+                "id",
+                "name"
+              ]
+            }
+          }
+        },
+        "required": [
+          "id",
+          "updatedAt",
+          "name",
+          "host",
+          "publicUrl",
+          "originalUrl",
+          "uri",
+          "type",
+          "aliases",
+          "category",
+          "license",
+          "localOnly",
+          "isSensitive",
+          "roleIdsThatCanBeUsedThisEmojiAsReaction"
+        ]
+      },
       "Flash": {
         "type": "object",
         "properties": {

Get diff files from Workflow Page

@Sayamame-beans
Copy link
Author

軽く見た感じは既存の処理に影響出そうな感じはなかった
新処理で何か詰まって纏めてコケるとかが無ければ問題なく動きそう?

@anatawa12
Copy link
Collaborator

デカくてまだ見れてないです

builder.andWhere('emoji.id < :untilId', { untilId: params.untilId });
}

if (opts?.sortKeys && opts.sortKeys.length > 0) {
Copy link
Collaborator

@anatawa12 anatawa12 Dec 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

未知のsortKeyでSQL Injectionできないかが若干こわい。

もちろん API の json validation で弾いてるっぽいけど、年のためにここで確認したくなる

(将来別のAPI等が使うようになった際に API 側の実装を忘れる可能性を否定できない)

Copy link
Collaborator

@anatawa12 anatawa12 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ダメそうはなさそう。 frontend は動作確認をもとにしてください(私はやってない)

@Sayamame-beans
Copy link
Author

ありがとう

@Sayamame-beans Sayamame-beans merged commit f00ee3f into niri-la:develop Dec 29, 2024
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants