lots...
This commit is contained in:
445
public/img/Transmission_Icon.svg
Normal file
445
public/img/Transmission_Icon.svg
Normal file
@ -0,0 +1,445 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="48px"
|
||||
height="48px"
|
||||
id="svg5186"
|
||||
sodipodi:version="0.32"
|
||||
inkscape:version="0.45+devel"
|
||||
sodipodi:docname="transmission.svg"
|
||||
inkscape:output_extension="org.inkscape.output.svg.inkscape"
|
||||
inkscape:export-filename="/home/andreas/project/application icons/48x48/transmission.png"
|
||||
inkscape:export-xdpi="90"
|
||||
inkscape:export-ydpi="90">
|
||||
<defs
|
||||
id="defs5188">
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
id="linearGradient9795">
|
||||
<stop
|
||||
style="stop-color:#ffffff;stop-opacity:1;"
|
||||
offset="0"
|
||||
id="stop9797" />
|
||||
<stop
|
||||
style="stop-color:#ffffff;stop-opacity:0;"
|
||||
offset="1"
|
||||
id="stop9799" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
id="linearGradient9783">
|
||||
<stop
|
||||
style="stop-color:#000000;stop-opacity:1;"
|
||||
offset="0"
|
||||
id="stop9785" />
|
||||
<stop
|
||||
style="stop-color:#000000;stop-opacity:0;"
|
||||
offset="1"
|
||||
id="stop9787" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
id="linearGradient9775">
|
||||
<stop
|
||||
style="stop-color:#f9f9f9;stop-opacity:1"
|
||||
offset="0"
|
||||
id="stop9777" />
|
||||
<stop
|
||||
style="stop-color:#eeeeec;stop-opacity:0.62037037"
|
||||
offset="1"
|
||||
id="stop9779" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
id="linearGradient5948">
|
||||
<stop
|
||||
style="stop-color:#787b76;stop-opacity:1;"
|
||||
offset="0"
|
||||
id="stop5950" />
|
||||
<stop
|
||||
id="stop5956"
|
||||
offset="0.87125719"
|
||||
style="stop-color:#babcb9;stop-opacity:1" />
|
||||
<stop
|
||||
style="stop-color:#787b76;stop-opacity:1"
|
||||
offset="1"
|
||||
id="stop5952" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
id="linearGradient5908">
|
||||
<stop
|
||||
style="stop-color:#ffffff;stop-opacity:1;"
|
||||
offset="0"
|
||||
id="stop5910" />
|
||||
<stop
|
||||
style="stop-color:#ffffff;stop-opacity:0;"
|
||||
offset="1"
|
||||
id="stop5912" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
id="linearGradient5898">
|
||||
<stop
|
||||
style="stop-color:#cc0000;stop-opacity:1;"
|
||||
offset="0"
|
||||
id="stop5900" />
|
||||
<stop
|
||||
id="stop5906"
|
||||
offset="0.36509839"
|
||||
style="stop-color:#ef0000;stop-opacity:1" />
|
||||
<stop
|
||||
style="stop-color:#aa0000;stop-opacity:1"
|
||||
offset="1"
|
||||
id="stop5902" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
id="linearGradient5871">
|
||||
<stop
|
||||
style="stop-color:#f0f2ef;stop-opacity:1"
|
||||
offset="0"
|
||||
id="stop5873" />
|
||||
<stop
|
||||
style="stop-color:#cdd1c8;stop-opacity:1"
|
||||
offset="1"
|
||||
id="stop5875" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
id="linearGradient5843">
|
||||
<stop
|
||||
style="stop-color:#888a85;stop-opacity:1"
|
||||
offset="0"
|
||||
id="stop5845" />
|
||||
<stop
|
||||
style="stop-color:#2e3436;stop-opacity:1"
|
||||
offset="1"
|
||||
id="stop5847" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
id="linearGradient5835">
|
||||
<stop
|
||||
style="stop-color:#555753;stop-opacity:1;"
|
||||
offset="0"
|
||||
id="stop5837" />
|
||||
<stop
|
||||
style="stop-color:#2e3436;stop-opacity:1"
|
||||
offset="1"
|
||||
id="stop5839" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
id="linearGradient5823">
|
||||
<stop
|
||||
style="stop-color:#2e3436;stop-opacity:1;"
|
||||
offset="0"
|
||||
id="stop5825" />
|
||||
<stop
|
||||
style="stop-color:#2e3436;stop-opacity:0;"
|
||||
offset="1"
|
||||
id="stop5827" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
id="linearGradient5234">
|
||||
<stop
|
||||
style="stop-color:#babdb6;stop-opacity:1;"
|
||||
offset="0"
|
||||
id="stop5236" />
|
||||
<stop
|
||||
id="stop5242"
|
||||
offset="0.13299191"
|
||||
style="stop-color:#eeeeec;stop-opacity:1" />
|
||||
<stop
|
||||
style="stop-color:#babdb6;stop-opacity:1"
|
||||
offset="1"
|
||||
id="stop5238" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient5234"
|
||||
id="linearGradient5240"
|
||||
x1="23.738585"
|
||||
y1="4.156569"
|
||||
x2="23.738585"
|
||||
y2="19.46567"
|
||||
gradientUnits="userSpaceOnUse" />
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient5823"
|
||||
id="linearGradient5829"
|
||||
x1="23.732271"
|
||||
y1="30.057167"
|
||||
x2="23.688078"
|
||||
y2="22.632544"
|
||||
gradientUnits="userSpaceOnUse" />
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient5835"
|
||||
id="linearGradient5841"
|
||||
x1="23.9375"
|
||||
y1="30.616879"
|
||||
x2="23.9375"
|
||||
y2="36.357994"
|
||||
gradientUnits="userSpaceOnUse" />
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient5843"
|
||||
id="linearGradient5849"
|
||||
x1="20.771132"
|
||||
y1="32.248005"
|
||||
x2="20.563131"
|
||||
y2="23.939499"
|
||||
gradientUnits="userSpaceOnUse" />
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient5898"
|
||||
id="linearGradient5904"
|
||||
x1="14.8125"
|
||||
y1="5.6244211"
|
||||
x2="14.8125"
|
||||
y2="9"
|
||||
gradientUnits="userSpaceOnUse" />
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient5908"
|
||||
id="linearGradient5914"
|
||||
x1="24.040522"
|
||||
y1="5.0690055"
|
||||
x2="24.040522"
|
||||
y2="10.0086"
|
||||
gradientUnits="userSpaceOnUse" />
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient5871"
|
||||
id="linearGradient5928"
|
||||
x1="13.625"
|
||||
y1="33.125"
|
||||
x2="14.125"
|
||||
y2="24"
|
||||
gradientUnits="userSpaceOnUse" />
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient5948"
|
||||
id="linearGradient5954"
|
||||
x1="10.1875"
|
||||
y1="20.25"
|
||||
x2="10.1875"
|
||||
y2="42.5"
|
||||
gradientUnits="userSpaceOnUse" />
|
||||
<filter
|
||||
inkscape:collect="always"
|
||||
id="filter9771"
|
||||
x="-0.02976581"
|
||||
width="1.0595316"
|
||||
y="-0.13995509"
|
||||
height="1.2799102">
|
||||
<feGaussianBlur
|
||||
inkscape:collect="always"
|
||||
stdDeviation="0.5196773"
|
||||
id="feGaussianBlur9773" />
|
||||
</filter>
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient9775"
|
||||
id="linearGradient9781"
|
||||
x1="24.71875"
|
||||
y1="35.958694"
|
||||
x2="23.936657"
|
||||
y2="17.070877"
|
||||
gradientUnits="userSpaceOnUse" />
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient9783"
|
||||
id="linearGradient9789"
|
||||
x1="18.3125"
|
||||
y1="20.743757"
|
||||
x2="18.3125"
|
||||
y2="21.814325"
|
||||
gradientUnits="userSpaceOnUse" />
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient9795"
|
||||
id="linearGradient9801"
|
||||
x1="30.4375"
|
||||
y1="31.82852"
|
||||
x2="29.742416"
|
||||
y2="27.45352"
|
||||
gradientUnits="userSpaceOnUse" />
|
||||
</defs>
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="5.6568542"
|
||||
inkscape:cx="30.372474"
|
||||
inkscape:cy="21.423534"
|
||||
inkscape:current-layer="layer1"
|
||||
showgrid="true"
|
||||
inkscape:grid-bbox="true"
|
||||
inkscape:document-units="px"
|
||||
inkscape:window-width="1091"
|
||||
inkscape:window-height="777"
|
||||
inkscape:window-x="557"
|
||||
inkscape:window-y="164">
|
||||
<inkscape:grid
|
||||
type="xygrid"
|
||||
id="grid5195" />
|
||||
</sodipodi:namedview>
|
||||
<metadata
|
||||
id="metadata5191">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
id="layer1"
|
||||
inkscape:label="Layer 1"
|
||||
inkscape:groupmode="layer">
|
||||
<rect
|
||||
style="opacity:0.28240741;fill:#2e3436;fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;filter:url(#filter9771)"
|
||||
id="rect9761"
|
||||
width="41.901279"
|
||||
height="8.9116125"
|
||||
x="3"
|
||||
y="39"
|
||||
rx="2.2980971"
|
||||
ry="2.2980971" />
|
||||
<path
|
||||
style="fill:url(#linearGradient5954);fill-rule:evenodd;stroke:#555753;stroke-width:1.00000011999999994px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;fill-opacity:1"
|
||||
d="M 10,16.59375 C 8.8196081,16.548814 7.6402135,17.571722 7.53125,18.8125 C 6.643292,26.100083 5.3269606,33.403527 4.65625,40.6875 L 4.65625,43.75 C 4.6900093,45.329492 5.7271791,46.392039 6.875,46.59375 L 41.5,46.59375 C 42.479024,46.569246 43.565009,45.89005 43.53125,44.59375 L 43.53125,40.65625 L 40.40625,19.4375 C 40.152431,18.135677 39.039534,16.752716 37.5,16.59375 L 10,16.59375 z"
|
||||
id="path5232"
|
||||
sodipodi:nodetypes="ccccccccccc" />
|
||||
<path
|
||||
style="fill:url(#linearGradient5928);fill-opacity:1;fill-rule:evenodd;stroke:#555753;stroke-width:0.99999994000000003px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||
d="M 10.601853,39.624614 C 9.47224,39.502143 8.6733861,38.760954 8.7014295,37.401046 L 10.601853,21.407733 C 10.893931,20.339398 11.586949,19.485349 12.680909,19.488442 L 34.605501,19.488442 C 35.691818,19.455762 36.778134,20.208796 37.062569,21.104687 L 39.478435,37.237611 C 39.535481,38.706714 38.931012,39.557098 37.913093,39.523599 L 10.601853,39.624614 z"
|
||||
id="path5230"
|
||||
sodipodi:nodetypes="ccccccccc" />
|
||||
<path
|
||||
style="fill:url(#linearGradient5841);fill-rule:evenodd;stroke:url(#linearGradient5849);stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;fill-opacity:1"
|
||||
d="M 20.46875,20.4375 L 18.40625,32.46875 L 15.4375,32.46875 L 23.46875,37.625 L 32.4375,32.46875 L 29.46875,32.46875 L 27.59375,20.4375 L 20.46875,20.4375 z"
|
||||
id="path5197"
|
||||
sodipodi:nodetypes="cccccccc" />
|
||||
<rect
|
||||
style="opacity:1;fill:url(#linearGradient5904);fill-opacity:1;stroke:#930000;stroke-width:1.00000011999999994;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
|
||||
id="rect5224"
|
||||
width="31.113209"
|
||||
height="6.0609155"
|
||||
x="8.4847708"
|
||||
y="4.5135489"
|
||||
rx="5.0159144"
|
||||
ry="1.9854566" />
|
||||
<rect
|
||||
style="opacity:0.58333333;fill:none;fill-opacity:1;stroke:url(#linearGradient5914);stroke-width:1.00000011999999994;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
|
||||
id="rect5896"
|
||||
width="29.080278"
|
||||
height="3.9395947"
|
||||
x="9.5003824"
|
||||
y="5.5690055"
|
||||
rx="1.8339339"
|
||||
ry="1.2783499" />
|
||||
<path
|
||||
style="opacity:0.24537036000000001;fill:none;fill-opacity:1;fill-rule:evenodd;stroke:url(#linearGradient9781);stroke-width:1.00000011999999994px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||
d="M 10.592965,17.57221 C 9.474152,17.53019 8.3562869,18.486727 8.2530054,19.647002 L 5.4687498,39.722803 C 5.4796612,39.847886 5.4997885,39.979699 5.5279893,40.102694 L 5.5279893,42.966491 C 5.559989,44.443503 6.5430497,45.407885 7.6309909,45.596509 L 40.479283,45.596509 C 41.407232,45.573597 42.406944,44.967688 42.374947,43.755497 L 42.374947,40.073472 C 42.382229,40.044972 42.398547,40.013922 42.404566,39.985805 L 42.374947,39.781247 L 42.374947,39.576691 L 42.345327,39.576691 L 39.442592,20.202228 C 39.202015,18.98487 38.147175,17.72086 36.687956,17.57221 L 10.592965,17.57221 z"
|
||||
id="path5881" />
|
||||
<path
|
||||
style="fill:url(#linearGradient9789);fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;fill-opacity:1;opacity:0.20833333000000001"
|
||||
d="M 10.210155,29.955767 L 12.048004,22 L 36.07815,22.05802 L 37.857941,31.044156 L 36.681164,21.969631 C 36.460193,20.967897 35.929863,20 34.957591,20.025088 L 13.037281,19.980893 C 11.606886,19.936699 11.32554,20.864777 11,21.969631 L 10.210155,29.955767 z"
|
||||
id="path5926"
|
||||
sodipodi:nodetypes="ccccccccc" />
|
||||
<rect
|
||||
style="opacity:1;fill:url(#linearGradient5240);fill-opacity:1;stroke:#888a85;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
|
||||
id="rect5226"
|
||||
width="7.0964494"
|
||||
height="25.970053"
|
||||
x="20.48369"
|
||||
y="3.6044116"
|
||||
rx="1.0763195"
|
||||
ry="1.0763192" />
|
||||
<rect
|
||||
style="opacity:1;fill:url(#linearGradient5829);fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
|
||||
id="rect5244"
|
||||
width="8.1317272"
|
||||
height="8.0433397"
|
||||
x="19.975765"
|
||||
y="22.013826"
|
||||
rx="1.0763195"
|
||||
ry="1.0763192" />
|
||||
<path
|
||||
style="opacity:0.43518521;fill:none;fill-rule:evenodd;stroke:#ffffff;stroke-width:1px;stroke-linecap:round;stroke-linejoin:miter;stroke-opacity:1"
|
||||
d="M 11.423372,41.486321 L 39.533811,41.486321"
|
||||
id="path5879"
|
||||
sodipodi:nodetypes="cc" />
|
||||
<rect
|
||||
style="opacity:0.22685185;fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
|
||||
id="rect5892"
|
||||
width="5.151906"
|
||||
height="23.93712"
|
||||
x="21.428234"
|
||||
y="4.6321397"
|
||||
rx="1.0763195"
|
||||
ry="1.0763192" />
|
||||
<g
|
||||
id="g5972"
|
||||
style="opacity:0.62037037">
|
||||
<path
|
||||
sodipodi:nodetypes="cc"
|
||||
id="path5831"
|
||||
d="M 20.4375,30.5 L 27.5,30.5"
|
||||
style="fill:none;fill-rule:evenodd;stroke:#888a85;stroke-width:1px;stroke-linecap:round;stroke-linejoin:miter;stroke-opacity:1;opacity:1" />
|
||||
<path
|
||||
sodipodi:nodetypes="cc"
|
||||
id="path5833"
|
||||
d="M 19.960998,32.5 L 27.976504,32.5"
|
||||
style="fill:none;fill-rule:evenodd;stroke:#888a85;stroke-width:1px;stroke-linecap:round;stroke-linejoin:miter;stroke-opacity:1;opacity:0.68055556" />
|
||||
<path
|
||||
sodipodi:nodetypes="cc"
|
||||
id="path5958"
|
||||
d="M 20.273498,31.5 L 27.726504,31.5"
|
||||
style="fill:none;fill-rule:evenodd;stroke:#5d5d5c;stroke-width:1px;stroke-linecap:round;stroke-linejoin:miter;stroke-opacity:1;opacity:1" />
|
||||
<path
|
||||
sodipodi:nodetypes="cc"
|
||||
id="path5960"
|
||||
d="M 19.869986,33.488738 L 28.141277,33.488738"
|
||||
style="fill:none;fill-rule:evenodd;stroke:#5d5d5c;stroke-width:0.99999994000000003px;stroke-linecap:round;stroke-linejoin:miter;stroke-opacity:1;opacity:0.68055556" />
|
||||
</g>
|
||||
<path
|
||||
style="fill:none;fill-rule:evenodd;stroke:#ffffff;stroke-width:1px;stroke-linecap:round;stroke-linejoin:miter;stroke-opacity:1"
|
||||
d="M 14.381412,31.513733 L 17.519198,31.513733"
|
||||
id="path9791"
|
||||
sodipodi:nodetypes="cc" />
|
||||
<path
|
||||
style="fill:none;fill-rule:evenodd;stroke:#ffffff;stroke-width:1px;stroke-linecap:round;stroke-linejoin:miter;stroke-opacity:1"
|
||||
d="M 30.443912,31.451233 L 33.581698,31.451233"
|
||||
id="path9803"
|
||||
sodipodi:nodetypes="cc" />
|
||||
<path
|
||||
sodipodi:type="arc"
|
||||
style="opacity:0.33500001;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
|
||||
id="path5119"
|
||||
sodipodi:cx="9.8553009"
|
||||
sodipodi:cy="42.188465"
|
||||
sodipodi:rx="1.1932427"
|
||||
sodipodi:ry="1.0827572"
|
||||
d="M 11.048544,42.188465 A 1.1932427,1.0827572 0 1 1 8.6620582,42.188465 A 1.1932427,1.0827572 0 1 1 11.048544,42.188465 z"
|
||||
transform="matrix(0.4216252,0,0,0.4766032,5.3634688,21.39228)" />
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 16 KiB |
412
public/js/app.js
Normal file
412
public/js/app.js
Normal file
@ -0,0 +1,412 @@
|
||||
var app = {};
|
||||
|
||||
app.pubsub = (function(){
|
||||
app.topics = {};
|
||||
|
||||
app.subscribe = function(topic, listener) {
|
||||
if(topic instanceof RegExp){
|
||||
listener.match = topic;
|
||||
topic = "__REGEX__";
|
||||
}
|
||||
|
||||
// create the topic if not yet created
|
||||
if(!app.topics[topic]) app.topics[topic] = [];
|
||||
|
||||
// add the listener
|
||||
app.topics[topic].push(listener);
|
||||
}
|
||||
|
||||
app.matchTopics = function(topic){
|
||||
topic = topic || '';
|
||||
var matches = [... app.topics[topic] ? app.topics[topic] : []];
|
||||
|
||||
if(!app.topics['__REGEX__']) return matches;
|
||||
|
||||
for(var listener of app.topics['__REGEX__']){
|
||||
if(topic.match(listener.match)) matches.push(listener);
|
||||
}
|
||||
|
||||
return matches;
|
||||
}
|
||||
|
||||
app.publish = function(topic, data) {
|
||||
|
||||
// send the event to all listeners
|
||||
app.matchTopics(topic).forEach(function(listener) {
|
||||
setTimeout(function(data, topic){
|
||||
listener(data || {}, topic);
|
||||
}, 0, data, topic);
|
||||
});
|
||||
}
|
||||
|
||||
return this;
|
||||
})(app);
|
||||
|
||||
app.socket = (function(app){
|
||||
// $.getScript('/socket.io/socket.io.js')
|
||||
// <script type="text/javascript" src="/socket.io/socket.io.js"></script>
|
||||
|
||||
var socket;
|
||||
$(document).ready(function(){
|
||||
socket = io({
|
||||
auth: {
|
||||
token: app.auth.getToken()
|
||||
}
|
||||
});
|
||||
// socket.emit('chat message', $('#m').val());
|
||||
socket.on('P2PSub', function(msg){
|
||||
msg.data.__noSocket = true;
|
||||
app.publish(msg.topic, msg.data);
|
||||
});
|
||||
|
||||
app.subscribe(/./g, function(data, topic){
|
||||
// console.log('local_pubs', data, topic)
|
||||
if(data.__noSocket) return;
|
||||
// console.log('local_pubs 2', data, topic)
|
||||
|
||||
socket.emit('P2PSub', { topic, data })
|
||||
});
|
||||
})
|
||||
|
||||
return socket;
|
||||
|
||||
})(app);
|
||||
|
||||
app.api = (function(app){
|
||||
var baseURL = '/__api/'
|
||||
|
||||
function post(url, data, callback){
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: baseURL+url,
|
||||
headers:{
|
||||
'auth-token': app.auth.getToken()
|
||||
},
|
||||
data: JSON.stringify(data),
|
||||
contentType: "application/json; charset=utf-8",
|
||||
dataType: "json",
|
||||
complete: function(res, text){
|
||||
callback(
|
||||
text !== 'success' ? res.statusText : null,
|
||||
JSON.parse(res.responseText),
|
||||
res.status
|
||||
)
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function put(url, data, callback){
|
||||
$.ajax({
|
||||
type: 'PUT',
|
||||
url: baseURL+url,
|
||||
headers:{
|
||||
'auth-token': app.auth.getToken()
|
||||
},
|
||||
data: JSON.stringify(data),
|
||||
contentType: "application/json; charset=utf-8",
|
||||
dataType: "json",
|
||||
complete: function(res, text){
|
||||
callback(
|
||||
text !== 'success' ? res.statusText : null,
|
||||
JSON.parse(res.responseText),
|
||||
res.status
|
||||
)
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function remove(url, callback, callback2){
|
||||
if(!$.isFunction(callback)) callback = callback2;
|
||||
$.ajax({
|
||||
type: 'delete',
|
||||
url: baseURL+url,
|
||||
headers:{
|
||||
'auth-token': app.auth.getToken()
|
||||
},
|
||||
contentType: "application/json; charset=utf-8",
|
||||
dataType: "json",
|
||||
complete: function(res, text){
|
||||
callback(
|
||||
text !== 'success' ? res.statusText : null,
|
||||
JSON.parse(res.responseText),
|
||||
res.status
|
||||
)
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function get(url, callback){
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: baseURL+url,
|
||||
headers:{
|
||||
'auth-token': app.auth.getToken()
|
||||
},
|
||||
contentType: "application/json; charset=utf-8",
|
||||
dataType: "json",
|
||||
complete: function(res, text){
|
||||
callback(
|
||||
text !== 'success' ? res.statusText : null,
|
||||
JSON.parse(res.responseText),
|
||||
res.status
|
||||
)
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return {post: post, get: get, put: put, delete: remove}
|
||||
})(app)
|
||||
|
||||
app.auth = (function(app) {
|
||||
var user = {}
|
||||
function setToken(token){
|
||||
localStorage.setItem('APIToken', token);
|
||||
}
|
||||
|
||||
function getToken(){
|
||||
return localStorage.getItem('APIToken');
|
||||
}
|
||||
|
||||
function isLoggedIn(callback){
|
||||
if(getToken()){
|
||||
return app.api.get('user/me', function(error, data){
|
||||
if(error === 'Unauthorized') logOut();
|
||||
if(!error) app.auth.user = data;
|
||||
return callback(error, data);
|
||||
});
|
||||
}else{
|
||||
callback(null, false);
|
||||
}
|
||||
}
|
||||
|
||||
function logIn(args, callback){
|
||||
app.api.post('auth/login', args, function(error, data){
|
||||
if(data.login){
|
||||
setToken(data.token);
|
||||
}
|
||||
callback(error, !!data.token);
|
||||
});
|
||||
}
|
||||
|
||||
function logOut(callback){
|
||||
callback = callback || app.util.emptyFuction;
|
||||
localStorage.removeItem('APIToken');
|
||||
callback();
|
||||
}
|
||||
|
||||
function makeUserFromInvite(args, callback){
|
||||
app.api.post('auth/invite/'+ args.token, args, function(error, data){
|
||||
if(data.login){
|
||||
callback(null, data);
|
||||
setToken(data.token);
|
||||
}
|
||||
callback(error, !!data.token);
|
||||
});
|
||||
}
|
||||
|
||||
function forceLogin(){
|
||||
$.holdReady( true );
|
||||
app.auth.isLoggedIn(function(error, isLoggedIn){
|
||||
if(error || !isLoggedIn){
|
||||
app.auth.logOut(function(){})
|
||||
location.replace(`/login${location.href.replace(location.origin, '')}`);
|
||||
}else{
|
||||
$.holdReady( false );
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function logInRedirect(){
|
||||
window.location.href = location.href.replace(location.origin+'/login', '') || '/'
|
||||
}
|
||||
|
||||
|
||||
$( document ).ready( function(){
|
||||
isLoggedIn(function(error, isLoggedIn){
|
||||
if(!error && isLoggedIn){
|
||||
$('.tbp_proxy_is_authed').show();
|
||||
$('.tbp_proxy_not_authed').hide();
|
||||
}else{
|
||||
$('.tbp_proxy_is_authed').hide();
|
||||
$('.tbp_proxy_not_authed').show();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
return {
|
||||
getToken: getToken,
|
||||
setToken: setToken,
|
||||
isLoggedIn: isLoggedIn,
|
||||
logIn: logIn,
|
||||
logOut: logOut,
|
||||
makeUserFromInvite: makeUserFromInvite,
|
||||
forceLogin,
|
||||
logInRedirect,
|
||||
}
|
||||
|
||||
})(app);
|
||||
|
||||
app.util = (function(app){
|
||||
|
||||
function getUrlParameter(name) {
|
||||
name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]');
|
||||
var regex = new RegExp('[\\?&]' + name + '=([^&#]*)');
|
||||
var results = regex.exec(location.search);
|
||||
return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' '));
|
||||
};
|
||||
|
||||
function actionMessage(message, $target, type, callback){
|
||||
message = message || '';
|
||||
$target = $target.closest('div.card').find('.actionMessage');
|
||||
type = type || 'info';
|
||||
callback = callback || function(){};
|
||||
|
||||
if($target.html() === message) return;
|
||||
|
||||
if($target.html()){
|
||||
$target.slideUp('fast', function(){
|
||||
$target.html('')
|
||||
$target.removeClass (function (index, className) {
|
||||
return (className.match (/(^|\s)ui-\S+/g) || []).join(' ');
|
||||
});
|
||||
if(message) return actionMessage(message, $target, type, callback);
|
||||
$target.hide()
|
||||
})
|
||||
}else{
|
||||
if(type) $target.addClass('ui-' + type);
|
||||
$target.html(message).slideDown('fast');
|
||||
}
|
||||
setTimeout(callback,10)
|
||||
}
|
||||
|
||||
$.fn.serializeObject = function() {
|
||||
var
|
||||
arr = $(this).serializeArray(),
|
||||
obj = {};
|
||||
|
||||
for(var i = 0; i < arr.length; i++) {
|
||||
if(obj[arr[i].name] === undefined) {
|
||||
obj[arr[i].name] = arr[i].value;
|
||||
} else {
|
||||
if(!(obj[arr[i].name] instanceof Array)) {
|
||||
obj[arr[i].name] = [obj[arr[i].name]];
|
||||
}
|
||||
obj[arr[i].name].push(arr[i].value);
|
||||
}
|
||||
}
|
||||
return obj;
|
||||
};
|
||||
|
||||
return {
|
||||
getUrlParameter: getUrlParameter,
|
||||
actionMessage: actionMessage,
|
||||
emptyFuction: function(){},
|
||||
|
||||
}
|
||||
})(app);
|
||||
|
||||
|
||||
app.user = (function(app){
|
||||
function list(callback){
|
||||
app.api.get('user/?detail=true', function(error, data){
|
||||
callback(error, data);
|
||||
})
|
||||
}
|
||||
|
||||
function add(args, callback){
|
||||
app.api.post('user/', args, function(error, data){
|
||||
callback(error, data);
|
||||
});
|
||||
}
|
||||
|
||||
function remove(args, callback){
|
||||
if(!confirm('Delete '+ args.uid+ 'user?')) return false;
|
||||
app.api.delete('user/'+ args.uid, function(error, data){
|
||||
callback(error, data);
|
||||
});
|
||||
}
|
||||
|
||||
function changePassword(args, callback){
|
||||
app.api.put('users/'+ arg.uid || '', args, function(error, data){
|
||||
callback(error, data);
|
||||
});
|
||||
}
|
||||
|
||||
function createInvite(callback){
|
||||
app.api.post('user/invite', {}, function(error, data, status){
|
||||
callback(error, data);
|
||||
});
|
||||
}
|
||||
|
||||
function consumeInvite(args){
|
||||
app.api.post('/auth/invite/'+args.token, args, function(error, data){
|
||||
if(data.token){
|
||||
app.auth.setToken(data.token)
|
||||
return callback(null, true)
|
||||
}
|
||||
callback(error)
|
||||
});
|
||||
}
|
||||
|
||||
return {list, remove, createInvite};
|
||||
|
||||
})(app);
|
||||
|
||||
app.group = (function(app){
|
||||
function list(callback){
|
||||
app.api.get('group?detail=true', function(error, data){
|
||||
callback(error, data);
|
||||
});
|
||||
}
|
||||
|
||||
function remove(args, callback){
|
||||
app.api.delete('group/'+args.cn, function(error, data){
|
||||
callback(error, data);
|
||||
});
|
||||
}
|
||||
|
||||
return {list, remove}
|
||||
})(app);
|
||||
|
||||
$( document ).ready( function () {
|
||||
|
||||
$( 'div.row' ).fadeIn( 'slow' ); //show the page
|
||||
|
||||
//panel button's
|
||||
$( '.fa-arrows-v' ).click( function () {
|
||||
$( this ).closest( '.card' ).find( '.card-body' ).slideToggle( 'fast' );
|
||||
});
|
||||
|
||||
$('.actionMessage').on('click', 'button.action-close', function(event){
|
||||
app.util.actionMessage(null, $(this));
|
||||
})
|
||||
|
||||
});
|
||||
|
||||
//ajax form submit
|
||||
function formAJAX( btn, del ) {
|
||||
event.preventDefault(); // avoid to execute the actual submit of the form.
|
||||
var $form = $(btn).closest( '[action]' ); // gets the 'form' parent
|
||||
var formData = $form.find( '[name]' ).serializeObject(); // builds query formDataing
|
||||
var method = $form.attr('method') || 'post';
|
||||
|
||||
// if( !$form.validate()) {
|
||||
// app.util.actionMessage('Please fix the form errors.', $form, 'danger')
|
||||
// return false;
|
||||
// }
|
||||
|
||||
app.util.actionMessage(
|
||||
'<div class="spinner-border" role="status"><span class="sr-only">Loading...</span></div>',
|
||||
$form,
|
||||
'state-highlight'
|
||||
);
|
||||
|
||||
app.api[method]($form.attr('action'), formData, function(error, data){
|
||||
app.util.actionMessage(data.message, $form, error ? 'state-error' : 'priority-primary'); //re-populate table
|
||||
if(!error){
|
||||
$form.trigger("reset");
|
||||
eval($form.attr('evalAJAX')); //gets JS to run after completion
|
||||
}
|
||||
});
|
||||
|
||||
}
|
283
public/lib/js/jq-repeat.js
Normal file
283
public/lib/js/jq-repeat.js
Normal file
@ -0,0 +1,283 @@
|
||||
(function($, Mustache){
|
||||
'use strict';
|
||||
if (!$.scope) {
|
||||
$.scope = {};
|
||||
}
|
||||
|
||||
var make = function( element ){
|
||||
|
||||
//construct array
|
||||
function makeArray( input ){
|
||||
|
||||
var result = [];
|
||||
|
||||
Object.defineProperty( result, "__repeatId", {
|
||||
value: repeatId,
|
||||
writable: true,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
} );
|
||||
|
||||
Object.defineProperty( result, "__rq_template", {
|
||||
value: '',
|
||||
writable: true,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
} );
|
||||
|
||||
result.splice = function(inputValue, ...args){
|
||||
//splice does all the heavy lifting by interacting with the DOM elements.
|
||||
|
||||
var toProto = [...args]
|
||||
|
||||
var index;
|
||||
//if a string is submitted as the index, try to match it to index number
|
||||
if( typeof arguments[0] === 'string' ){
|
||||
index = this.indexOf( arguments[0] );//set where to start
|
||||
if ( index === -1 ) {
|
||||
return [];
|
||||
}
|
||||
}else{
|
||||
index = arguments[0]; //set where to start
|
||||
}
|
||||
|
||||
toProto.unshift(index)
|
||||
|
||||
|
||||
var howMany = arguments[1]; //sets the amount of fields to remove
|
||||
var args = Array.prototype.slice.call( arguments ); // coverts arguments into array
|
||||
var toAdd = args.slice(2); // only keeps fields to add to array
|
||||
|
||||
// if the starting point is higher then the total index count, start at the end
|
||||
if( index > this.length ) {
|
||||
index = this.length;
|
||||
}
|
||||
// if the starting point is negative, start form the end of the array, minus the start point
|
||||
if( index < 0 ) {
|
||||
index = this.length - Math.abs( index );
|
||||
}
|
||||
|
||||
// if there are things to add, figure out the how many new indexes we need
|
||||
if( !howMany && howMany !== 0 ) {
|
||||
howMany = this.length - index;
|
||||
}
|
||||
//not sure why i put this here... but it does matter!
|
||||
if( howMany > this.length - index ) {
|
||||
howMany = this.length - index;
|
||||
}
|
||||
|
||||
//figure out how many positions we need to shift the current elements
|
||||
var shift = toAdd.length - howMany;
|
||||
|
||||
// figure out how big the new array will be
|
||||
// var newLength = this.length + shift;
|
||||
|
||||
//removes fields from array based on howMany needs to be removed
|
||||
for( var i = index; i < +index+howMany; i++ ) {
|
||||
this.__take.apply( this[index].__jq_$el );
|
||||
// this.__take.apply( $( '.jq-repeat-'+ this.__repeatId +'[jq-repeat-index="'+ ( i + index ) +'"]' ) );
|
||||
}
|
||||
|
||||
//re-factor element index's
|
||||
for(var i = 0; i < this.length; i++){
|
||||
if( i >= index){
|
||||
|
||||
this[i].__jq_$el.attr( 'jq-repeat-index', i+shift );
|
||||
}
|
||||
}
|
||||
|
||||
//if there are fields to add to the array, add them
|
||||
if( toAdd.length > 0 ){
|
||||
|
||||
//$.each( toAdd, function( key, value ){
|
||||
for(var I = 0; I < toAdd.length; I++){
|
||||
|
||||
//figure out new elements index
|
||||
var key = I + index;
|
||||
// apply values to template
|
||||
var render = Mustache.render( this.__rq_template, toAdd[I] );
|
||||
|
||||
//set call name and index keys to DOM element
|
||||
var $render = $( render ).addClass( 'jq-repeat-'+ this.__repeatId ).attr( 'jq-repeat-index', key );
|
||||
|
||||
|
||||
//if add new elements in proper stop, or after the place holder.
|
||||
if( key === 0 ){
|
||||
$( '.jq-repeat-'+ this.__repeatId +'[jq-repeat-index="holder"]' ).after( $render );
|
||||
}else{
|
||||
$( '.jq-repeat-'+ this.__repeatId +'[jq-repeat-index="' + ( key -1 ) + '"]' ).after( $render );
|
||||
}
|
||||
|
||||
Object.defineProperty( toAdd[I], "__jq_$el", {
|
||||
value: $render,
|
||||
writable: true,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
} );
|
||||
|
||||
//animate element
|
||||
this.__put.apply($render, [toAdd[I]]);
|
||||
}
|
||||
}
|
||||
|
||||
//set and return new array
|
||||
return Array.prototype.splice.apply(this, toProto);
|
||||
};
|
||||
result.push = function(){
|
||||
//add one or more objects to the array
|
||||
|
||||
//set the index value, if none is set make it zero
|
||||
var index = this.length || 0;
|
||||
|
||||
//loop each passed object and pass it to slice
|
||||
for (var i = 0 ; i < arguments.length; ++i) {
|
||||
this.splice( ( index + i ), 0, arguments[i] );
|
||||
}
|
||||
|
||||
//return new array length
|
||||
return this.length;
|
||||
};
|
||||
|
||||
result.unshift = function(item){
|
||||
return this.splice(0, 0, item);
|
||||
};
|
||||
|
||||
result.pop = function(){
|
||||
//remove and return array element
|
||||
|
||||
return this.splice( -1, 1 )[0];
|
||||
};
|
||||
result.reverse = function() {
|
||||
var temp = this.splice( 0 );
|
||||
Array.prototype.reverse.apply( temp );
|
||||
|
||||
for( var i = 0; i < temp.length; i++ ){
|
||||
this.push( temp[i] );
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
result.shift = function() {
|
||||
return this.splice( 0, 1 )[0];
|
||||
};
|
||||
result.loop = function(){
|
||||
var temp = this[0];
|
||||
this.splice( 0,1 );
|
||||
this.push( temp );
|
||||
|
||||
return temp;
|
||||
};
|
||||
result.loopUp = function(){
|
||||
var temp = this[this.length-1];
|
||||
this.splice( -1, 1 );
|
||||
this.splice( 0, 0, temp );
|
||||
return temp;
|
||||
};
|
||||
result.indexOf = function( key, value ){
|
||||
if( !value ){
|
||||
value = arguments[0];
|
||||
key = this.__index;
|
||||
}
|
||||
for ( var index = 0; index < this.length; ++index ) {
|
||||
if( this[index][key] === value ){
|
||||
|
||||
return index;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
};
|
||||
result.update = function( key, value, update ){
|
||||
//set variables using sting for index
|
||||
|
||||
// If update is called with no index/key, assume its the 0
|
||||
if(typeof key === 'object'){
|
||||
if(this[0]){
|
||||
return this.update(0, key);
|
||||
}
|
||||
return this.splice(0, 1, key);
|
||||
}
|
||||
|
||||
if( !update ){
|
||||
update = arguments[1];
|
||||
value = arguments[0];
|
||||
key = this.__index;
|
||||
}
|
||||
|
||||
var index = this.indexOf( key, value );
|
||||
|
||||
if(index === -1) {
|
||||
return [];
|
||||
}
|
||||
var object = $.extend( true, {}, this[index], update );
|
||||
return this.splice( index, 1, object )[0];
|
||||
};
|
||||
result.__put = function(){
|
||||
this.show();
|
||||
};
|
||||
result.__take = function(){
|
||||
this.remove();
|
||||
};
|
||||
|
||||
if(!input) {
|
||||
return result;
|
||||
}
|
||||
$.each( input, function( key, value ){
|
||||
var type = typeof value;
|
||||
if( type === 'object' ){
|
||||
result.push( value );
|
||||
}else if( type === 'string' ){
|
||||
Object.defineProperty( result, "__index", {
|
||||
value: value,
|
||||
writable: true,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
} );
|
||||
} else if ( type === 'function'){
|
||||
Object.defineProperty( result, value.name, {
|
||||
value: value,
|
||||
writable: true,
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
} );
|
||||
}
|
||||
} );
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
var $this = $( element );
|
||||
var repeatId = $this.attr( 'jq-repeat' );
|
||||
var tempId = repeatId + 'Template';
|
||||
var templateId = $( '#' + tempId ).html();
|
||||
|
||||
$this.removeAttr( 'jq-repeat' );
|
||||
var template = element.outerHTML
|
||||
|
||||
$this.replaceWith( '<script type="x-tmpl-mustache" id="' + tempId + '" class="jq-repeat-' + repeatId + ' " jq-repeat-index="holder"><\/script>' );
|
||||
|
||||
Mustache.parse(templateId); // optional, speeds up future uses
|
||||
|
||||
|
||||
$.scope[repeatId] = makeArray($.scope[repeatId]);
|
||||
$.scope[repeatId].__rq_template = template
|
||||
};
|
||||
|
||||
$( document ).ready( function(){
|
||||
$( '[jq-repeat]' ).each(function(key, value){
|
||||
make(value);
|
||||
});
|
||||
|
||||
$(document).on('DOMNodeInserted', function(e) {
|
||||
if ( $(e.target).is('[jq-repeat]') ){
|
||||
make( e.target );
|
||||
}else{
|
||||
var t = $(e.target).find('[jq-repeat]');
|
||||
t.each(function(key, value){
|
||||
make(value);
|
||||
});
|
||||
}
|
||||
});
|
||||
} );
|
||||
|
||||
})(jQuery, Mustache);
|
395
public/partial/header.html
Normal file
395
public/partial/header.html
Normal file
@ -0,0 +1,395 @@
|
||||
<link rel="stylesheet" href="/__static-modules/jquery-ui/dist/themes/smoothness/jquery-ui.css">
|
||||
|
||||
<script type="text/javascript" src="/socket.io/socket.io.js"></script>
|
||||
<script src='/__static-modules/mustache/mustache.min.js'></script>
|
||||
<script src="/__static/lib/js/jq-repeat.js"></script>
|
||||
<script src="/__static-modules/moment/min/moment-with-locales.min.js"></script>
|
||||
<script src="/__static-modules/jquery-ui/dist/jquery-ui.min.js"></script>
|
||||
<script src="/__static/js/app.js"></script>
|
||||
|
||||
<style type="text/css">
|
||||
.ui-dialog .ui-dialog-title{
|
||||
width: unset;
|
||||
}
|
||||
|
||||
#tbp_proxy_header {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
z-index: 95;
|
||||
background: lightblue;
|
||||
height: 3em;
|
||||
text-align: initial;
|
||||
padding-top: .5em;
|
||||
padding-right: 1em;
|
||||
}
|
||||
|
||||
#tbp_proxy_header_right{
|
||||
margin-right: 2em;
|
||||
float: right;
|
||||
|
||||
display: flex;
|
||||
align-items:center;
|
||||
}
|
||||
|
||||
#tbp_proxy_torrent_dialog_opener{
|
||||
border-radius: 25px;
|
||||
background: lightseagreen;
|
||||
display: flex;
|
||||
align-items:center;
|
||||
|
||||
padding: 1em;
|
||||
padding-top: .3em;
|
||||
padding-bottom: .3em;
|
||||
|
||||
margin-right: .5em;
|
||||
}
|
||||
|
||||
#header {
|
||||
padding-top: 3.5em;
|
||||
}
|
||||
</style>
|
||||
|
||||
<!--
|
||||
Dialog boxes to be displayed
|
||||
-->
|
||||
|
||||
<div id="tbp_proxy_login_dialog" title="SSO Login">
|
||||
<div class="shadow-lg card">
|
||||
<div class="card-header shadow actionMessage" style="display:none"></div>
|
||||
<div class="card-body">
|
||||
<form action="auth/login" onsubmit="formAJAX(this)" evalAJAX="
|
||||
app.auth.setToken(data.token);
|
||||
app.auth.logInRedirect();
|
||||
">
|
||||
<input type="hidden" name="redirect" value="<%= redirect %>">
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-label">User name</label>
|
||||
<div class="input-group mb-3 shadow">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text" ><i class="fa-solid fa-user-tie"></i></span>
|
||||
</div>
|
||||
<input type="text" name="uid" class="form-control" placeholder="jsmith" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-label">Password</label>
|
||||
<div class="input-group mb-3 shadow">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text" ><i class="fa-solid fa-key"></i></span>
|
||||
</div>
|
||||
<input type="password" name="password" class="form-control" placeholder="hunter123!"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn btn-outline-dark"><i class="fa-solid fa-right-to-bracket"></i> Log in</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!--
|
||||
Torrent List Dialog
|
||||
-->
|
||||
|
||||
<style type="text/css">
|
||||
#tbp_proxy_torrent_dialog{
|
||||
padding: 0;
|
||||
}
|
||||
#tbp_proxy_torrent_dialog progress{
|
||||
width: 100%;
|
||||
height: 2em;
|
||||
}
|
||||
#tbp_proxy_torrent_dialog ul{
|
||||
max-height: 400px;
|
||||
overflow-y: scroll;
|
||||
list-style-type: none;
|
||||
padding-left: 0;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<div id="tbp_proxy_torrent_dialog" title="Torrents">
|
||||
<ul>
|
||||
<li jq-repeat="tbp_proxy_torrent_dialog_torrents">{{name}}
|
||||
<br />
|
||||
{{^isFinished}}
|
||||
<progress id="file" max="100" value="{{percentDone}}">{{percentDone}}%</progress>
|
||||
<br />
|
||||
Status: <b>{{statusText}}</b> ETA: <b>{{eta}}</b> Rate: <b>{{rateDownload}}</b>
|
||||
{{/isFinished}}
|
||||
{{#isFinished}}
|
||||
<br /> Done! <a href="https://stuff.718it.biz/torrents/{{name}}" target="_blank"> HTTP Link</a>
|
||||
{{/isFinished}}
|
||||
<hr />
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
<!--
|
||||
Torrent Add Dialog
|
||||
-->
|
||||
<style type="text/css">
|
||||
#tbp_proxy_torrent_add_dialog_container{
|
||||
width: 32em;
|
||||
}
|
||||
|
||||
#tbp_proxy_torrent_add_dialog input[type="text"]{
|
||||
width: 90%;
|
||||
}
|
||||
#tbp_proxy_torrent_add_dialog label,legend{
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<div id="tbp_proxy_torrent_add_dialog" title="Add torrent">
|
||||
<div id="tbp_proxy_torrent_add_dialog_container" class='card'>
|
||||
<div class="card-header shadow actionMessage" style="display:none"></div>
|
||||
<div jq-repeat="torrentAdd">
|
||||
<form action="torrent" method="post" onsubmit="formAJAX(this)" evalAJAX="
|
||||
app.publish('torrent:add', {...data, __noSocket: true});
|
||||
$('#tbp_proxy_torrent_add_dialog').dialog('close');
|
||||
openDialog($('#tbp_proxy_torrent_dialog'))
|
||||
">
|
||||
<p>
|
||||
<label for="_name">Name:</label>
|
||||
<br />
|
||||
<input type="text" name="_name" value="{{{name}}}" readonly/>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<label for="magnetLink">Magnet Link:</label>
|
||||
<br />
|
||||
<input type="text" name="magnetLink" value="{{{magnetLink}}}" readonly/>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<legend>Public Download:</legend>
|
||||
|
||||
<label for="radio-1" title="The download will appare in the communal download folder">Public</label>
|
||||
<input type="radio" name="isPrivate" id="radio-1" value="true" checked readonly/>
|
||||
|
||||
<label for="radio-2" title="Only you(and the admins) will be able to see this download">Private</label>
|
||||
<input type="radio" name="isPrivate" id="radio-2" value="false" readonly/>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<legend>Start on add:</legend>
|
||||
|
||||
<label for="isStart-1" title="The download will appare in the communal download folder">Yes</label>
|
||||
<input type="radio" name="isStart" id="isStart-1" value="true" checked readonly/>
|
||||
|
||||
<label for="isStart-2" title="Only you(and the admins) will be able to see this download">No</label>
|
||||
<input type="radio" name="isStart" id="isStart-2" value="false" readonly/>
|
||||
</p>
|
||||
|
||||
<hr />
|
||||
<button type="submit">Start Download</button>
|
||||
<button onclick="$('#tbp_proxy_torrent_add_dialog').dialog('close')">Cancel</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!--
|
||||
The bar injected at the top of the page
|
||||
-->
|
||||
|
||||
<div id="tbp_proxy_header_right">
|
||||
<span id="tbp_proxy_torrent_dialog_opener" class="tbp_proxy_is_authed">
|
||||
<img src="/__static/img/Transmission_Icon.svg" height="22" width="22" style="margin-right: .3em;" />
|
||||
<span><b>106</b></span>
|
||||
</span>
|
||||
<button id="tbp_proxy_login_dialog_opener" class="tbp_proxy_not_authed ui-button ui-corner-all ui-widget">Login</button>
|
||||
<button class="tbp_proxy_is_authed ui-button ui-corner-all ui-widget"
|
||||
onclick="app.auth.logOut(e => window.location.href='/')">Logout</button>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$( document ).ready(function() {
|
||||
var commonDialogOptions = {
|
||||
position: { my: "left top", at: "left bottom", of: '#tbp_proxy_header_right' },
|
||||
autoOpen: false,
|
||||
resizable: false,
|
||||
closeOnEscape: true,
|
||||
draggable: false,
|
||||
width: 'auto',
|
||||
};
|
||||
|
||||
/* Login Button and dialog*/
|
||||
$( "#tbp_proxy_login_dialog" ).dialog(commonDialogOptions);
|
||||
|
||||
$( "#tbp_proxy_login_dialog_opener" ).on( "click", function() {
|
||||
// https://stackoverflow.com/a/6500385
|
||||
$( "#tbp_proxy_login_dialog" ).parent().css({position:"fixed", 'margin-right': "2em", 'margin-top': '3em'}).end().dialog( "open" );
|
||||
});
|
||||
|
||||
|
||||
/* Torrent list button and dialog */
|
||||
$( "#tbp_proxy_torrent_dialog" ).dialog(commonDialogOptions);
|
||||
|
||||
$( "#tbp_proxy_torrent_dialog_opener" ).on( "click", function() {
|
||||
$( "#tbp_proxy_torrent_dialog" ).parent().css({position:"fixed", 'margin-right': "2em", 'margin-top': '3em'}).end().dialog( "open" );
|
||||
});
|
||||
|
||||
|
||||
/* Torrent add button and dialog */
|
||||
$( "#tbp_proxy_torrent_add_dialog" ).dialog({
|
||||
modal: true,
|
||||
height: 300,
|
||||
...commonDialogOptions
|
||||
});
|
||||
|
||||
$("body").on('click', 'img.718link', function(el){
|
||||
// magnetLink
|
||||
$.scope.torrentAdd.update({
|
||||
magnetLink: $(this).data('link'),
|
||||
name: (new URLSearchParams($(this).data('link'))).get('dn')
|
||||
});
|
||||
$('#tbp_proxy_torrent_add_dialog').parent().css({position:"fixed", 'margin-right': "2em", 'margin-top': '3em'}).end().dialog('open');
|
||||
});
|
||||
|
||||
$('a').each(function(idx, el){
|
||||
var $el = $(el);
|
||||
if($el.attr('href') && $el.attr('href').match("magnet:?")){
|
||||
$el.before('<img class="tbp_proxy_is_authed 718link" src="/__static/img/Transmission_Icon.svg" height=24 width=24 data-link="'+$el.attr('href')+'"/>')
|
||||
}
|
||||
});
|
||||
|
||||
/* Enable tooltips*/
|
||||
$( '#tbp_proxy_header' ).tooltip({
|
||||
track: true
|
||||
});
|
||||
|
||||
app.subscribe('torrent:add', function(data, topic){
|
||||
console.log('sub', topic, data)
|
||||
$.scope.tbp_proxy_torrent_dialog_torrents.unshift(app.torrent.parseTorrnetItem(data))
|
||||
});
|
||||
|
||||
listTorrents();
|
||||
setInterval(refreshTorrents, 2000)
|
||||
});
|
||||
|
||||
function openDialog($el){
|
||||
$el.parent().css({
|
||||
position:"fixed", 'margin-right': "2em", 'margin-top': '3em'
|
||||
}).end().dialog('open');
|
||||
}
|
||||
|
||||
function listTorrents(){
|
||||
app.torrent.list(function(err, data){
|
||||
for(let torrent of data.results){
|
||||
$.scope.tbp_proxy_torrent_dialog_torrents.unshift(app.torrent.parseTorrnetItem(torrent))
|
||||
app.torrent.get(function(error, torrent){
|
||||
$.scope.tbp_proxy_torrent_dialog_torrents.update('id', torrent.result.id, app.torrent.parseTorrnetItem(torrent.result))
|
||||
} , torrent.id, true)
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
function refreshTorrents(){
|
||||
for(let torrent of $.scope.tbp_proxy_torrent_dialog_torrents){
|
||||
if(!torrent.isFinished){
|
||||
app.torrent.get(function(error, torrent){
|
||||
$.scope.tbp_proxy_torrent_dialog_torrents.update('id', torrent.result.id, app.torrent.parseTorrnetItem(torrent.result))
|
||||
} , torrent.id, true)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
app.torrent = (function(app){
|
||||
let myTorrents = [];
|
||||
|
||||
statusMap = [
|
||||
'Inactive',
|
||||
'CHECK_WAIT',
|
||||
'Verifying',
|
||||
'DOWNLOAD_WAIT',
|
||||
'Downloading',
|
||||
'SEED_WAIT',
|
||||
'Seeding',
|
||||
'ISOLATED',
|
||||
'Unknown',
|
||||
];
|
||||
|
||||
function list(callback, username) {
|
||||
app.api.get('torrent', callback);
|
||||
}
|
||||
|
||||
function get(callback, id, forceUpdate){
|
||||
app.api.get(`torrent/${id}?${forceUpdate ? 'latest': '' }`, callback);
|
||||
}
|
||||
|
||||
function parseTorrnetItem(torrent){
|
||||
return {
|
||||
...torrent,
|
||||
"eta": torrent.eta > 0 ? moment().seconds(torrent.eta).fromNow() : 'Unknown',
|
||||
"rateDownload": `${Math.floor(torrent.rateDownload/1024/1024)}mb/s`,
|
||||
"sizeWhenDone": `${Math.floor(torrent.sizeWhenDone/1024/1024)}mb/s`,
|
||||
"percentDone": torrent.percentDone*100,
|
||||
"statusText": statusMap[torrent.status || 8],
|
||||
// "createdAtString": moment(torrent.createdAt).fromNow().
|
||||
// "downloadDir": "/media/torrents",
|
||||
// "errorString": "",
|
||||
// "files": [],
|
||||
// "hashString": "4794a0915cada6c491eb5c910e1f4a0da727cac8",
|
||||
// "isFinished": false,
|
||||
// "isStalled": false,
|
||||
// "name": "reacher.s02e06.1080p.web.h264-successfulcrab[EZTVx.to].mkv",
|
||||
// "peers": [],
|
||||
// "peersConnected": 50,
|
||||
// "status": 4,
|
||||
// "id": 1,
|
||||
// "torrent_id": "454",
|
||||
// "magnetLink": "magnet:?xt=urn:btih:4794A0915CADA6C491EB5C910E1F4A0DA727CAC8&dn=Reacher+S02E06+1080p+WEB+H264-SuccessfulCrab&tr=http%3A%2F%2Fp4p.arenabg.com%3A1337%2Fannounce&tr=udp%3A%2F%2F47.ip-51-68-199.eu%3A6969%2Fannounce&tr=udp%3A%2F%2F9.rarbg.me%3A2780%2Fannounce&tr=udp%3A%2F%2F9.rarbg.to%3A2710%2Fannounce&tr=udp%3A%2F%2F9.rarbg.to%3A2730%2Fannounce&tr=udp%3A%2F%2F9.rarbg.to%3A2920%2Fannounce&tr=udp%3A%2F%2Fopen.stealth.si%3A80%2Fannounce&tr=udp%3A%2F%2Fopentracker.i2p.rocks%3A6969%2Fannounce&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969%2Fannounce&tr=udp%3A%2F%2Ftracker.cyberia.is%3A6969%2Fannounce&tr=udp%3A%2F%2Ftracker.dler.org%3A6969%2Fannounce&tr=udp%3A%2F%2Ftracker.internetwarriors.net%3A1337%2Fannounce&tr=udp%3A%2F%2Ftracker.leechers-paradise.org%3A6969%2Fannounce&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A6969%2Fannounce&tr=udp%3A%2F%2Ftracker.opentrackr.org%3A1337&tr=udp%3A%2F%2Ftracker.pirateparty.gr%3A6969%2Fannounce&tr=udp%3A%2F%2Ftracker.tiny-vps.com%3A6969%2Fannounce&tr=udp%3A%2F%2Ftracker.torrent.eu.org%3A451%2Fannounce",
|
||||
// "isPrivate": false,
|
||||
// "added_by": "wmantly",
|
||||
// "createdAt": "2024-01-05T21:18:30.607Z",
|
||||
// "updatedAt": "2024-01-05T21:32:54.493Z"
|
||||
}
|
||||
}
|
||||
|
||||
return {list, get, parseTorrnetItem};
|
||||
})(app);
|
||||
|
||||
</script>
|
||||
|
||||
<!-- {
|
||||
"result": {
|
||||
"downloadDir": "/media/torrents",
|
||||
"errorString": "",
|
||||
"eta": -2,
|
||||
"files": [],
|
||||
"hashString": "a7ff69e500f0b62c3dec1061b9998610385dc7b6",
|
||||
"isFinished": false,
|
||||
"isStalled": true,
|
||||
"name": "Aftershock.2012.LIMITED.720p.BluRay.x264-GECKOS+[PublicHD]",
|
||||
"peers": [],
|
||||
"peersConnected": 0,
|
||||
"percentDone": 0,
|
||||
"rateDownload": 0,
|
||||
"sizeWhenDone": 0,
|
||||
"status": 4,
|
||||
"dataValues": {
|
||||
"id": 1,
|
||||
"torrent_id": "451",
|
||||
"magnetLink": "magnet:?xt=urn:btih:DF0146FBD120793246BE3D29ADD11BC7D460BFBB&dn=Magnum+P+I+2018+S05E19+720p+HDTV+x264-SYNCOPY&tr=http%3A%2F%2Fp4p.arenabg.com%3A1337%2Fannounce&tr=udp%3A%2F%2F47.ip-51-68-199.eu%3A6969%2Fannounce&tr=udp%3A%2F%2F9.rarbg.me%3A2780%2Fannounce&tr=udp%3A%2F%2F9.rarbg.to%3A2710%2Fannounce&tr=udp%3A%2F%2F9.rarbg.to%3A2730%2Fannounce&tr=udp%3A%2F%2F9.rarbg.to%3A2920%2Fannounce&tr=udp%3A%2F%2Fopen.stealth.si%3A80%2Fannounce&tr=udp%3A%2F%2Fopentracker.i2p.rocks%3A6969%2Fannounce&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969%2Fannounce&tr=udp%3A%2F%2Ftracker.cyberia.is%3A6969%2Fannounce&tr=udp%3A%2F%2Ftracker.dler.org%3A6969%2Fannounce&tr=udp%3A%2F%2Ftracker.internetwarriors.net%3A1337%2Fannounce&tr=udp%3A%2F%2Ftracker.leechers-paradise.org%3A6969%2Fannounce&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A6969%2Fannounce&tr=udp%3A%2F%2Ftracker.opentrackr.org%3A1337&tr=udp%3A%2F%2Ftracker.pirateparty.gr%3A6969%2Fannounce&tr=udp%3A%2F%2Ftracker.tiny-vps.com%3A6969%2Fannounce&tr=udp%3A%2F%2Ftracker.torrent.eu.org%3A451%2Fannounce",
|
||||
"hashString": "a7ff69e500f0b62c3dec1061b9998610385dc7b6",
|
||||
"name": "Aftershock.2012.LIMITED.720p.BluRay.x264-GECKOS+[PublicHD]",
|
||||
"added_by": "wmantly",
|
||||
"status": 4,
|
||||
"percentDone": 0,
|
||||
"downloadDir": "/media/torrents",
|
||||
"errorString": "",
|
||||
"sizeWhenDone": 0,
|
||||
"createdAt": "2024-01-04T17:40:58.187Z",
|
||||
"updatedAt": "2024-01-05T19:30:37.676Z"
|
||||
},
|
||||
} -->
|
Reference in New Issue
Block a user