mirror of
https://github.com/9001/copyparty.git
synced 2025-08-17 09:02:15 -06:00
support windows 2000 and XP
This commit is contained in:
parent
52e06226a2
commit
8c73e0cbc2
|
@ -42,6 +42,7 @@ from .util import (
|
||||||
DEF_EXP,
|
DEF_EXP,
|
||||||
DEF_MTE,
|
DEF_MTE,
|
||||||
DEF_MTH,
|
DEF_MTH,
|
||||||
|
HAVE_IPV6,
|
||||||
IMPLICATIONS,
|
IMPLICATIONS,
|
||||||
JINJA_VER,
|
JINJA_VER,
|
||||||
MIMES,
|
MIMES,
|
||||||
|
@ -293,6 +294,9 @@ def get_ah_salt() -> str:
|
||||||
|
|
||||||
|
|
||||||
def ensure_locale() -> None:
|
def ensure_locale() -> None:
|
||||||
|
if ANYWIN and PY2:
|
||||||
|
return # maybe XP, so busted 65001
|
||||||
|
|
||||||
safe = "en_US.UTF-8"
|
safe = "en_US.UTF-8"
|
||||||
for x in [
|
for x in [
|
||||||
safe,
|
safe,
|
||||||
|
@ -1594,6 +1598,9 @@ def main(argv: Optional[list[str]] = None, rsrc: Optional[str] = None) -> None:
|
||||||
if getattr(al, k1):
|
if getattr(al, k1):
|
||||||
setattr(al, k2, False)
|
setattr(al, k2, False)
|
||||||
|
|
||||||
|
if not HAVE_IPV6 and al.i == "::":
|
||||||
|
al.i = "0.0.0.0"
|
||||||
|
|
||||||
al.i = al.i.split(",")
|
al.i = al.i.split(",")
|
||||||
try:
|
try:
|
||||||
if "-" in al.p:
|
if "-" in al.p:
|
||||||
|
|
|
@ -15,6 +15,7 @@ from .util import (
|
||||||
E_ADDR_IN_USE,
|
E_ADDR_IN_USE,
|
||||||
E_ADDR_NOT_AVAIL,
|
E_ADDR_NOT_AVAIL,
|
||||||
E_UNREACH,
|
E_UNREACH,
|
||||||
|
HAVE_IPV6,
|
||||||
IP6ALL,
|
IP6ALL,
|
||||||
Netdev,
|
Netdev,
|
||||||
min_ex,
|
min_ex,
|
||||||
|
@ -111,8 +112,10 @@ class TcpSrv(object):
|
||||||
|
|
||||||
eps = {
|
eps = {
|
||||||
"127.0.0.1": Netdev("127.0.0.1", 0, "", "local only"),
|
"127.0.0.1": Netdev("127.0.0.1", 0, "", "local only"),
|
||||||
"::1": Netdev("::1", 0, "", "local only"),
|
|
||||||
}
|
}
|
||||||
|
if HAVE_IPV6:
|
||||||
|
eps["::1"] = Netdev("::1", 0, "", "local only")
|
||||||
|
|
||||||
nonlocals = [x for x in self.args.i if x not in [k.split("/")[0] for k in eps]]
|
nonlocals = [x for x in self.args.i if x not in [k.split("/")[0] for k in eps]]
|
||||||
if nonlocals:
|
if nonlocals:
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -33,7 +33,7 @@ from partftpy import (
|
||||||
)
|
)
|
||||||
from partftpy.TftpShared import TftpException
|
from partftpy.TftpShared import TftpException
|
||||||
|
|
||||||
from .__init__ import EXE, TYPE_CHECKING
|
from .__init__ import EXE, PY2, TYPE_CHECKING
|
||||||
from .authsrv import VFS
|
from .authsrv import VFS
|
||||||
from .bos import bos
|
from .bos import bos
|
||||||
from .util import BytesIO, Daemon, ODict, exclude_dotfiles, min_ex, runhook, undot
|
from .util import BytesIO, Daemon, ODict, exclude_dotfiles, min_ex, runhook, undot
|
||||||
|
@ -95,7 +95,7 @@ class Tftpd(object):
|
||||||
TftpServer,
|
TftpServer,
|
||||||
]
|
]
|
||||||
cbak = []
|
cbak = []
|
||||||
if not self.args.tftp_no_fast and not EXE:
|
if not self.args.tftp_no_fast and not EXE and not PY2:
|
||||||
try:
|
try:
|
||||||
ptn = re.compile(r"(^\s*)log\.debug\(.*\)$")
|
ptn = re.compile(r"(^\s*)log\.debug\(.*\)$")
|
||||||
for C in Cs:
|
for C in Cs:
|
||||||
|
@ -105,7 +105,7 @@ class Tftpd(object):
|
||||||
cfn = C.__spec__.origin
|
cfn = C.__spec__.origin
|
||||||
exec (compile(src2, filename=cfn, mode="exec"), C.__dict__)
|
exec (compile(src2, filename=cfn, mode="exec"), C.__dict__)
|
||||||
except Exception:
|
except Exception:
|
||||||
t = "failed to optimize tftp code; run with --tftp-noopt if there are issues:\n"
|
t = "failed to optimize tftp code; run with --tftp-no-fast if there are issues:\n"
|
||||||
self.log("tftp", t + min_ex(), 3)
|
self.log("tftp", t + min_ex(), 3)
|
||||||
for n, zd in enumerate(cbak):
|
for n, zd in enumerate(cbak):
|
||||||
Cs[n].__dict__ = zd
|
Cs[n].__dict__ = zd
|
||||||
|
|
|
@ -158,6 +158,17 @@ else:
|
||||||
from urllib import unquote # type: ignore # pylint: disable=no-name-in-module
|
from urllib import unquote # type: ignore # pylint: disable=no-name-in-module
|
||||||
|
|
||||||
|
|
||||||
|
try:
|
||||||
|
socket.inet_pton(socket.AF_INET6, "::1")
|
||||||
|
HAVE_IPV6 = True
|
||||||
|
except:
|
||||||
|
def inet_pton(fam, ip):
|
||||||
|
return socket.inet_aton(ip)
|
||||||
|
|
||||||
|
socket.inet_pton = inet_pton
|
||||||
|
HAVE_IPV6 = False
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
struct.unpack(b">i", b"idgi")
|
struct.unpack(b">i", b"idgi")
|
||||||
spack = struct.pack # type: ignore
|
spack = struct.pack # type: ignore
|
||||||
|
@ -2459,6 +2470,9 @@ def build_netmap(csv: str):
|
||||||
csv += ", 127.0.0.0/8, ::1/128" # loopback
|
csv += ", 127.0.0.0/8, ::1/128" # loopback
|
||||||
|
|
||||||
srcs = [x.strip() for x in csv.split(",") if x.strip()]
|
srcs = [x.strip() for x in csv.split(",") if x.strip()]
|
||||||
|
if not HAVE_IPV6:
|
||||||
|
srcs = [x for x in srcs if ":" not in x]
|
||||||
|
|
||||||
cidrs = []
|
cidrs = []
|
||||||
for zs in srcs:
|
for zs in srcs:
|
||||||
if not zs.endswith("."):
|
if not zs.endswith("."):
|
||||||
|
|
|
@ -490,6 +490,11 @@ while IFS= read -r f; do
|
||||||
tmv "$f"
|
tmv "$f"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
grep -rlE '^class [^(]+:' |
|
||||||
|
while IFS= read -r f; do
|
||||||
|
ised 's/(^class [^(:]+):/\1(object):/' "$f"
|
||||||
|
done
|
||||||
|
|
||||||
# up2k goes from 28k to 22k laff
|
# up2k goes from 28k to 22k laff
|
||||||
awk 'BEGIN{gensub(//,"",1)}' </dev/null 2>/dev/null &&
|
awk 'BEGIN{gensub(//,"",1)}' </dev/null 2>/dev/null &&
|
||||||
echo entabbening &&
|
echo entabbening &&
|
||||||
|
|
Loading…
Reference in a new issue