mirror of
https://github.com/Ernous/TorrServerJellyfin.git
synced 2025-12-19 13:36:09 +05:00
update web and cleanup unused
This commit is contained in:
Binary file not shown.
@@ -1,234 +0,0 @@
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>TorrServer Interaction Plugin</title>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="author" content="damiva" />
|
||||
<script type="text/javascript" src="tvx.js"></script>
|
||||
<script type="text/javascript">
|
||||
/*******************************************/
|
||||
/* TorrServer Interaction Plugin by damiva */
|
||||
/*******************************************/
|
||||
var ADR = window.location.origin, VRS = "", TZN = false;
|
||||
function TAU(n){
|
||||
var x = [
|
||||
["3g2","3gp","aaf","asf","avchd","avi","drc","flv","m2ts","ts","m2v","m4p","m4v","mkv","mng","mov","mp2","mp4","mpe","mpeg","mpg","mpv","mxf","nsv","ogg","ogv","qt","rm","rmvb","roq","svi",".vob","webm","wmv","yuv"],
|
||||
["aac","aiff","ape","au","flac","gsm","it","m3u","m4a","mid","mod","mp3","mpa","pls","ra","s3m","sid","wav","wma","xm"]
|
||||
];
|
||||
var i = n.lastIndexOf(".");
|
||||
if(i >= 0){
|
||||
n = n.substr(i + 1);
|
||||
for(var e = 0; e < x.length; e++) if(x[e].indexOf(n) >= 0) return e;
|
||||
}
|
||||
return -1
|
||||
}
|
||||
function LNG(s){
|
||||
var i = s == 0 ? 0 : Math.floor(Math.log(s) / Math.log(1024));
|
||||
return (s / Math.pow(1024, i)).toFixed(2) * 1 + ' ' + ['B', 'kB', 'MB', 'GB', 'TB'][i];
|
||||
}
|
||||
function PRS(t){
|
||||
return "{ico:msx-white:north} " + (t.active_peers || 0) + " ⋅ " + (t.pending_peers || 0) + " / " + (t.total_peers || 0);
|
||||
}
|
||||
function STR(i, c){
|
||||
var v = TVXServices.storage.getBool(i, false);
|
||||
if(c) TVXServices.storage.set(i, v = !v);
|
||||
return v;
|
||||
}
|
||||
function AJX(u, d, o, e){
|
||||
console.log(u);
|
||||
if(typeof d != "object") TVXServices.ajax.get(ADR + u, {success: o, error: e}, {dataType: d ? "json" : "text"});
|
||||
else TVXServices.ajax.post(ADR + u, JSON.stringify(d), {success: o, error: e || TVXInteractionPlugin.error}, {dataType: e ? "json" : "text"});
|
||||
}
|
||||
function OPS(){
|
||||
var k = ["red", "green", "yellow"],
|
||||
r = {caption: "{dic:caption:options|Options}:", template: {enumerate: false, type: "control", layout: "0,0,8,1"}, items: []};
|
||||
r.headline = r.caption;
|
||||
for(var i = 0; i < 3; i++){
|
||||
var a = arguments[i];
|
||||
if(a){
|
||||
a.key = k[i];
|
||||
a.icon = "msx-" + a.key + ":stop";
|
||||
r.items.push(a);
|
||||
r.caption += "{tb}{ico:" + a.icon + "} " + a.label;
|
||||
}
|
||||
}
|
||||
r.items.push(
|
||||
{icon: "msx-blue:menu", label: "{dic:caption:menu|Menu}", action: "[cleanup|menu]"},
|
||||
{icon: "format-size", label: arguments[3] ? "{dic:lfont|Larger font size}" : "{dic:sfont|Smaller font size}", action: "[cleanup|interaction:commit:message:compress|reload:content]"}
|
||||
)
|
||||
if(arguments[4] !== undefined) r.items.push({icon: "translate", label: arguments[4] ? "Switch to English" : "Перевести на русский", action: "[interaction:commit:message:russian|reload]"});
|
||||
return r;
|
||||
}
|
||||
function TDB(d, c, r){return {
|
||||
type: "list", reuse: false, cache: false, restore: false, compress: c, headline: "TorrServer", extension: VRS,
|
||||
template: {
|
||||
imageWidth: 1.3, imageFiller: "height", icon: "msx-glass:bolt", layout: c ? "0,0,8,2" : "0,0,6,2", options: OPS(
|
||||
{label: "{dic:rem|Remove}", action: "[cleanup|interaction:commit:message:rem]", data: "{context:id}"},
|
||||
{label: "{dic:drop|Drop}", action: "[cleanup|interaction:commit:message:drop]", data: "{context:id}"},
|
||||
{label: "{dic:refresh|Refresh}", action: "[cleanup|reload:content]"},
|
||||
c, r
|
||||
)
|
||||
},
|
||||
items: d.map(function(t){return {
|
||||
id: t.hash,
|
||||
headline: t.title,
|
||||
image: t.poster || null,
|
||||
titleFooter: "{ico:msx-white:attach-file} " + LNG(t.torrent_size),
|
||||
stamp: t.stat < 5 ? PRS(t) : null,
|
||||
stampColor: t.stat == 4 ? "msx-red" : t.stat == 3 ? "msx-green" : "msx-yellow",
|
||||
action: "content:request:interaction:" + t.hash + "@" + window.location.href
|
||||
}})
|
||||
}}
|
||||
function TFS(d, c){
|
||||
var fs = [], is = [], sf = TVXServices.storage.getBool("folders", false);
|
||||
d.file_stats.forEach(function(f){
|
||||
var a = TAU(f.path);
|
||||
if(a >= 0){
|
||||
var b = f.path.indexOf("/"),
|
||||
e = f.path.lastIndexOf("/"),
|
||||
p = b < e && e > 0 ? f.path.substr(b + 1, e - b - 1) : ""
|
||||
i = d.hash + "-" + f.id,
|
||||
u = ADR + "/play/" + d.hash + "/" + f.id;
|
||||
if(p && (fs.length == 0 || fs[fs.length - 1].label != p)){
|
||||
fs.push({label: p, action: "[cleanup|focus:" + i + "]"});
|
||||
if(sf) is.push({type: "space", label: "{col:msx-yellow}{ico:folder} " + p});
|
||||
}
|
||||
is.push({
|
||||
id: i,
|
||||
label: f.path.substr(e + 1),
|
||||
extensionLabel: LNG(f.length),
|
||||
folder: p ? ("{ico:msx-yellow:folder} " + p + "{br}") : "",
|
||||
icon: "msx-white-soft:" + (a ? "audiotrack" : "movie"),
|
||||
group: a ? "{dic:label:audio|Audio}" : "{dic:label:video|Video}",
|
||||
action: (a ? "audio:" : "video:") + (a || TZN ? u : ("plugin:" + window.location.origin + "/msx/html5x?url=" + encodeURIComponent(u)))
|
||||
});
|
||||
}
|
||||
});
|
||||
return {
|
||||
type: "list", compress: c, items: is,
|
||||
extension: "{ico:msx-white:attach-file} " + LNG(d.torrent_size), headline: d.title,
|
||||
options: OPS(
|
||||
{label: "{dic:continue|Continue}", action: "[cleanup|interaction:commit:message:continue]", data: d.hash},
|
||||
fs.length > 1 ? {label: "{dic:folder|Select folder}", action: "panel:data", data: {
|
||||
type: "list", compress: true, headline: "{dic:folder|Go to folder}:", items: fs,
|
||||
template: {type: "control", icon: "msx-yellow:folder", layout: "0,0,10,1"},
|
||||
}} : null,
|
||||
fs.length > 0 ? {label: STR("folders") ? "{dic:hfolders|Hide folders}" : "{dic:sfolders|Show folders}", action: "[cleanup|interaction:commit:message:folders|reload:content]"} : null,
|
||||
c
|
||||
),
|
||||
template: {type: "control", layout: c ? "0,0,16,1" : "0,0,12,1", progress: -1, playerLabel: d.title,
|
||||
live: {type: "playback", action: "player:show"}, properties: {
|
||||
"info:text": "{context:folder}{ico:msx-green:play-arrow} {context:label}",
|
||||
"info:image": d.poster || "default",
|
||||
"control:type": "extended",
|
||||
"resume:key": "id",
|
||||
"trigger:complete": "[player:auto:next|resume:cancel]",
|
||||
"trigger:player": "interaction:commit:message:" + d.hash
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
function PLG(){
|
||||
var W = new TVXBusyService(), S = "";
|
||||
this.ready = function(){
|
||||
ADR = TVXServices.urlParams.getFullStr("addr", ADR);
|
||||
if(TVXServices.urlParams.has("link")){
|
||||
TVXServices.urlParams.remove("addr");
|
||||
S = TVXServices.urlParams.build(true, "&");
|
||||
}
|
||||
W.start();
|
||||
TVXInteractionPlugin.onValidatedSettings(function(){
|
||||
console.log(TVXSettings);
|
||||
TZN = TVXSettings.PLATFORM == "tizen";
|
||||
AJX("/echo", false, function(v){VRS = v; W.stop()}, function(){W.stop()});
|
||||
});
|
||||
};
|
||||
this.handleEvent = function(d){
|
||||
if(d.event == "video:load"){
|
||||
switch(d.info.type){
|
||||
case "video":
|
||||
TVXInteractionPlugin.executeAction("player:button:content:setup", {
|
||||
icon: "build",
|
||||
action: TZN ? ("content:request:interaction:init@" + window.location.origin + "/msx/tizen") : "panel:request:player:options"
|
||||
});
|
||||
break;
|
||||
case "audio":
|
||||
TVXInteractionPlugin.executeAction("interaction:commit:message:background", true);
|
||||
}
|
||||
TVXInteractionPlugin.executeAction("interaction:commit:message:" + d.info.id.split("-")[0]);
|
||||
}
|
||||
};
|
||||
this.handleRequest = function(i, _, f){W.onReady(function(){
|
||||
var e = function(m){TVXInteractionPlugin.error(m); f();},
|
||||
c = STR("compress"),
|
||||
r = STR("russian");
|
||||
switch(i){
|
||||
case "init":
|
||||
f({
|
||||
name: "TorrServer Plugin",
|
||||
version: "0.0.1",
|
||||
reference: "request:interaction:db@" + window.location.href,
|
||||
dictionary: r ? (window.location.origin + "/msx/russian.json") : null
|
||||
});
|
||||
break;
|
||||
case "sdb": r = undefined;
|
||||
case "db":
|
||||
AJX("/torrents", {action: "list"}, function(d){f(TDB(d, c, r))}, e);
|
||||
break;
|
||||
default:
|
||||
AJX("/stream/?stat&" + (S || ("link=" + i)), true, function(d){f(TFS(d, c, S && S.indexOf("&save_to_db") < 0))}, e);
|
||||
}
|
||||
})};
|
||||
this.handleData = function(d){
|
||||
var r = function(){TVXInteractionPlugin.executeAction("reload:content")}
|
||||
switch(d.message){
|
||||
case "rem":
|
||||
case "drop":
|
||||
AJX("/torrents", {action: d.message, hash: d.data}, r);
|
||||
break;
|
||||
case "compress":
|
||||
case "folders":
|
||||
case "russian":
|
||||
STR(d.message, true);
|
||||
break;
|
||||
case "background":
|
||||
var b = STR(d.message, !d.data);
|
||||
TVXInteractionPlugin.executeAction("player:button:content:setup", {
|
||||
icon: (b ? "hide-" : "") + "image",
|
||||
action: "interaction:commit:message:" + d.message
|
||||
});
|
||||
TVXInteractionPlugin.executeAction("player:background:" + (b
|
||||
? ("https://source.unsplash.com/random/" + TVXSettings.WIDTH + "x" + TVXSettings.HEIGHT + "/?ts=" + TVXDateTools.getTimestamp())
|
||||
: "none"
|
||||
));
|
||||
break;
|
||||
case "continue":
|
||||
AJX(
|
||||
"/viewed",
|
||||
{action: "list", hash: d.data},
|
||||
function(v){
|
||||
var l = 1;
|
||||
v.forEach(function(i){if(i.file_index > l) l = i.file_index});
|
||||
TVXInteractionPlugin.executeAction("focus:" + d.data + "-" + l);
|
||||
},
|
||||
function(){TVXInteractionPlugin.executeAction("focus:" + d.data + "-" + l)}
|
||||
);
|
||||
break;
|
||||
default:
|
||||
if(d.message) AJX("/cache", {action: "get", hash: d.message}, function(v){
|
||||
TVXInteractionPlugin.executeAction("player:label:position:{VALUE}{tb}{tb}" + PRS(v.Torrent));
|
||||
}, function(){});
|
||||
}
|
||||
};
|
||||
}
|
||||
TVXPluginTools.onReady(function() {
|
||||
TVXInteractionPlugin.setupHandler(new PLG());
|
||||
TVXInteractionPlugin.init();
|
||||
});
|
||||
/*******************************************/
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
||||
Binary file not shown.
@@ -118,20 +118,20 @@ var Mstile150x150png []byte
|
||||
//go:embed pages/site.webmanifest
|
||||
var Sitewebmanifest []byte
|
||||
|
||||
//go:embed pages/static/js/2.d3f8d41d.chunk.js
|
||||
var Staticjs2d3f8d41dchunkjs []byte
|
||||
//go:embed pages/static/js/2.37254ee1.chunk.js
|
||||
var Staticjs237254ee1chunkjs []byte
|
||||
|
||||
//go:embed pages/static/js/2.d3f8d41d.chunk.js.LICENSE.txt
|
||||
var Staticjs2d3f8d41dchunkjsLICENSEtxt []byte
|
||||
//go:embed pages/static/js/2.37254ee1.chunk.js.LICENSE.txt
|
||||
var Staticjs237254ee1chunkjsLICENSEtxt []byte
|
||||
|
||||
//go:embed pages/static/js/2.d3f8d41d.chunk.js.map
|
||||
var Staticjs2d3f8d41dchunkjsmap []byte
|
||||
//go:embed pages/static/js/2.37254ee1.chunk.js.map
|
||||
var Staticjs237254ee1chunkjsmap []byte
|
||||
|
||||
//go:embed pages/static/js/main.e240e160.chunk.js
|
||||
var Staticjsmaine240e160chunkjs []byte
|
||||
//go:embed pages/static/js/main.5200a107.chunk.js
|
||||
var Staticjsmain5200a107chunkjs []byte
|
||||
|
||||
//go:embed pages/static/js/main.e240e160.chunk.js.map
|
||||
var Staticjsmaine240e160chunkjsmap []byte
|
||||
//go:embed pages/static/js/main.5200a107.chunk.js.map
|
||||
var Staticjsmain5200a107chunkjsmap []byte
|
||||
|
||||
//go:embed pages/static/js/runtime-main.64d07802.js
|
||||
var Staticjsruntimemain64d07802js []byte
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
{
|
||||
"files": {
|
||||
"main.js": "/static/js/main.e240e160.chunk.js",
|
||||
"main.js.map": "/static/js/main.e240e160.chunk.js.map",
|
||||
"main.js": "/static/js/main.5200a107.chunk.js",
|
||||
"main.js.map": "/static/js/main.5200a107.chunk.js.map",
|
||||
"runtime-main.js": "/static/js/runtime-main.64d07802.js",
|
||||
"runtime-main.js.map": "/static/js/runtime-main.64d07802.js.map",
|
||||
"static/js/2.d3f8d41d.chunk.js": "/static/js/2.d3f8d41d.chunk.js",
|
||||
"static/js/2.d3f8d41d.chunk.js.map": "/static/js/2.d3f8d41d.chunk.js.map",
|
||||
"static/js/2.37254ee1.chunk.js": "/static/js/2.37254ee1.chunk.js",
|
||||
"static/js/2.37254ee1.chunk.js.map": "/static/js/2.37254ee1.chunk.js.map",
|
||||
"index.html": "/index.html",
|
||||
"static/js/2.d3f8d41d.chunk.js.LICENSE.txt": "/static/js/2.d3f8d41d.chunk.js.LICENSE.txt"
|
||||
"static/js/2.37254ee1.chunk.js.LICENSE.txt": "/static/js/2.37254ee1.chunk.js.LICENSE.txt"
|
||||
},
|
||||
"entrypoints": [
|
||||
"static/js/runtime-main.64d07802.js",
|
||||
"static/js/2.d3f8d41d.chunk.js",
|
||||
"static/js/main.e240e160.chunk.js"
|
||||
"static/js/2.37254ee1.chunk.js",
|
||||
"static/js/main.5200a107.chunk.js"
|
||||
]
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -161,24 +161,24 @@ func RouteWebPages(route *gin.RouterGroup) {
|
||||
c.Data(200, "application/manifest+json", Sitewebmanifest)
|
||||
})
|
||||
|
||||
route.GET("/static/js/2.d3f8d41d.chunk.js", func(c *gin.Context) {
|
||||
c.Data(200, "application/javascript; charset=utf-8", Staticjs2d3f8d41dchunkjs)
|
||||
route.GET("/static/js/2.37254ee1.chunk.js", func(c *gin.Context) {
|
||||
c.Data(200, "application/javascript; charset=utf-8", Staticjs237254ee1chunkjs)
|
||||
})
|
||||
|
||||
route.GET("/static/js/2.d3f8d41d.chunk.js.LICENSE.txt", func(c *gin.Context) {
|
||||
c.Data(200, "text/plain; charset=utf-8", Staticjs2d3f8d41dchunkjsLICENSEtxt)
|
||||
route.GET("/static/js/2.37254ee1.chunk.js.LICENSE.txt", func(c *gin.Context) {
|
||||
c.Data(200, "text/plain; charset=utf-8", Staticjs237254ee1chunkjsLICENSEtxt)
|
||||
})
|
||||
|
||||
route.GET("/static/js/2.d3f8d41d.chunk.js.map", func(c *gin.Context) {
|
||||
c.Data(200, "application/json", Staticjs2d3f8d41dchunkjsmap)
|
||||
route.GET("/static/js/2.37254ee1.chunk.js.map", func(c *gin.Context) {
|
||||
c.Data(200, "application/json", Staticjs237254ee1chunkjsmap)
|
||||
})
|
||||
|
||||
route.GET("/static/js/main.e240e160.chunk.js", func(c *gin.Context) {
|
||||
c.Data(200, "application/javascript; charset=utf-8", Staticjsmaine240e160chunkjs)
|
||||
route.GET("/static/js/main.5200a107.chunk.js", func(c *gin.Context) {
|
||||
c.Data(200, "application/javascript; charset=utf-8", Staticjsmain5200a107chunkjs)
|
||||
})
|
||||
|
||||
route.GET("/static/js/main.e240e160.chunk.js.map", func(c *gin.Context) {
|
||||
c.Data(200, "application/json", Staticjsmaine240e160chunkjsmap)
|
||||
route.GET("/static/js/main.5200a107.chunk.js.map", func(c *gin.Context) {
|
||||
c.Data(200, "application/json", Staticjsmain5200a107chunkjsmap)
|
||||
})
|
||||
|
||||
route.GET("/static/js/runtime-main.64d07802.js", func(c *gin.Context) {
|
||||
|
||||
Reference in New Issue
Block a user