mirror of
https://github.com/Ernous/TorrServerJellyfin.git
synced 2025-12-19 13:36:09 +05:00
Alternative webOS launch
Reload torrents list
This commit is contained in:
@@ -35,7 +35,7 @@ func main() {
|
|||||||
filepath.WalkDir(srcGo+"template/pages/", func(path string, d fs.DirEntry, err error) error {
|
filepath.WalkDir(srcGo+"template/pages/", func(path string, d fs.DirEntry, err error) error {
|
||||||
if !d.IsDir() {
|
if !d.IsDir() {
|
||||||
name := strings.TrimPrefix(path, srcGo+"template/")
|
name := strings.TrimPrefix(path, srcGo+"template/")
|
||||||
if !strings.HasPrefix(name, ".") {
|
if !strings.HasPrefix(filepath.Base(name), ".") {
|
||||||
files = append(files, name)
|
files = append(files, name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ type msxMenu struct {
|
|||||||
Reuse bool `json:"reuse"`
|
Reuse bool `json:"reuse"`
|
||||||
Cache bool `json:"cache"`
|
Cache bool `json:"cache"`
|
||||||
Restore bool `json:"restore"`
|
Restore bool `json:"restore"`
|
||||||
|
Reference string `json:"reference,omitempty"`
|
||||||
Menu []msxMenuItem `json:"menu"`
|
Menu []msxMenuItem `json:"menu"`
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -96,6 +97,7 @@ func msxTorrents(c *gin.Context) {
|
|||||||
Cache: false,
|
Cache: false,
|
||||||
Reuse: false,
|
Reuse: false,
|
||||||
Restore: false,
|
Restore: false,
|
||||||
|
Reference: host + "/msx/torrents",
|
||||||
Menu: []msxMenuItem{
|
Menu: []msxMenuItem{
|
||||||
// Main page
|
// Main page
|
||||||
{
|
{
|
||||||
@@ -195,7 +197,19 @@ func msxPlaylist(c *gin.Context) {
|
|||||||
"type": mime,
|
"type": mime,
|
||||||
}
|
}
|
||||||
} else if (platform == "lg") {
|
} else if (platform == "lg") {
|
||||||
item.Action = "content:request:interaction:init@" + host + "/msx/webos.html?url=" + url.QueryEscape(uri)
|
item.Action = "system:lg:launch:com.webos.app.videoplayer"
|
||||||
|
item.Data = gin.H{
|
||||||
|
"properties": gin.H{
|
||||||
|
"videoList": gin.H{
|
||||||
|
"result": [1]gin.H{
|
||||||
|
gin.H{
|
||||||
|
"url": uri,
|
||||||
|
"thumbnail": tor.Poster,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
} else if (platform == "ios" || platform == "mac") {
|
} else if (platform == "ios" || platform == "mac") {
|
||||||
// TODO - for iOS and Mac the application must be defined in scheme but we don't know what user has installed
|
// TODO - for iOS and Mac the application must be defined in scheme but we don't know what user has installed
|
||||||
// item.Action = "system:tvx:launch:vlc://"+uri
|
// item.Action = "system:tvx:launch:vlc://"+uri
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -1,72 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>WebOS Interaction Plugin</title>
|
|
||||||
<meta charset="UTF-8" />
|
|
||||||
<meta name="author" content="kolsys" />
|
|
||||||
<meta name="copyright" content="kolsys" />
|
|
||||||
<script type="text/javascript" src="webOSTV-1.2.4.js"></script>
|
|
||||||
<script type="text/javascript" src="tvx-plugin.min.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
const params = new URLSearchParams(document.location.search);
|
|
||||||
|
|
||||||
function WebOSPlay() {
|
|
||||||
try {
|
|
||||||
webOS.service.request('luna://com.webos.applicationManager', {
|
|
||||||
method: 'launch',
|
|
||||||
parameters: {
|
|
||||||
id: 'com.webos.app.videoplayer',
|
|
||||||
params: {
|
|
||||||
videoList: {
|
|
||||||
result: params.getAll('url').map(url => ({url: url})),
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onSuccess: function (args) {
|
|
||||||
console.log('Success:', args);
|
|
||||||
TVXInteractionPlugin.executeAction('back');
|
|
||||||
},
|
|
||||||
onFailure: function (args) {
|
|
||||||
console.log('Failed to open Video Player', args);
|
|
||||||
TVXInteractionPlugin.executeAction('error:Failed to open Video Player');
|
|
||||||
}
|
|
||||||
},
|
|
||||||
});
|
|
||||||
} catch(e) {
|
|
||||||
console.log('ERROR', e);
|
|
||||||
TVXInteractionPlugin.executeAction('error:Failed to open Video Player – ' + e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function WebOSHandler() {
|
|
||||||
this.ready = function() {
|
|
||||||
WebOSPlay();
|
|
||||||
};
|
|
||||||
this.handleRequest = function(dataId, data, callback) {
|
|
||||||
if (dataId == 'init') {
|
|
||||||
callback({
|
|
||||||
type: 'pages',
|
|
||||||
headline: 'WebOS Player',
|
|
||||||
pages: [{
|
|
||||||
items: [{
|
|
||||||
type: 'default',
|
|
||||||
layout: '0,0,12,6',
|
|
||||||
color: 'msx-glass',
|
|
||||||
text: 'Opening webOS Media Player...'
|
|
||||||
}]
|
|
||||||
}]
|
|
||||||
});
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
window.onload = function() {
|
|
||||||
TVXInteractionPlugin.setupHandler(new WebOSHandler());
|
|
||||||
TVXInteractionPlugin.init();
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -55,12 +55,6 @@ var Msxtizenjs []byte
|
|||||||
//go:embed pages/msx/tvx-plugin.min.js
|
//go:embed pages/msx/tvx-plugin.min.js
|
||||||
var Msxtvxpluginminjs []byte
|
var Msxtvxpluginminjs []byte
|
||||||
|
|
||||||
//go:embed pages/msx/webOSTV-1.2.4.js
|
|
||||||
var MsxwebOSTV124js []byte
|
|
||||||
|
|
||||||
//go:embed pages/msx/webos.html
|
|
||||||
var Msxweboshtml []byte
|
|
||||||
|
|
||||||
//go:embed pages/site.webmanifest
|
//go:embed pages/site.webmanifest
|
||||||
var Sitewebmanifest []byte
|
var Sitewebmanifest []byte
|
||||||
|
|
||||||
|
|||||||
@@ -77,14 +77,6 @@ func RouteWebPages(route *gin.RouterGroup) {
|
|||||||
c.Data(200, "application/javascript", Msxtvxpluginminjs)
|
c.Data(200, "application/javascript", Msxtvxpluginminjs)
|
||||||
})
|
})
|
||||||
|
|
||||||
route.GET("/msx/webOSTV-1.2.4.js", func(c *gin.Context) {
|
|
||||||
c.Data(200, "application/javascript", MsxwebOSTV124js)
|
|
||||||
})
|
|
||||||
|
|
||||||
route.GET("/msx/webos.html", func(c *gin.Context) {
|
|
||||||
c.Data(200, "text/html; charset=utf-8", Msxweboshtml)
|
|
||||||
})
|
|
||||||
|
|
||||||
route.GET("/site.webmanifest", func(c *gin.Context) {
|
route.GET("/site.webmanifest", func(c *gin.Context) {
|
||||||
c.Data(200, "application/manifest+json", Sitewebmanifest)
|
c.Data(200, "application/manifest+json", Sitewebmanifest)
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user