{"id":17754617,"url":"https://github.com/mypdns/mk-cleaner","last_synced_at":"2025-05-09T01:29:06.474Z","repository":{"id":258838684,"uuid":"875578567","full_name":"mypdns/MK-Cleaner","owner":"mypdns","description":"LIttle program that allows and admin to suspend users and delete their posts from a MissKey instance in one process","archived":false,"fork":false,"pushed_at":"2024-10-20T22:04:11.000Z","size":27,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-10-22T13:41:40.585Z","etag":null,"topics":["ferris","misskey","misskey-api","mypdns","rust-lang"],"latest_commit_sha":null,"homepage":"https://www.mypdns.org","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mypdns.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"Contributing.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":".github/SUPPORT.md","governance":"GOVERNANCE.md","roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"custom":["https://github.com/mypdns/matrix/blob/master/DONATION.md"],"ko_fi":"spirillen","liberapay":"spirillen"}},"created_at":"2024-10-20T11:12:00.000Z","updated_at":"2024-10-20T22:04:14.000Z","dependencies_parsed_at":"2024-10-21T00:38:16.856Z","dependency_job_id":null,"html_url":"https://github.com/mypdns/MK-Cleaner","commit_stats":null,"previous_names":["secret-admin-programs/mk-cleaner"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mypdns%2FMK-Cleaner","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mypdns%2FMK-Cleaner/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mypdns%2FMK-Cleaner/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mypdns%2FMK-Cleaner/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mypdns","download_url":"https://codeload.github.com/mypdns/MK-Cleaner/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253173743,"owners_count":21865749,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ferris","misskey","misskey-api","mypdns","rust-lang"],"created_at":"2024-10-26T14:07:22.516Z","updated_at":"2025-05-09T01:29:06.415Z","avatar_url":"https://github.com/mypdns.png","language":"Rust","funding_links":["https://github.com/mypdns/matrix/blob/master/DONATION.md","https://ko-fi.com/spirillen","https://liberapay.com/spirillen","https://liberapay.com/MyPDNS/donate"],"categories":[],"sub_categories":[],"readme":"[![My Privacy DNS](https://www.mypdns.org/images/logo.png)](https://www.mypdns.org/)\n\n[![ko-fi](https://www.mypdns.org/fileproxy/?name=sp_kofi_mypdns)]([DONATION.md](https://kb.mypdns.org/articles/MTX-A-3/DONATION))\n[![liberapay](https://www.mypdns.org/fileproxy/?name=sp_receives_mypdns)](https://liberapay.com/MyPDNS/donate)\n[![goal](https://www.mypdns.org/fileproxy/?name=sp_goal_mypdns)](https://liberapay.com/MyPDNS/donate)\n\n# MK Cleaner\n\n\u003c!-- TOC --\u003e\n* [MK Cleaner](#mk-cleaner)\n  * [Running MK Cleaner](#running-mk-cleaner)\n  * [The error](#the-error)\n  * [Other docs](#other-docs)\n  * [History](#history)\n\u003c!-- TOC --\u003e\n\nMk Cleaner is a little program that can operate with the API of a [Misskey][MK]\nserver. It should be able to do 3 things:\n\n1. Suspend an Account based on internal(local) ID\n2. Delete all the users posts\n3. Delete all the users files\n4. (If you are really bored) Cron the job to find these accounts by tags and do\n   it by itself (Needs Some kind of manual approval system)\n\nThis is because I'm running and trying to maintain https://matrix.rocks/, and\nthis is part is sucking the life out of me, doing this manually.\n\nThe first commit to this project comes from : and is based on the Rust gradle\nmodule [misskey-rs][MKRS], the gradle on [docs.rs][DRS], however, the project\nkind a looks like it is no longer maintained, as last commit (as time of writing\nthis), was May 7, 2023\n\nThis may be the reason to the error I receive when running the code against the\nserver version `2024.10.0` while the last mention version on the project is\n`v12.63.0`\n\n## Running MK Cleaner\nFirst, you should clone this repository to make it easy to update.\n\n```shell\ngit clone https://github.com/mypdns/MK-Cleaner.git mk-ckleaner \u0026\u0026 \\\n    cd mk-ckleaner \u0026\u0026 cp mk-cleaner.sh.example mk-cleaner.sh\n```\n\n```shell\n# This script will open your config file with your default editor, else help\n# you set default editor (*nix ONLY)\n\nif [ -n \"$(which xdg-open)\" ]; then\n    xdg-open \"mk-cleaner.sh\"\nelif [ -n \"${VISUAL-${EDITOR-nano}}\" ]; then\n    ${VISUAL-${EDITOR-nano}} \"mk-cleaner.sh\"\nelif [ -n \"$(which editor)\" ]; then\n    editor \"mk-cleaner.sh\"\nelse\n    echo \"Your System suck!!!\"\n    echo \"You should set a default editor for your system\"\n    echo \"I'll help you this time!!!\"\n    select-editor || exit 1\n\n    if [ -n \"${VISUAL-${EDITOR-nano}}\" ]; then\n        ${VISUAL-${EDITOR-nano}} \"mk-cleaner.sh\"\n\n    elif [ -n \"$(which editor)\" ]; then\n        editor \"mk-cleaner.sh\"\n    fi\nfi\n```\n\n\u003e [!NOTE]  \n\u003e This is subject to being altered once the program is fully\n\u003e functional, and released as stable.\n\u003e We, should change the way we read in the environment variables from a config\n\u003e file, and the rust program itself asks for the userID. \n\n\u003e [!IMPORTANT]  \n\u003e Next you need to configure the `mk-cleaner.sh` by copying the\n\u003e `mk-cleaner.sh.example` to `mk-cleaner.sh` and set the values of\n\n1. `MISSKEY_API_URL`, This is the full url to your API path, such as `https://example.org/api/`\n2. `MISSKEY_TOKEN`, This is your private API_key from your installation URI, such as `https://example.org/settings/api`\n\nNow you should be able to run `mk-cleaner.sh` like \n\n```shell\nmk-cleaner.sh userID\n```\n\n## The error\nThe error seems to be related to how the json response is handled, and I don't\nknow if there is a workaround for this.\n\n```rust\nMISSKEY_API_URL=\"https://matrix.rocks/api/\" MISSKEY_TOKEN=\"API_KEY\" ./mk-cleaner $UID\nDoing $UID\nFailed to get user $UID notes: JSON error: invalid type: map, expected a sequence at line 1 column 825\nusers suspended: 1, not suspended: 0\nnotes deleted: 0, not deleted: 1\n```\n\nI've opened this issue https://github.com/coord-e/misskey-rs/issues/73\n\n## Other docs\n\n* Contributing: \u003ca href=\"../master/Contributing.md\"\u003eContributing.md\u003c/a\u003e\n* Code of Conduct: \u003ca href=\"../master/CODE_OF_CONDUCT.md\"\u003eCODE_OF_CONDUCT.md\u003c/a\u003e\n* License: \u003ca href=\"../master/LICENSE\" title=\"BSD 3-Clause License\"\u003eBSD 3-Clause License\u003c/a\u003e\n\n## History\nThis project started the 19th October 2024, 14:51 (CEST) with [this message] on\nhttps://matrix.to/#/#rust-off-topic:xiretza.xyz\n\n```json\n{\n  \"content\": {\n    \"body\": \"Hey, anyone of you who know how to code, that having a silent and even maybe a bored day?\\n\\nThen I would like to ask if one of you might like to give me a helping hand, by making a little program that can operate with the API of a Misskey server. It should be able to do 3 things\\n\\n1. Suspend an Account based on internal(local) ID\\n2. Delete all the users posts \\n3. Delete all the users files\\n4. (If you are really bored) Cron the job to find these accounts by tags and do it by it self (Needs Some kind of manual approval system)\\n\\nThis is because I'm running and trying to maintain https://matrix.rocks/, and this is part is sucking the live out of me, doing this manually.\",\n    \"format\": \"org.matrix.custom.html\",\n    \"formatted_body\": \"\u003cp\u003eHey, anyone of you who know how to code, that having a silent and even maybe a bored day?\u003c/p\u003e\\n\u003cp\u003eThen I would like to ask if one of you might like to give me a helping hand, by making a little program that can operate with the API of a Misskey server. It should be able to do 3 things\u003c/p\u003e\\n\u003col\u003e\\n\u003cli\u003eSuspend an Account based on internal(local) ID\u003c/li\u003e\\n\u003cli\u003eDelete all the users posts\u003c/li\u003e\\n\u003cli\u003eDelete all the users files\u003c/li\u003e\\n\u003cli\u003e(If you are really bored) Cron the job to find these accounts by tags and do it by it self (Needs Some kind of manual approval system)\u003c/li\u003e\\n\u003c/ol\u003e\\n\u003cp\u003eThis is because I'm running and trying to maintain https://matrix.rocks/, and this is part is sucking the live out of me, doing this manually.\u003c/p\u003e\\n\",\n    \"m.mentions\": {},\n    \"msgtype\": \"m.text\"\n  },\n  \"origin_server_ts\": 1729342275336,\n  \"sender\": \"@spirillen:matrix.org\",\n  \"type\": \"m.room.message\",\n  \"unsigned\": {\n    \"membership\": \"join\",\n    \"age\": 79859907,\n    \"transaction_id\": \"m1729342274901.2\"\n  },\n  \"event_id\": \"$_codlYa9cAgjTh0W3xKuZ9oWbWDHRl-Z1IAJkWTPkH0\",\n  \"room_id\": \"!yqjgpOiwXStfzObcpo:typ3.tech\"\n}\n```\n\nSome hours later [Kim Minh] replied with this code, you find in the [first commit]\n\n[DRS]: https://docs.rs/misskey/latest/misskey/\n[MK]: https://github.com/misskey-dev/misskey\n[MKRS]: https://github.com/coord-e/misskey-rs\n[RPG]: https://play.rust-lang.org/?version=stable\u0026mode=debug\u0026edition=2021\u0026gist=3c63ed0325a458fbe12b654e3799ba87\n[this message]: https://matrix.to/#/!yqjgpOiwXStfzObcpo:typ3.tech/$_codlYa9cAgjTh0W3xKuZ9oWbWDHRl-Z1IAJkWTPkH0?via=computer.surgery\u0026via=matrix.org\u0026via=mozilla.org\n[Kim Minh]: https://matrix.to/#/@kaplan:matrix.org\n[first commit]: https://github.com/mypdns/MK-Cleaner/commit/61c0af0d09cf87a51ca476abf6ceafb9a76e6012","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmypdns%2Fmk-cleaner","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmypdns%2Fmk-cleaner","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmypdns%2Fmk-cleaner/lists"}