Skip to content

Drive Cleanup and Clean Remote Files #123

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

Open
tassoman opened this issue May 23, 2024 · 1 comment
Open

Drive Cleanup and Clean Remote Files #123

tassoman opened this issue May 23, 2024 · 1 comment

Comments

@tassoman
Copy link

I just read announcement about /admin API routes are not going to be implemented... 👀

I'd like this two routes were supported:

  • 🧹 admin/drive/cleanup
  • 🧹 admin/drive/clean-remote-files

Maybe, is there room for proxying requests library?
For example a generic misskey.api_call('route') method sending already authenticated POST requests? 🤔 misskey._request() is a private callback.

@HotoRas
Copy link

HotoRas commented Sep 1, 2024

on the latest code (branch main), you can do:

# admin-drive.py
# class defines to rewrap
from misskey.sync_base import Misskey as Base

__all__ = (
    "Misskey",
)

class Misskey(Base):
    def admin_drive(self) -> Any:
        return self._api_request(endpoint="api/admin/drive/cleanup")

    def admin_drive_cleanRemoteFiles(self) -> Any:
        return self._api_request(endpoint="api/admin/drive/clean-remote-files")
# misskey-rewrap.py
from misskey import Misskey as MisskeyOrigin
from admin-drive import Misskey as AdminDriveMisskey

__all__ = (
    "Misskey",
)

class Misskey(MisskeyOrigin, AdminDriveMisskey):
    pass
# main.py
from misskey-rewrap import Misskey
mk = Misskey(
    address="https://misskey.example.com",
    token="token", # Valid misskey API token requires 'manage user drive'('write:admin:drive')
)
mk.admin_drive()
mk.admin_drive_cleanRemoteFiles()

or simply

from misskey import Misskey
mk = Misskey(
    address="https://misskey.example.com",
    token="token", # Valid misskey API token requires 'manage user drive'('write:admin:drive')
)

mk._api_request(endpoint="api/admin/drive/cleanup")
mk._api_request(endpoint="api/admin/drive/clean-remote-files")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants