Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check the other thing #2

Merged
merged 5 commits into from
Nov 8, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,19 @@ The easiest way to get started is to use the docker image. This will give you a

```shell

<<<<<<< Updated upstream
docker-compose up -d
=======
docker compose up -d
docker logs neptyne-spreadsheet-neptyne-1
>>>>>>> Stashed changes

```

Only need to build it once. After that, you can just run `docker-compose up`.
The second statement will print out the shared secret you need to connect to the Neptyne server.
Open that url and you are in business.

```shell

### Method 2: pip install

Expand Down
196 changes: 0 additions & 196 deletions frontend/src/neptyne-container/NeptyneModals.test.tsx

This file was deleted.

2 changes: 2 additions & 0 deletions neptyne_kernel/neptyne_api/geo.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from functools import partial, wraps
from typing import Any, Callable


import geopandas
import numpy as np
import pyproj
Expand Down Expand Up @@ -99,6 +100,7 @@ def dataset(name_or_url: str) -> GeoDataFrame:
path = geopandas.datasets.get_path(name_or_url)
else:
import geoplot

try:
path = geoplot.datasets.get_path(name_or_url)
except ValueError:
Expand Down
11 changes: 8 additions & 3 deletions server/users.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
from typing import Any, Literal

from jwt import PyJWTError
from sqlalchemy import func
from sqlalchemy.orm import Session
from tornado import web
from tornado_sqlalchemy import SessionMixin

from server.gsheet_auth import decode_gsheet_extension_token
from server.models import (
EmailShare,
FirebaseUser,
Expand All @@ -19,7 +21,7 @@
def token_from_headers(request_handler: web.RequestHandler) -> str | None:
header = request_handler.request.headers.get("Authorization")
if not header:
return None
return request_handler.request.headers.get("X-Neptyne-GSheet-Auth-Token")

parts = header.split(" ")
if len(parts) != 2 or parts[0].lower() != "bearer":
Expand Down Expand Up @@ -55,8 +57,11 @@ async def _authenticate_request(
)
if not token:
raise web.HTTPError(401, "Missing token")
if not token == shared_secret: # TODO: also check for a signed token
raise web.HTTPError(401, "Invalid token")
if not token == shared_secret:
try:
decode_gsheet_extension_token(token)
except PyJWTError:
raise web.HTTPError(401, "Invalid token")
return await load_user(
session,
"<single-user-firebase-uid>",
Expand Down
Loading