* shitty upload
parent
b193967e50
commit
940030ed7b
22
main.py
22
main.py
|
@ -11,7 +11,7 @@ from fuse import FUSE, FuseOSError, Operations, fuse_get_context
|
|||
releases = []
|
||||
assets = {}
|
||||
headers = {"Authorization":"token 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"}
|
||||
repo = "owosoftware"
|
||||
repo = "iwisoftware"
|
||||
files=[{"fd":0}]
|
||||
|
||||
def getReleases():
|
||||
|
@ -84,9 +84,9 @@ class Passthrough(Operations):
|
|||
st_mode = 0o100000
|
||||
st_size = 0
|
||||
else:
|
||||
st_mode = 0o0
|
||||
st_mode = 0o100000
|
||||
st_size = 0
|
||||
|
||||
print(st_mode, st_size)
|
||||
return {'st_atime': 1,
|
||||
'st_ctime': 1,
|
||||
'st_gid': 1000,
|
||||
|
@ -189,12 +189,24 @@ class Passthrough(Operations):
|
|||
_h = headers
|
||||
_h["Range"] = "bytes=" + str(len(f["buffer"])) + "-" + str(len(f["buffer"]) + 10485760) # 5MB
|
||||
_h["Accept"] = "application/octet-stream"
|
||||
a = requests.get("https://api.github.com/repos/DomiOwO/" + repo + "/releases/assets/" + str(assets[path.split("/")[-2]][path.split("/")[-1]]["id"]), headers=headers);
|
||||
a = requests.get("https://api.github.com/repos/DomiOwO/" + repo + "/releases/assets/" + str(assets[path.split("/")[-2]][path.split("/")[-1]]["id"]),
|
||||
headers = _h);
|
||||
f["buffer"] += a.content
|
||||
return f["buffer"][offset:offset+length]
|
||||
|
||||
def write(self, path, buf, offset, fh):
|
||||
print("-- write: offset ", offset, " buf ", buf, " path ", path)
|
||||
_h = headers
|
||||
_h["Content-Type"] = "application/octet-stream"
|
||||
for i in releases:
|
||||
if i["name"] == path.split('/')[-2]:
|
||||
id = i["id"]
|
||||
break
|
||||
|
||||
a = requests.post("https://uploads.github.com/repos/DomiOwO/" + repo + "/releases/" + str(id) + "/assets?name=" + path.split('/')[-1],
|
||||
data = buf,
|
||||
headers = _h)
|
||||
print(a.content)
|
||||
return 0
|
||||
|
||||
def truncate(self, path, length, fh=None):
|
||||
|
@ -207,7 +219,7 @@ class Passthrough(Operations):
|
|||
|
||||
def release(self, path, fh):
|
||||
print("-- release/close")
|
||||
del(files[fileByFd(fh)])
|
||||
#del(files[fileByFd(fh)])
|
||||
|
||||
def fsync(self, path, fdatasync, fh):
|
||||
print("-- fsync")
|
||||
|
|
Loading…
Reference in New Issue