2026-08-17 13:42:27 +02:00
local util = require ( ' util ' )
app.on ( ' scan_experience ' , function ( exp )
--print_r(exp)
end )
app.on ( ' scan_experience_file ' , function ( exp )
end )
app.on ( ' set ' , function ( k , v )
end )
app.on ( ' dir ' , function ( opts )
local showportals = app.opts . plugin_peertube_strategy == ' always ' or
( app.opts . plugin_peertube_strategy == ' homepage ' and opts.isroot )
if showportals then
opts.data . itemsremote = opts.data . itemsremote or { }
local itemsremote = opts.data . itemsremote
for i = 1 , 5 do
local urls = app.opts [ ' plugin_peertube_url_ ' .. i ]
if # urls > 0 then
local url = urls : gsub ( ' .* ' , ' ' )
local thumburl = urls : match ( " " ) and urls : gsub ( ' .* ' , ' ' ) or nil
table.insert ( itemsremote , {
title = url : gsub ( " .*// " , " " ) ,
thumbnail = thumburl ,
url = ' /janusweb/index.html#janus.url= ' .. EscapeFragment ( url )
2026-08-18 15:30:10 +02:00
.. ' &janus.referrer= ' .. EscapeFragment ( util.getURL ( opts.urlpath ) )
2026-08-17 13:42:27 +02:00
} )
end
end
end
end )
-- this registers the plugin UI
local plugin = {
name = " Peertube " ,
tab = " <img src='img/link.svg' class='icon invert'/> Peertube " ,
info = " <b class='tag'>disabled</b> <a href='https://joinpeertube.org' target='_blank'>Peertube</a> videos/channels/livestreams can be rendered as rooms in <a href='https://coderofsalvation.github.io/janus-guide/#/build/peertube' target='_blank'>JanusWeb</a> " ,
opts = {
{
key = ' app.opts.plugin_peertube_strategy ' ,
title = ' Display portals ' ,
info = " When to show peertube portals? " ,
default = " homepage " ,
values = { always = ' always ' , homepage = ' only homepage ' }
} ,
{
key = ' app.opts.plugin_peertube_url_1 ' ,
title = ' Peertube URL 1 ' ,
info = " URL and/or Thumbnail URL (space separated) " ,
default = " https://tilvids.com/c/arthurpizza https://oss.iqrator.org/wp-content/uploads/2026/01/00-16-510x510.png " ,
values = ' https://tilvids.com/c/arthurpizza https://oss.iqrator.org/wp-content/uploads/2026/01/00-16-510x510.png '
} ,
{
key = ' app.opts.plugin_peertube_url_2 ' ,
title = ' Peertube URL 2 ' ,
info = " URL and/or Thumbnail URL (space separated) " ,
default = " " ,
values = ' '
} ,
{
key = ' app.opts.plugin_peertube_url_3 ' ,
title = ' Peertube URL 3 ' ,
info = " URL and/or Thumbnail URL (space separated) " ,
default = " " ,
values = ' '
} ,
{
key = ' app.opts.plugin_peertube_url_4 ' ,
title = ' Peertube URL 4 ' ,
info = " URL and/or Thumbnail URL (space separated) " ,
default = " " ,
values = ' '
} ,
{
key = ' app.opts.plugin_peertube_url_5 ' ,
title = ' Peertube URL 5 ' ,
info = " URL and/or Thumbnail URL (space separated) " ,
default = " " ,
values = ' '
}
}
}
return plugin