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

feat: subscribe return filename #734

Merged
merged 1 commit into from
Oct 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion apps/sspanel/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from django.db import models, transaction
from django.utils import functional, timezone
from redis.exceptions import LockError
from slugify import slugify

from apps import constants as c
from apps.ext import cache, encoder, lock, pay
Expand Down Expand Up @@ -298,7 +299,12 @@ def get_subinfo_header(self):
expire = int(datetime.datetime.timestamp(self.level_expire_time))
info = f"upload={self.upload_traffic}; download={self.download_traffic}; total={self.total_traffic}; expire={expire}"

return {"Subscription-Userinfo:": info}
filename = slugify(settings.TITLE)

return {
"Subscription-Userinfo:": info,
"Content-Disposition": f'attachment; filename= "{filename}.yaml"',
}


class UserMixin:
Expand Down
Loading