diff --git a/src/server/web/pages/template/html/api.js b/src/server/web/pages/template/html/api.js index dd658bb..02d5637 100644 --- a/src/server/web/pages/template/html/api.js +++ b/src/server/web/pages/template/html/api.js @@ -1,75 +1,80 @@ // Torrents -function addTorrent(link, title, poster, save, done, fail){ - torrent("add",link,null,title,poster,save,done,fail); +function addTorrent(link, title, poster, save) { + torrent("add", link, null, title, poster, save, done, fail); } -function getTorrent(hash, done, fail){ - torrent("get",null,hash,null,null,null,done,fail); +function getTorrent(hash, done, fail) { + torrent("get", null, hash, null, null, null, done, fail); } -function remTorrent(hash, done, fail){ - torrent("rem",null,hash,null,null,null,done,fail); +function remTorrent(hash, done, fail) { + torrent("rem", null, hash, null, null, null, done, fail); } -function listTorrent(done, fail){ - torrent("list",null,null,null,null,null,done,fail); +function listTorrent(done, fail) { + torrent("list", null, null, null, null, null, done, fail); } -function dropTorrent(hash, done, fail){ - torrent("drop",null,hash,null,null,null,done,fail); +function dropTorrent(hash, done, fail) { + torrent("drop", null, hash, null, null, null, done, fail); } -function torrent(action, link, hash, title, poster, save, done, fail){ - var req = JSON.stringify({ action:action, link: link, title: title, poster: poster, save_to_db: save}); - $.post('/torrents',req) - .done(function( data ) { +function torrent(action, link, hash, title, poster, save, done, fail) { + + + var req = JSON.stringify({action: action, link: link, title: title, poster: poster, save_to_db: save}); + $.post('/torrents', req) + .done(function (data) { if (done) done(data); }) - .fail(function( data ) { + .fail(function (data) { if (fail) fail(data); }); } + // // Settings -function getSettings(done, fail){ - sendApi("get",null,"/settings",done,fail); +function getSettings(done, fail) { + sendApi("get", null, "/settings", done, fail); } -function setSettings(sets, done, fail){ - sendApi("set",sets,"/settings",done,fail); +function setSettings(sets, done, fail) { + sendApi("set", sets, "/settings", done, fail); } + // // Viewed -function listViewed(done, fail){ - sendApi("list",null,"/viewed",done,fail); +function listViewed(done, fail) { + sendApi("list", null, "/viewed", done, fail); } -function setViewed(hash, index, done, fail){ - var obj = {"hash":hash, "file_index":index}; - sendApi("set",obj,"/viewed",done,fail); +function setViewed(hash, index, done, fail) { + var obj = {"hash": hash, "file_index": index}; + sendApi("set", obj, "/viewed", done, fail); } -function remViewed(hash, index, done, fail){ - var obj = {"hash":hash, "file_index":index}; - sendApi("rem",obj,"/viewed",done,fail); +function remViewed(hash, index, done, fail) { + var obj = {"hash": hash, "file_index": index}; + sendApi("rem", obj, "/viewed", done, fail); } + // -function sendApi(action, obj, path, done, fail){ - if (obj==null) - obj={}; - obj[action]=action; +function sendApi(action, obj, path, done, fail) { + if (obj == null) + obj = {}; + obj[action] = action; var req = JSON.stringify(obj); - $.post(path,req) - .done(function( data ) { + $.post(path, req) + .done(function (data) { if (done) done(data); }) - .fail(function( data ) { + .fail(function (data) { if (fail) fail(data); }); @@ -78,6 +83,6 @@ function sendApi(action, obj, path, done, fail){ function humanizeSize(size) { if (typeof size == 'undefined' || size == 0) return ""; - var i = Math.floor( Math.log(size) / Math.log(1024) ); - return ( size / Math.pow(1024, i) ).toFixed(2) * 1 + ' ' + ['B', 'kB', 'MB', 'GB', 'TB'][i]; + var i = Math.floor(Math.log(size) / Math.log(1024)); + return (size / Math.pow(1024, i)).toFixed(2) * 1 + ' ' + ['B', 'kB', 'MB', 'GB', 'TB'][i]; } \ No newline at end of file diff --git a/src/server/web/pages/template/html/main.html b/src/server/web/pages/template/html/main.html index fab0567..5d79ae1 100644 --- a/src/server/web/pages/template/html/main.html +++ b/src/server/web/pages/template/html/main.html @@ -1,41 +1,155 @@ - + - - - + TorrServer - + + + + + + + + + + - - - - - - - - - - - TorrServer ` + version.Version + ` + +
- - - - + - \ No newline at end of file diff --git a/src/server/web/pages/template/mainPage.go b/src/server/web/pages/template/mainPage.go index e8639f4..7fd53dd 100644 --- a/src/server/web/pages/template/mainPage.go +++ b/src/server/web/pages/template/mainPage.go @@ -1,84 +1,153 @@ package template -import ( - "server/version" -) - func (t *Template) parseMainPage() { t.parsePage("mainPage", mainPage) } const mainPage = ` - - ` + header + ` + + + TorrServer + + + + + + + + + + + + + -

TorrServer ` + version.Version + `

- +
+ + ` - -const tmp = ` - - - - -
-
- - -
-
- - -
-
-
- Плейлист всех торрентов -
-
-

Торренты:

-
-
-
- Настройки - Кэш - -
- -
- - - - - - -`