86 lines
2.7 KiB
Lua
86 lines
2.7 KiB
Lua
|
|
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_rssatom_strategy == 'always' or
|
||
|
|
(app.opts.plugin_rssatom_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_rssatom_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)
|
||
|
|
})
|
||
|
|
end
|
||
|
|
end
|
||
|
|
end
|
||
|
|
end)
|
||
|
|
|
||
|
|
-- this registers the plugin UI
|
||
|
|
local plugin = {
|
||
|
|
name = "RSS Atom",
|
||
|
|
tab = "<img src='img/link.svg' class='icon invert'/> RSS Atom",
|
||
|
|
info = "<b class='tag'>disabled</b> RSS feeds can be rendered as rooms in <a href='https://coderofsalvation.github.io/janus-guide/#/build/feeds' target='_blank'>JanusWeb</a>",
|
||
|
|
opts = {
|
||
|
|
{
|
||
|
|
key='app.opts.plugin_rssatom_strategy',
|
||
|
|
title='Display portals',
|
||
|
|
info="When to show rss portals?",
|
||
|
|
default="homepage",
|
||
|
|
values={always='always',homepage='only homepage'}
|
||
|
|
},
|
||
|
|
{
|
||
|
|
key='app.opts.plugin_rssatom_url_1',
|
||
|
|
title='RSS/Atom URL 1',
|
||
|
|
info="URL and/or Thumbnail URL (space separated)",
|
||
|
|
default="http://mastodon.online/@lvk.rss https://pbs.twimg.com/profile_images/1604566357206601730/dlRNo-V-_400x400.jpg",
|
||
|
|
values='http://mastodon.online/@lvk.rss https://pbs.twimg.com/profile_images/1604566357206601730/dlRNo-V-_400x400.jpg'
|
||
|
|
},
|
||
|
|
{
|
||
|
|
key='app.opts.plugin_rssatom_url_2',
|
||
|
|
title='RSS/Atom URL 2',
|
||
|
|
info="URL and/or Thumbnail URL (space separated)",
|
||
|
|
default="https://nlnet.nl/feed.atom https://nlnet.nl/logo/history/logo-640x732-pre-2024.jpg",
|
||
|
|
values='https://nlnet.nl/feed.atom https://nlnet.nl/logo/history/logo-640x732-pre-2024.jpg'
|
||
|
|
},
|
||
|
|
{
|
||
|
|
key='app.opts.plugin_rssatom_url_3',
|
||
|
|
title='RSS/Atom URL 3',
|
||
|
|
info="URL and/or Thumbnail URL (space separated)",
|
||
|
|
default="",
|
||
|
|
values=''
|
||
|
|
},
|
||
|
|
{
|
||
|
|
key='app.opts.plugin_rssatom_url_4',
|
||
|
|
title='RSS/Atom URL 4',
|
||
|
|
info="URL and/or Thumbnail URL (space separated)",
|
||
|
|
default="",
|
||
|
|
values=''
|
||
|
|
},
|
||
|
|
{
|
||
|
|
key='app.opts.plugin_rssatom_url_5',
|
||
|
|
title='RSS/Atom URL 5',
|
||
|
|
info="URL and/or Thumbnail URL (space separated)",
|
||
|
|
default="",
|
||
|
|
values=''
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
return plugin
|