diff --git a/public/assets/css/front/exports.css b/public/assets/css/front/exports.css
new file mode 100644
index 0000000..133107f
--- /dev/null
+++ b/public/assets/css/front/exports.css
@@ -0,0 +1,12 @@
+section[role="exports"] {
+ background: var(--primary);
+ width: 100%;
+ max-width: 600px;
+ padding: 10px;
+ margin: 0 auto;
+ color: var(--white);
+}
+
+section[role="exports"] a {
+ color: var(--highlight);
+}
diff --git a/public/assets/css/front/start.css b/public/assets/css/front/start.css
index 106e4bb..74d1328 100644
--- a/public/assets/css/front/start.css
+++ b/public/assets/css/front/start.css
@@ -7,3 +7,4 @@
@import "about.css";
@import "listing.css";
@import "location.css";
+@import "exports.css";
diff --git a/src/Controller/Routes/Front/Index.php b/src/Controller/Routes/Front/Index.php
index c5b69ae..13f0725 100644
--- a/src/Controller/Routes/Front/Index.php
+++ b/src/Controller/Routes/Front/Index.php
@@ -12,6 +12,7 @@ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use App\Service\Auth;
use App\Service\Render;
use App\Service\HandleLocations;
+use App\Service\HandleExports;
class Index extends AbstractController
{
@@ -95,4 +96,27 @@ class Index extends AbstractController
"prevPage" => $prev
], "About The Bad Space", "front/listing.twig");
}
+
+ /**
+ * @Route("/exports/{type}", name="exports")
+ */
+ public function showExports(
+ Request $request,
+ Auth $auth,
+ Render $render,
+ HandleLocations $locations,
+ HandleExports $exports,
+ string $type = "none"
+ ): Response {
+ switch ($type) {
+ case 'none':
+ case '':
+ return $render->page([], "File Exports", "front/exports.twig");
+ break;
+ case 'mastodon':
+ return $exports->buildMastodonCSV();
+
+ break;
+ }
+ }
}
diff --git a/src/Service/HandleExports.php b/src/Service/HandleExports.php
new file mode 100644
index 0000000..c1baca8
--- /dev/null
+++ b/src/Service/HandleExports.php
@@ -0,0 +1,41 @@
+locations = $locations;
+ }
+
+ public function buildMastodonCSV()
+ {
+ $records = [['domain', 'severity', 'public_comment', 'reject_media', 'reject_reports', 'obfuscate']];
+ $entries = $this->locations->getActiveLocations();
+ foreach ($entries as $entry) {
+ $item = [$entry->getUrl(), $entry->getRating(), $entry->getDescription(), "FALSE", "FALSE", "FALSE"];
+ array_push($records, $item);
+ }
+
+ $tmp = new \SplTempFileObject();
+ foreach ($records as $record) {
+ $tmp->fputcsv($record);
+ }
+
+ $reader = Reader::createFromFileObject($tmp);
+ return new Response($reader->getContent(), 200, [
+ 'Content-Encoding' => 'none',
+ 'Content-Type' => 'text/csv; charset=UTF-8',
+ 'Content-Disposition' => 'attachment; filename="the-bad-space-mastodon.csv"',
+ 'Content-Description' => 'File Transfer',
+ ]);
+
+ //return $path;
+ }
+}
diff --git a/templates/front/exports.twig b/templates/front/exports.twig
new file mode 100644
index 0000000..6025bf7
--- /dev/null
+++ b/templates/front/exports.twig
@@ -0,0 +1,11 @@
+{% extends "base/frame.twig" %}
+{% block stylesheets %}
+
+ {% endblock %}
+
+ {% block main %}
+
+ {% endblock %}