Fixes for working with local nodes

Got debug info, upload, and download working again for local nodes. Did not know adding more settings broke them.
This commit is contained in:
Kayvon-Martinez 2023-10-24 18:32:11 -05:00
parent 7e58d4acf4
commit eb9865ca2b
5 changed files with 15 additions and 10 deletions

1
.gitignore vendored
View File

@ -1,2 +1 @@
nim-codex/ nim-codex/
nim-codex-updated/

View File

@ -2,7 +2,7 @@
FROM node:18 as build-step FROM node:18 as build-step
WORKDIR /frontend WORKDIR /frontend
ENV PATH /frontend/node_modules/.bin:$PATH ENV PATH /frontend/node_modules/.bin:$PATH
COPY frontend/package.json frontend/yarn.lock frontend/tsconfig.json frontend/webpack.config.js ./ COPY frontend/package.json frontend/yarn.lock frontend/tsconfig.json ./
COPY frontend/src ./src COPY frontend/src ./src
COPY frontend/public ./public COPY frontend/public ./public
RUN yarn install RUN yarn install

View File

@ -10,14 +10,14 @@ A frontend for codex made with Flutter.
- Download with correct file name and extension - Download with correct file name and extension
- Persist the state (save recent upload list) - Persist the state (save recent upload list)
- Upload multiple files at once - Upload multiple files at once
- Settings for the connection
- Dockerize frontend
- Show status of locally running codex node
## Planned Features ## Planned Features
- Upload to codex nodes - Upload to codex nodes
- Settings for the connection
- Dockerize frontend
- Add support for marketplace endpoints - Add support for marketplace endpoints
- Show status of locally running codex node
- Show status of connection to codex peers - Show status of connection to codex peers
## How To Run It ## How To Run It

View File

@ -19,13 +19,17 @@ def upload():
base_url = request.headers.get('Base-Url') base_url = request.headers.get('Base-Url')
auth_string = request.headers.get('Auth-String') auth_string = request.headers.get('Auth-String')
# print(request.data) # print(request.data)
if auth_string is not None:
auth = tuple(auth_string.split(':'))
else:
auth = None
response = requests.post( response = requests.post(
f'{base_url}/api/codex/v1/upload', f'{base_url}/api/codex/v1/upload',
data=bytes, data=bytes,
headers={ headers={
'Content-Type': 'application/octet-stream' 'Content-Type': 'application/octet-stream'
}, },
auth=(auth_string.split(':')[0], auth_string.split(':')[1]) auth=auth
) )
print(response.status_code) print(response.status_code)
print(response.text) print(response.text)

View File

@ -23,10 +23,12 @@ function DebugPage() {
nodeInfo.nodeToConnectTo || nodeInfo.baseUrl nodeInfo.nodeToConnectTo || nodeInfo.baseUrl
}/api/codex/v1/debug/info`, }/api/codex/v1/debug/info`,
{ {
headers: { headers:
(nodeInfo.auth && {
Authorization: Authorization:
(nodeInfo.auth && "Basic " + btoa(nodeInfo.auth)) || "", (nodeInfo.auth && "Basic " + btoa(nodeInfo.auth)) || "",
}, }) ||
{},
} }
) )
.then((response) => { .then((response) => {