invidious/invidious.php aktualisiert #1497
|
@ -1,8 +1,8 @@
|
||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
* Name: Audon Application
|
* Name: Audon Application
|
||||||
* Description: add a Audon instance. Based on webRTC Addon
|
* Description: add an Audon instance. Based on webRTC Addon
|
||||||
* Version: 0.1
|
* Version: 0.2
|
||||||
* Author: Stephen Mahood <https://friends.mayfirst.org/profile/marxistvegan>
|
* Author: Stephen Mahood <https://friends.mayfirst.org/profile/marxistvegan>
|
||||||
* Author: Tobias Diekershoff <https://f.diekershoff.de/profile/tobias>
|
* Author: Tobias Diekershoff <https://f.diekershoff.de/profile/tobias>
|
||||||
* Author: Matthias Ebers <https://loma.ml/profile/feb>
|
* Author: Matthias Ebers <https://loma.ml/profile/feb>
|
||||||
|
@ -31,7 +31,7 @@ function audon_addon_admin(string &$o)
|
||||||
'audonurl',
|
'audonurl',
|
||||||
DI::l10n()->t('Audon Base URL'),
|
DI::l10n()->t('Audon Base URL'),
|
||||||
DI::config()->get('audon', 'audonurl'),
|
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.'),
|
DI::l10n()->t('Page your users will create an Audon audio chat room on. For example, you could use https://audon.space.'),
|
||||||
],
|
],
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,9 @@ function audon_addon_admin_post()
|
||||||
* existence of this method is checked to figure out if the addon offers a
|
* existence of this method is checked to figure out if the addon offers a
|
||||||
* module.
|
* module.
|
||||||
*/
|
*/
|
||||||
function audon_module() {}
|
function audon_module()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
function audon_content(): string
|
function audon_content(): string
|
||||||
{
|
{
|
||||||
|
@ -55,14 +57,15 @@ function audon_content(): string
|
||||||
/* landing page to create chatrooms */
|
/* landing page to create chatrooms */
|
||||||
$audonurl = DI::config()->get('audon', 'audonurl');
|
$audonurl = DI::config()->get('audon', 'audonurl');
|
||||||
|
|
||||||
|
/* open the landing page in a new browser window without controls */
|
||||||
|
$o = '<script>
|
||||||
|
window.open("' . $audonurl . '", "_blank", "toolbar=no,scrollbars=no,resizable=no,top=100,left=100,width=740,height=600");
|
||||||
|
</script>';
|
||||||
|
|
||||||
/* embedd the landing page in an iframe */
|
|
||||||
$o .= '<h2>' . DI::l10n()->t('Audio Chat') . '</h2>';
|
$o .= '<h2>' . DI::l10n()->t('Audio Chat') . '</h2>';
|
||||||
$o .= '<p>' . 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.') . '</p>';
|
$o .= '<p>' . 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.') . '</p>';
|
||||||
if ($audonurl == '') {
|
if ($audonurl == '') {
|
||||||
$o .= '<p>' . DI::l10n()->t('Please contact your Friendica administrator to remind them to configure the Audon addon.') . '</p>';
|
$o .= '<p>' . DI::l10n()->t('Please contact your Friendica administrator to remind them to configure the Audon addon.') . '</p>';
|
||||||
} else {
|
|
||||||
$o .= '<iframe src="' . $audonurl . '" width="740px" height="600px"></iframe>';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $o;
|
return $o;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
/*
|
/*
|
||||||
* Name: invidious
|
* Name: invidious
|
||||||
* Description: Replaces links to youtube.com to an invidious instance in all displays of postings on a node.
|
* 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 <https://loma.ml/profile/feb>
|
* Author: Matthias Ebers <https://loma.ml/profile/feb>
|
||||||
* Author: Michael Vogel <https://pirati.ca/profile/heluecht>
|
* Author: Michael Vogel <https://pirati.ca/profile/heluecht>
|
||||||
* Status: Unsupported
|
* Status: Unsupported
|
||||||
loma-one marked this conversation as resolved
Outdated
|
|||||||
|
@ -96,6 +96,8 @@ 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/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/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?://(?: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']);
|
$b['html'] = preg_replace("/https?:\/\/youtu.be\/(.*?)/ism", $server . '/watch?v=$1', $b['html']);
|
||||||
|
|
||||||
if ($original != $b['html']) {
|
if ($original != $b['html']) {
|
||||||
|
|
4
piped/README.md
Normal file
4
piped/README.md
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
piped Addon for Friendica
|
||||||
|
==========================
|
||||||
|
|
||||||
|
This addon will replace "youtube.com" with the chosen Piped instance
|
58
piped/lang/C/messages.po
Normal file
58
piped/lang/C/messages.po
Normal file
|
@ -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 <EMAIL@ADDRESS>\n"
|
||||||
|
"Language-Team: LANGUAGE <LL@li.org>\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 ""
|
106
piped/piped.php
Normal file
106
piped/piped.php
Normal file
|
@ -0,0 +1,106 @@
|
||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* Name: piped
|
||||||
|
* Description: Replaces links to youtube.com to an piped instance in all displays of postings on a node.
|
||||||
|
* Version: 0.1
|
||||||
|
* Author: Matthias Ebers <https://loma.ml/profile/feb>
|
||||||
|
* Author: Michael Vogel <https://pirati.ca/profile/heluecht>
|
||||||
|
* 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.', '<a href="https://github.com/TeamPiped/Piped/wiki/Instances/">https://github.com/TeamPiped/Piped/wiki/Instances/</a>')],
|
||||||
|
'$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.', '<a href="https://github.com/TeamPiped/Piped/wiki/Instances/">https://github.com/TeamPiped/Piped/wiki/Instances/</a>')],
|
||||||
|
]);
|
||||||
|
|
||||||
|
$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'] .= '<hr><p><small>' . DI::l10n()->t('(Piped addon enabled: YouTube links via %s)', $server) . '</small></p>';
|
||||||
|
}
|
||||||
|
}
|
5
piped/templates/admin.tpl
Normal file
5
piped/templates/admin.tpl
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<p>{{$settingdescription}}</p>
|
||||||
|
|
||||||
|
{{include file="field_input.tpl" field=$pipedserver}}
|
||||||
|
|
||||||
|
<div class="submit"><input type="submit" name="page_site" value="{{$submit}}" /></div>
|
2
piped/templates/settings.tpl
Normal file
2
piped/templates/settings.tpl
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
{{include file="field_checkbox.tpl" field=$enabled}}
|
||||||
|
{{include file="field_input.tpl" field=$server}}
|
|
@ -1293,6 +1293,8 @@ function unicode_smilies_smilies(array &$b)
|
||||||
Smilies::add($b, ':microscope:', '🔬');
|
Smilies::add($b, ':microscope:', '🔬');
|
||||||
Smilies::add($b, ':telescope:', '🔭');
|
Smilies::add($b, ':telescope:', '🔭');
|
||||||
Smilies::add($b, ':satellite antenna:', '📡');
|
Smilies::add($b, ':satellite antenna:', '📡');
|
||||||
|
Smilies::add($b, ':asterism:', '⁂');
|
||||||
|
Smilies::add($b, ':outlines white star:', '⚝');
|
||||||
|
|
||||||
// medical
|
// medical
|
||||||
Smilies::add($b, ':syringe:', '💉');
|
Smilies::add($b, ':syringe:', '💉');
|
||||||
|
|
Loading…
Reference in a new issue
This was added by us as we encourage people to use the
url_replace
addon instead. Please leave this label in place. I do not mind you adding changes to this addon but it isn't meant to be officially supported.The addon url_replace is a deterioration in terms of self-administration by users. The feature of being able to specify their own server was very important to them. Many users operate their own invidious servers or have an account on a server other than the one I have preset that they want to use. In addition, it relieves me in the event of an error (accessibility of invidious), as users can switch off independently.
A compromise suggestion: leave it active until the self-administration function desired by the users has been retrofitted in url_replace. In this case, the admin can continue to combine the addon. I would be happy to post an issue on this.
This addon isn't going anywhere yet, and admins can choose to show unsupported addons in the list by setting
system.show_unsupported_addons
. We made the decision of favoringurl_replace
over theinvidious
andnitter
addons, so it won't be reinstated.