From 528c71879d8ea312743e0397fef614c859be39b3 Mon Sep 17 00:00:00 2001 From: loma-one Date: Tue, 16 Apr 2024 18:11:23 +0200 Subject: [PATCH 01/10] invidious/invidious.php aktualisiert Now also considers links from "music.youtube" Raised to version 0.5 Removed the status "not supported. This must have crept in. It was not set by me and that was not my intention. Users explicitly request the option to set a different server in their personal settings. This function is very important to users. This request should not be ignored. --- invidious/invidious.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/invidious/invidious.php b/invidious/invidious.php index 7153aab9..b4884209 100644 --- a/invidious/invidious.php +++ b/invidious/invidious.php @@ -2,10 +2,10 @@ /* * Name: invidious * Description: Replaces links to youtube.com to an invidious instance in all displays of postings on a node. - * Version: 0.4 + * Version: 0.5 * Author: Matthias Ebers * Author: Michael Vogel - * Status: Unsupported + * Status: * Note: Please use the URL Replace addon instead */ @@ -96,6 +96,7 @@ function invidious_render(array &$b) $b['html'] = preg_replace("~https?://(?:www\.)?youtube\.com/watch\?v=(.*?)~ism", $server . '/watch?v=$1', $b['html']); $b['html'] = preg_replace("~https?://(?:www\.)?youtube\.com/embed/(.*?)~ism", $server . '/embed/$1', $b['html']); $b['html'] = preg_replace("~https?://(?:www\.)?youtube\.com/shorts/(.*?)~ism", $server . '/shorts/$1', $b['html']); + $b['html'] = preg_replace ("/https?:\/\/music.youtube.com\/(.*?)/ism", $server . '/watch?v=$1', $b['html']); $b['html'] = preg_replace("/https?:\/\/youtu.be\/(.*?)/ism", $server . '/watch?v=$1', $b['html']); if ($original != $b['html']) { -- 2.43.4 From fe7cb760cd60dedb304168105a1ee847590a1b4a Mon Sep 17 00:00:00 2001 From: loma-one Date: Tue, 16 Apr 2024 19:58:57 +0200 Subject: [PATCH 02/10] invidious/invidious.php aktualisiert MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ergänzung um "m.youtube.com" --- invidious/invidious.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/invidious/invidious.php b/invidious/invidious.php index b4884209..f2969919 100644 --- a/invidious/invidious.php +++ b/invidious/invidious.php @@ -5,7 +5,7 @@ * Version: 0.5 * Author: Matthias Ebers * Author: Michael Vogel - * Status: + * Status: Unsupported * Note: Please use the URL Replace addon instead */ @@ -97,6 +97,7 @@ function invidious_render(array &$b) $b['html'] = preg_replace("~https?://(?:www\.)?youtube\.com/embed/(.*?)~ism", $server . '/embed/$1', $b['html']); $b['html'] = preg_replace("~https?://(?:www\.)?youtube\.com/shorts/(.*?)~ism", $server . '/shorts/$1', $b['html']); $b['html'] = preg_replace ("/https?:\/\/music.youtube.com\/(.*?)/ism", $server . '/watch?v=$1', $b['html']); + $b['html'] = preg_replace ("/https?:\/\/m.youtube.com\/(.*?)/ism", $server . '/watch?v=$1', $b['html']); $b['html'] = preg_replace("/https?:\/\/youtu.be\/(.*?)/ism", $server . '/watch?v=$1', $b['html']); if ($original != $b['html']) { -- 2.43.4 From 7cf3f00f4a01c5af25151749b47ee33e61231f34 Mon Sep 17 00:00:00 2001 From: loma-one Date: Sat, 27 Apr 2024 08:21:54 +0200 Subject: [PATCH 03/10] Dateien nach "piped" hochladen Invidious servers seem to be permanently blocked by google. An alternative redirection destination is the piped project. It has the same intention as Invidious. --- piped/README.md | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 piped/README.md diff --git a/piped/README.md b/piped/README.md new file mode 100644 index 00000000..cdf599b8 --- /dev/null +++ b/piped/README.md @@ -0,0 +1,4 @@ +piped Addon for Friendica +========================== + +This addon will replace "youtube.com" with the chosen Piped instance -- 2.43.4 From 5299ab1e5fb5c2a33352645054fb0d0cf9286118 Mon Sep 17 00:00:00 2001 From: loma-one Date: Sat, 27 Apr 2024 08:22:08 +0200 Subject: [PATCH 04/10] Dateien nach "piped" hochladen --- piped/piped.php | 106 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100644 piped/piped.php diff --git a/piped/piped.php b/piped/piped.php new file mode 100644 index 00000000..81fa95b6 --- /dev/null +++ b/piped/piped.php @@ -0,0 +1,106 @@ + + * Author: Michael Vogel + * Status: + * Note: + */ + +use Friendica\Core\Hook; +use Friendica\Core\Renderer; +use Friendica\DI; + +CONST PIPED_DEFAULT = 'https://piped.video'; + +function piped_install() +{ + Hook::register('prepare_body_final', __FILE__, 'piped_render'); + Hook::register('addon_settings', __FILE__, 'piped_settings'); + Hook::register('addon_settings_post', __FILE__, 'piped_settings_post'); +} + +/* Handle the send data from the admin settings + */ +function piped_addon_admin_post() +{ + DI::config()->set('piped', 'server', trim($_POST['pipedserver'], " \n\r\t\v\x00/")); +} + +/* Hook into the admin settings to let the admin choose an + * piped server to use for the replacement. + */ +function piped_addon_admin(string &$o) +{ + $pipedserver = DI::config()->get('piped', 'server', PIPED_DEFAULT); + $t = Renderer::getMarkupTemplate('admin.tpl', 'addon/piped/'); + $o = Renderer::replaceMacros($t, [ + '$settingdescription' => DI::l10n()->t('Which Piped server shall be used for the replacements in the post bodies? Use the URL with servername and protocol. See %s for a list of available public Piped servers.', 'https://github.com/TeamPiped/Piped/wiki/Instances'), + '$pipedserver' => ['pipedserver', DI::l10n()->t('Piped server'), $pipedserver, DI::l10n()->t('See %s for a list of available Piped servers.', 'https://github.com/TeamPiped/Piped/wiki/Instances/')], + '$submit' => DI::l10n()->t('Save Settings'), + ]); +} + +function piped_settings(array &$data) +{ + if (!DI::userSession()->getLocalUserId()) { + return; + } + + $enabled = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'piped', 'enabled'); + $server = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'piped', 'server', DI::config()->get('piped', 'server', PIPED_DEFAULT)); + + $t = Renderer::getMarkupTemplate('settings.tpl', 'addon/piped/'); + $html = Renderer::replaceMacros($t, [ + '$enabled' => ['enabled', DI::l10n()->t('Replace Youtube links with links to an Piped server'), $enabled, DI::l10n()->t('If enabled, Youtube links are replaced with the links to the specified Piped server.')], + '$server' => ['server', DI::l10n()->t('Piped server'), $server, DI::l10n()->t('See %s for a list of available Piped servers.', 'https://github.com/TeamPiped/Piped/wiki/Instances/')], + ]); + + $data = [ + 'addon' => 'piped', + 'title' => DI::l10n()->t('Piped Settings'), + 'html' => $html, + ]; +} + +function piped_settings_post(array &$b) +{ + if (!DI::userSession()->getLocalUserId() || empty($_POST['piped-submit'])) { + return; + } + + DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'piped', 'enabled', (bool)$_POST['enabled']); + + $server = trim($_POST['server'], " \n\r\t\v\x00/"); + if ($server != DI::config()->get('piped', 'server', PIPED_DEFAULT) && !empty($server)) { + DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'piped', 'server', $server); + } else { + DI::pConfig()->delete(DI::userSession()->getLocalUserId(), 'piped', 'server'); + } +} + +/* + * replace "youtube.com" with the chosen Piped instance + */ +function piped_render(array &$b) +{ + if (!DI::userSession()->getLocalUserId() || !DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'piped', 'enabled')) { + return; + } + + $original = $b['html']; + $server = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'piped', 'server', DI::config()->get('piped', 'server', PIPED_DEFAULT)); + + $b['html'] = preg_replace("~https?://(?:www\.)?youtube\.com/watch\?v=(.*?)~ism", $server . '/watch?v=$1', $b['html']); + $b['html'] = preg_replace("~https?://(?:www\.)?youtube\.com/embed/(.*?)~ism", $server . '/embed/$1', $b['html']); + $b['html'] = preg_replace("~https?://(?:www\.)?youtube\.com/shorts/(.*?)~ism", $server . '/shorts/$1', $b['html']); + $b['html'] = preg_replace ("/https?:\/\/music.youtube.com\/(.*?)/ism", $server . '/watch?v=$1', $b['html']); + $b['html'] = preg_replace ("/https?:\/\/m.youtube.com\/(.*?)/ism", $server . '/watch?v=$1', $b['html']); + $b['html'] = preg_replace("/https?:\/\/youtu.be\/(.*?)/ism", $server . '/watch?v=$1', $b['html']); + + if ($original != $b['html']) { + $b['html'] .= '

' . DI::l10n()->t('(Piped addon enabled: YouTube links via %s)', $server) . '

'; + } +} -- 2.43.4 From 9e776266ce078c1b428e657ae57437bbd556d029 Mon Sep 17 00:00:00 2001 From: loma-one Date: Sat, 27 Apr 2024 08:22:31 +0200 Subject: [PATCH 05/10] Dateien nach "piped/templates" hochladen --- piped/templates/admin.tpl | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 piped/templates/admin.tpl diff --git a/piped/templates/admin.tpl b/piped/templates/admin.tpl new file mode 100644 index 00000000..600c1aa1 --- /dev/null +++ b/piped/templates/admin.tpl @@ -0,0 +1,5 @@ +

{{$settingdescription}}

+ +{{include file="field_input.tpl" field=$pipedserver}} + +
-- 2.43.4 From 7fb9245880b432482ce4481dbaff3ffb13748896 Mon Sep 17 00:00:00 2001 From: loma-one Date: Sat, 27 Apr 2024 08:22:45 +0200 Subject: [PATCH 06/10] Dateien nach "piped/templates" hochladen --- piped/templates/settings.tpl | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 piped/templates/settings.tpl diff --git a/piped/templates/settings.tpl b/piped/templates/settings.tpl new file mode 100644 index 00000000..387286ef --- /dev/null +++ b/piped/templates/settings.tpl @@ -0,0 +1,2 @@ +{{include file="field_checkbox.tpl" field=$enabled}} +{{include file="field_input.tpl" field=$server}} -- 2.43.4 From 0d7667bdd859cc42f4f4403220f679021b703ad0 Mon Sep 17 00:00:00 2001 From: loma-one Date: Sat, 27 Apr 2024 08:24:14 +0200 Subject: [PATCH 07/10] =?UTF-8?q?piped/lang/C=20hinzugef=C3=BCgt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- piped/lang/C | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 piped/lang/C diff --git a/piped/lang/C b/piped/lang/C new file mode 100644 index 00000000..e69de29b -- 2.43.4 From aab6502f832df2446e59cef2cae688de851d9b57 Mon Sep 17 00:00:00 2001 From: loma-one Date: Sat, 27 Apr 2024 08:29:13 +0200 Subject: [PATCH 08/10] =?UTF-8?q?piped/lang/C=20gel=C3=B6scht?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- piped/lang/C | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 piped/lang/C diff --git a/piped/lang/C b/piped/lang/C deleted file mode 100644 index e69de29b..00000000 -- 2.43.4 From cc17ec5685bf0c7b6bd42f68f433bc38f935ad86 Mon Sep 17 00:00:00 2001 From: loma-one Date: Sat, 27 Apr 2024 08:29:46 +0200 Subject: [PATCH 09/10] Dateien nach "piped/lang/C" hochladen --- piped/lang/C/messages.po | 58 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 piped/lang/C/messages.po diff --git a/piped/lang/C/messages.po b/piped/lang/C/messages.po new file mode 100644 index 00000000..b6cc6988 --- /dev/null +++ b/piped/lang/C/messages.po @@ -0,0 +1,58 @@ +# ADDON piped +# Copyright (C) +# This file is distributed under the same license as the Friendica piped addon package. +# +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: \n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-04-27 08:25+0200\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: piped.php:40 +#, php-format +msgid "" +"Which Piped server shall be used for the replacements in the post bodies? " +"Use the URL with servername and protocol. See %s for a list of available " +"public Piped servers." +msgstr "" + +#: piped.php:41 piped.php:58 +msgid "Piped server" +msgstr "" + +#: piped.php:41 piped.php:58 +#, php-format +msgid "See %s for a list of available Piped servers." +msgstr "" + +#: piped.php:42 +msgid "Save Settings" +msgstr "" + +#: piped.php:57 +msgid "Replace Youtube links with links to an Piped server" +msgstr "" + +#: piped.php:57 +msgid "" +"If enabled, Youtube links are replaced with the links to the specified Piped " +"server." +msgstr "" + +#: piped.php:63 +msgid "Piped Settings" +msgstr "" + +#: piped.php:104 +#, php-format +msgid "(Piped addon enabled: YouTube links via %s)" +msgstr "" -- 2.43.4 From b1c10e8e660684aa70ed739a4740f893077c499b Mon Sep 17 00:00:00 2001 From: loma-one Date: Sun, 19 May 2024 08:45:04 +0200 Subject: [PATCH 10/10] =?UTF-8?q?Dateien=20nach=20=E2=80=9Eaudon=E2=80=9C?= =?UTF-8?q?=20hochladen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Audon must not be loaded inframe. Otherwise the microphone cannot be addressed. The change causes a new browser window to open. In this window, the microphone can be addressed and communication with other participants can be started. The browser must allow a new window to be opened. --- audon/audon.php | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/audon/audon.php b/audon/audon.php index 553e7f5c..83dc497c 100644 --- a/audon/audon.php +++ b/audon/audon.php @@ -1,8 +1,8 @@ * Author: Tobias Diekershoff * Author: Matthias Ebers @@ -26,13 +26,13 @@ function audon_addon_admin(string &$o) { $t = Renderer::getMarkupTemplate('admin.tpl', 'addon/audon/'); $o = Renderer::replaceMacros($t, [ - '$submit' => DI::l10n()->t('Save Settings'), + '$submit' => DI::l10n()->t('Save Settings'), '$audonurl' => [ - 'audonurl', - DI::l10n()->t('Audon Base URL'), - DI::config()->get('audon','audonurl'), - DI::l10n()->t('Page your users will create an Audon audio chat room on. For example you could use https://audon.space.'), - ], + 'audonurl', + DI::l10n()->t('Audon Base URL'), + DI::config()->get('audon', 'audonurl'), + DI::l10n()->t('Page your users will create an Audon audio chat room on. For example, you could use https://audon.space.'), + ], ]); } @@ -46,23 +46,26 @@ function audon_addon_admin_post() * existence of this method is checked to figure out if the addon offers a * module. */ -function audon_module() {} +function audon_module() +{ +} function audon_content(): string { $o = ''; - /* landingpage to create chatrooms */ + /* landing page to create chatrooms */ $audonurl = DI::config()->get('audon', 'audonurl'); + /* open the landing page in a new browser window without controls */ + $o = ''; - /* embedd the landing page in an iframe */ $o .= '

' . DI::l10n()->t('Audio Chat') . '

'; $o .= '

' . DI::l10n()->t('Audon is an audio conferencing tool. Connect your account to Audon and create a room. Share the generated link to talk to other participants.') . '

'; if ($audonurl == '') { $o .= '

' . DI::l10n()->t('Please contact your Friendica administrator to remind them to configure the Audon addon.') . '

'; - } else { - $o .= ''; } return $o; -- 2.43.4