aboutsummaryrefslogtreecommitdiffstats
path: root/unshorturl
diff options
context:
space:
mode:
Diffstat (limited to 'unshorturl')
-rw-r--r--unshorturl/unshorturl.apd6
-rw-r--r--unshorturl/unshorturl.apd.license3
-rw-r--r--unshorturl/unshorturl.php31
3 files changed, 40 insertions, 0 deletions
diff --git a/unshorturl/unshorturl.apd b/unshorturl/unshorturl.apd
new file mode 100644
index 0000000..7532483
--- /dev/null
+++ b/unshorturl/unshorturl.apd
@@ -0,0 +1,6 @@
+version: 0.1.0
+url: $baseurl/nswf
+requires: local_channel
+name: UnshortURL
+photo: icon:filter
+categories: Networking
diff --git a/unshorturl/unshorturl.apd.license b/unshorturl/unshorturl.apd.license
new file mode 100644
index 0000000..f52ca8e
--- /dev/null
+++ b/unshorturl/unshorturl.apd.license
@@ -0,0 +1,3 @@
+SPDX-FileCopyrightText: 2021 Harald Eilertsen <haraldei@anduin.net>
+
+SPDX-License-Identifier: CC0-1.0 \ No newline at end of file
diff --git a/unshorturl/unshorturl.php b/unshorturl/unshorturl.php
new file mode 100644
index 0000000..626891f
--- /dev/null
+++ b/unshorturl/unshorturl.php
@@ -0,0 +1,31 @@
+<?php
+
+/**
+ * Name: UnshortURL
+ * Description: Expand shortened URLs into their proper URLs
+ * Version: 0.1.0
+ * Author: Harald Eilertsen <https://hub.volse.no/channel/harald>
+ * Maintainer: Harald Eilertsen <https://hub.volse.no/channel/harald>
+ *
+ * SPDX-FileCopyrightText: 2021 Harald Eilertsen <haraldei@anduin.net>
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+
+use Zotlabs\Lib\Apps;
+use Zotlabs\Extend\Hooks;
+
+function unshorturl_install() {
+ Hook::register('perpare_body', 'addon/unshorturl/unshorturl.php', 'unshorturl_prepare_body', 1);
+}
+
+function unshorturl_uninstall() {
+ Hook::deregister('prepare_body', 'addon/unshorturl/unshorturl.php', 'unshorturl_prepare_body');
+}
+
+function unshorturl_prepare_body(&$body) {
+ if (!local_channel() || !Apps::addon_app_installed(local_channel(), 'unshorturl')) {
+ return;
+ }
+
+ preg_replace('/https?:\/\/bit.ly\/[^\s]+/g', '[hidden bitly link]');
+}