@@ -66,6 +94,130 @@
$('.filesize').each(function(k,v) {
$(this).text(filesize(v.getAttribute('data-size')))
});
+
+ $('.btn-action').on('click', function(e) {
+ let id = this.getAttribute('data-instance-id');
+ let instanceDomain = this.getAttribute('data-instance-domain');
+ let text = 'Domain: ' + instanceDomain;
+ let unlisted = this.getAttribute('data-instance-unlisted');
+ let autocw = this.getAttribute('data-instance-autocw');
+ let banned = this.getAttribute('data-instance-banned');
+ swal({
+ title: 'Instance Actions',
+ text: text,
+ icon: 'warning',
+ buttons: {
+ unlist: {
+ text: unlisted == 0 ? "Unlist" : "Re-list",
+ className: "bg-warning",
+ value: "unlisted",
+ },
+ cw: {
+ text: autocw == 0 ? "CW Media" : "Remove AutoCW",
+ text: autocw == 0 ? "CW Media" : "Remove AutoCW",
+ className: "bg-warning",
+ value: "autocw",
+ },
+ ban: {
+ text: banned == 0 ? "Ban" : "Unban",
+ className: "bg-danger",
+ value: "ban",
+ },
+ },
+ })
+ .then((value) => {
+ switch (value) {
+ case "unlisted":
+ swal({
+ title: "Are you sure?",
+ text: unlisted == 0 ?
+ "Are you sure you want to unlist " + instanceDomain + " ?" :
+ "Are you sure you want to remove the unlisted rule of " + instanceDomain + " ?",
+ icon: "warning",
+ buttons: true,
+ dangerMode: true,
+ })
+ .then((unlist) => {
+ if (unlist) {
+ axios.post('/i/admin/instances/edit/' + id, {
+ action: 'unlist'
+ }).then((res) => {
+ swal("Domain action was successful! The page will now refresh.", {
+ icon: "success",
+ });
+ setTimeout(function() {
+ window.location.href = window.location.href;
+ }, 5000);
+ }).catch((err) => {
+ swal("Something went wrong!", "Please try again later.", "error");
+ })
+ } else {
+ swal("Action Cancelled", "You successfully cancelled this action.", "error");
+ }
+ });
+ break;
+ case "autocw":
+ swal({
+ title: "Are you sure?",
+ text: autocw == 0 ?
+ "Are you sure you want to auto CW all media from " + instanceDomain + " ?" :
+ "Are you sure you want to remove the auto cw rule for " + instanceDomain + " ?",
+ icon: "warning",
+ buttons: true,
+ dangerMode: true,
+ })
+ .then((res) => {
+ if (res) {
+ axios.post('/i/admin/instances/edit/' + id, {
+ action: 'autocw'
+ }).then((res) => {
+ swal("Domain action was successful! The page will now refresh.", {
+ icon: "success",
+ });
+ setTimeout(function() {
+ window.location.href = window.location.href;
+ }, 5000);
+ }).catch((err) => {
+ swal("Something went wrong!", "Please try again later.", "error");
+ })
+ } else {
+ swal("Action Cancelled", "You successfully cancelled this action.", "error");
+ }
+ });
+ break;
+ case "ban":
+ swal({
+ title: "Are you sure?",
+ text: autocw == 0 ?
+ "Are you sure you want to ban " + instanceDomain + " ?" :
+ "Are you sure you want unban " + instanceDomain + " ?",
+ icon: "warning",
+ buttons: true,
+ dangerMode: true,
+ })
+ .then((res) => {
+ if (res) {
+ axios.post('/i/admin/instances/edit/' + id, {
+ action: 'ban'
+ }).then((res) => {
+ swal("Domain action was successful! The page will now refresh.", {
+ icon: "success",
+ });
+ setTimeout(function() {
+ window.location.href = window.location.href;
+ }, 5000);
+ }).catch((err) => {
+ swal("Something went wrong!", "Please try again later.", "error");
+ })
+ } else {
+ swal("Action Cancelled", "You successfully cancelled this action.", "error");
+ }
+ });
+ break;
+
+ }
+ });
+ })
});
@endpush
\ No newline at end of file
diff --git a/resources/views/admin/instances/show.blade.php b/resources/views/admin/instances/show.blade.php
new file mode 100644
index 00000000..1bd3becd
--- /dev/null
+++ b/resources/views/admin/instances/show.blade.php
@@ -0,0 +1,113 @@
+@extends('admin.partial.template')
+
+@section('section')
+
+
+
+
Instance Overview
+
domain: {{$instance->domain}}
+
+
+
+
+
+
+
+
unlisted: {{$instance->unlisted ? 'true' : 'false'}}
+
+
+
CW media: {{$instance->auto_cw ? 'true' : 'false'}}
+
+
+
banned: {{$instance->banned ? 'true' : 'false'}}
+
+
+
+
+
+
+
+
+ {{$instance->profiles->count()}}
+
+
Profiles
+
+
+
+
+
+ {{$instance->reports->count()}}
+
+
Reports
+
+
+
+
+
+
+
+ {{$instance->statuses->count()}}
+
+
Statuses
+
+
+
+
+
+
+
+@endsection
+
+@push('scripts')
+
+@endpush
\ No newline at end of file