mirror of
https://github.com/9001/copyparty.git
synced 2025-08-17 09:02:15 -06:00
guess they stole it from win10, sausage
This commit is contained in:
parent
db374b19f1
commit
ea762b05e0
|
@ -183,9 +183,9 @@ a, #files tbody div a:last-child {
|
||||||
text-shadow: 0 0 .3em #b80;
|
text-shadow: 0 0 .3em #b80;
|
||||||
}
|
}
|
||||||
#files tbody tr.sel td {
|
#files tbody tr.sel td {
|
||||||
background: #80b;
|
|
||||||
color: #fff;
|
color: #fff;
|
||||||
border-color: #a3d;
|
background: #925;
|
||||||
|
border-color: #c37;
|
||||||
}
|
}
|
||||||
#blocked {
|
#blocked {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
# coding: latin-1
|
# coding: latin-1
|
||||||
from __future__ import print_function, unicode_literals
|
from __future__ import print_function, unicode_literals
|
||||||
|
|
||||||
import os, sys, time, shutil, runpy, tarfile, hashlib, platform, tempfile, traceback
|
import os, sys, time, shutil, threading, tarfile, hashlib, platform, tempfile, traceback
|
||||||
|
|
||||||
"""
|
"""
|
||||||
run me with any version of python, i will unpack and run copyparty
|
run me with any version of python, i will unpack and run copyparty
|
||||||
|
@ -26,6 +26,7 @@ CKSUM = None
|
||||||
STAMP = None
|
STAMP = None
|
||||||
|
|
||||||
PY2 = sys.version_info[0] == 2
|
PY2 = sys.version_info[0] == 2
|
||||||
|
WINDOWS = sys.platform == "win32"
|
||||||
sys.dont_write_bytecode = True
|
sys.dont_write_bytecode = True
|
||||||
me = os.path.abspath(os.path.realpath(__file__))
|
me = os.path.abspath(os.path.realpath(__file__))
|
||||||
cpp = None
|
cpp = None
|
||||||
|
@ -343,6 +344,21 @@ def get_payload():
|
||||||
break
|
break
|
||||||
|
|
||||||
|
|
||||||
|
def utime(top):
|
||||||
|
i = 0
|
||||||
|
files = [os.path.join(dp, p) for dp, dd, df in os.walk(top) for p in dd + df]
|
||||||
|
while WINDOWS:
|
||||||
|
t = int(time.time())
|
||||||
|
if i:
|
||||||
|
msg("utime {}, {}".format(i, t))
|
||||||
|
|
||||||
|
for f in files:
|
||||||
|
os.utime(f, (t, t))
|
||||||
|
|
||||||
|
i += 1
|
||||||
|
time.sleep(78123)
|
||||||
|
|
||||||
|
|
||||||
def confirm(rv):
|
def confirm(rv):
|
||||||
msg()
|
msg()
|
||||||
msg(traceback.format_exc())
|
msg(traceback.format_exc())
|
||||||
|
@ -362,15 +378,20 @@ def run(tmp, j2ver):
|
||||||
msg("sfxdir:", tmp)
|
msg("sfxdir:", tmp)
|
||||||
msg()
|
msg()
|
||||||
|
|
||||||
# "systemd-tmpfiles-clean.timer"?? HOW do you even come up with this shit
|
# block systemd-tmpfiles-clean.timer
|
||||||
try:
|
try:
|
||||||
import fcntl
|
import fcntl
|
||||||
|
|
||||||
fd = os.open(tmp, os.O_RDONLY)
|
fd = os.open(tmp, os.O_RDONLY)
|
||||||
fcntl.flock(fd, fcntl.LOCK_EX | fcntl.LOCK_NB)
|
fcntl.flock(fd, fcntl.LOCK_EX | fcntl.LOCK_NB)
|
||||||
tmp = os.readlink(tmp) # can't flock a symlink, even with O_NOFOLLOW
|
tmp = os.readlink(tmp) # can't flock a symlink, even with O_NOFOLLOW
|
||||||
except:
|
except Exception as ex:
|
||||||
pass
|
if not WINDOWS:
|
||||||
|
msg("\033[31mflock:", repr(ex))
|
||||||
|
|
||||||
|
t = threading.Thread(target=utime, args=(tmp,))
|
||||||
|
t.daemon = True
|
||||||
|
t.start()
|
||||||
|
|
||||||
ld = [tmp, os.path.join(tmp, "dep-j2")]
|
ld = [tmp, os.path.join(tmp, "dep-j2")]
|
||||||
if j2ver:
|
if j2ver:
|
||||||
|
@ -380,7 +401,10 @@ def run(tmp, j2ver):
|
||||||
sys.path.insert(0, x)
|
sys.path.insert(0, x)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
runpy.run_module(str("copyparty"), run_name=str("__main__"))
|
from copyparty.__main__ import main as copyparty
|
||||||
|
|
||||||
|
copyparty()
|
||||||
|
|
||||||
except SystemExit as ex:
|
except SystemExit as ex:
|
||||||
if ex.code:
|
if ex.code:
|
||||||
confirm(ex.code)
|
confirm(ex.code)
|
||||||
|
|
Loading…
Reference in a new issue