|
|
@ -17,6 +17,18 @@ from core.models import Ad
|
|
|
|
from core.util import logs
|
|
|
|
from core.util import logs
|
|
|
|
from core.views.helpers import synchronize_async_helper
|
|
|
|
from core.views.helpers import synchronize_async_helper
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class AdNuke(LoginRequiredMixin, OTPRequiredMixin, View):
|
|
|
|
|
|
|
|
template_name = "mixins/partials/notify.html"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def get(self, request):
|
|
|
|
|
|
|
|
ads = Ad.objects.filter(user=request.user, enabled=True)
|
|
|
|
|
|
|
|
for ad in ads:
|
|
|
|
|
|
|
|
for platform in ad.platforms.all():
|
|
|
|
|
|
|
|
run = synchronize_async_helper(AgoraClient(platform))
|
|
|
|
|
|
|
|
synchronize_async_helper(run.nuke_ads())
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
context = {"class": "success", "message": "Nuking ads"}
|
|
|
|
|
|
|
|
return render(request, self.template_name, context)
|
|
|
|
|
|
|
|
|
|
|
|
class AdDist(LoginRequiredMixin, OTPRequiredMixin, View):
|
|
|
|
class AdDist(LoginRequiredMixin, OTPRequiredMixin, View):
|
|
|
|
template_name = "mixins/partials/notify.html"
|
|
|
|
template_name = "mixins/partials/notify.html"
|
|
|
@ -73,6 +85,13 @@ class AdList(LoginRequiredMixin, OTPRequiredMixin, ObjectList):
|
|
|
|
"label": "Update ads",
|
|
|
|
"label": "Update ads",
|
|
|
|
"icon": "fa-solid fa-refresh",
|
|
|
|
"icon": "fa-solid fa-refresh",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
"url": reverse("ad_nuke"),
|
|
|
|
|
|
|
|
"action": "nuke",
|
|
|
|
|
|
|
|
"method": "get",
|
|
|
|
|
|
|
|
"label": "Nuke ads",
|
|
|
|
|
|
|
|
"icon": "fa-solid fa-bomb",
|
|
|
|
|
|
|
|
},
|
|
|
|
]
|
|
|
|
]
|
|
|
|
return context
|
|
|
|
return context
|
|
|
|
|
|
|
|
|
|
|
|