-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
72430db
commit dc09df9
Showing
18 changed files
with
84 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,9 +16,9 @@ | |
from fastapi.responses import JSONResponse | ||
from pydantic import ValidationError | ||
|
||
from ranx.api import auth | ||
from ranx.constants import RAN_DOMAIN # ran.so | ||
from ranx.state import kill_server | ||
from ranlibx.api import auth | ||
from ranlibx.constants import RAN_DOMAIN # ran.so | ||
from ranlibx.state import kill_server | ||
|
||
app = FastAPI(title="RANx (Global)", contact={"name": "Anemo AI", "email": "[email protected]"}) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from ranlibx.cli.main import app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
from enum import Enum | ||
|
||
from ranx import server | ||
from ranlibx import server | ||
|
||
|
||
class AuthFlowState(Enum): | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/sh | ||
|
||
# Note: the reason this is here is because ranx should not go on conda-forge as it is not meant to be explicitly installed by the user; instead, it is more of a system dependency. | ||
# TODO: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import sys | ||
|
||
import hashlib | ||
from pathlib import Path | ||
|
||
import httpx | ||
|
||
|
||
CHANNEL_NAME = "anemo" | ||
channel: str = f"https://prefix.dev/api/v1/upload/{CHANNEL_NAME}" | ||
|
||
|
||
def upload(fn, token: str): | ||
data = fn.read_bytes() | ||
|
||
# if larger than 100mb, skip | ||
if len(data) > 100 * 1024 * 1024: | ||
print("Skipping", fn, "because it is too large") | ||
return | ||
|
||
name = fn.name | ||
sha256 = hashlib.sha256(data).hexdigest() | ||
headers = { | ||
"X-File-Name": name, | ||
"X-File-SHA256": sha256, | ||
"Authorization": f"Bearer {token}", | ||
"Content-Length": str(len(data) + 1), | ||
"Content-Type": "application/octet-stream", | ||
} | ||
|
||
r = httpx.post(channel, data=data, headers=headers) | ||
print(f"Uploaded package {name} with status {r.status_code}") | ||
|
||
|
||
if __name__ == "__main__": | ||
if len(sys.argv) > 2: | ||
package = Path(sys.argv[1]) # get path | ||
token: str = f"pfx_vr2XPfxpByKvGVhzr{sys.argv[2]}" | ||
upload(package, token) | ||
else: | ||
print("Usage: upload-prefixdev.py <package> <token>") | ||
sys.exit(1) |