From 0bd53e29cd7abb3b629196a58b076db94e10868a Mon Sep 17 00:00:00 2001 From: root Date: Wed, 12 Aug 2020 11:48:52 +0000 Subject: [PATCH] added http to meta to hanve https or http --- app/main.py | 5 +++-- app/requirements.txt | 9 +++++++++ app/site/site.yaml | 3 ++- app/templates/edit_essay.html | 2 +- app/templates/edit_exhibit.html | 6 +++--- app/templates/edit_item.html | 6 ++++-- start_docker | 1 + 7 files changed, 23 insertions(+), 9 deletions(-) diff --git a/app/main.py b/app/main.py index 34d5770..b073b50 100644 --- a/app/main.py +++ b/app/main.py @@ -15,9 +15,10 @@ from pathlib import Path from bs4 import BeautifulSoup from slugify import slugify - +from routers.fastAPI_socialauth import fastAPI_socialauth app = FastAPI() +app.include_router(fastAPI_socialauth.router) #app.add_middleware(HTTPSRedirectMiddleware) app_path = Path.cwd() @@ -530,7 +531,7 @@ async def create_upload_file(upload: bytes = File("upload")): async def websocket_endpoint(websocket: WebSocket): await websocket.accept() while True: - + print('is websocket') data = await websocket.receive_text() keys = ["type","slug", "title", "author", "text","grid"] data = dict(zip(keys, data.split("πŸ’ΎπŸ₯ž")[1:])) diff --git a/app/requirements.txt b/app/requirements.txt index 985ebc3..83036a7 100644 --- a/app/requirements.txt +++ b/app/requirements.txt @@ -4,13 +4,21 @@ certifi==2020.4.5.1 click==7.1.1 coolname==1.1.0 fastapi==0.54.1 +google==2.0.2 +google-api-python-client==1.7.8 +google-auth==1.6.3 +google-auth-httplib2==0.0.3 +google-auth-oauthlib==0.3.0 h11==0.9.0 httptools==0.1.1 Jinja2==2.11.2 MarkupSafe==1.1.1 +oauth2client==4.1.3 +passlib pydantic==1.5.1 python-slugify==4.0.0 python-multipart +python-jose==3.2.0 PyYAML==5.3.1 soupsieve==2.0 starlette==0.13.2 @@ -19,3 +27,4 @@ Unidecode==1.1.1 uvicorn==0.11.3 uvloop==0.14.0 websockets==8.1 +httplib2 diff --git a/app/site/site.yaml b/app/site/site.yaml index 8c5b507..2e861f7 100644 --- a/app/site/site.yaml +++ b/app/site/site.yaml @@ -1,9 +1,10 @@ --- - course_name: "World History at Global Scale" + course_name: "Global History of Geese" course_id: "HIST101" description: "A class for all who live on this blue marble." url: "blini.apjan.co" + http: "https" dev: true # change header/footer gradient css? #theme: fun diff --git a/app/templates/edit_essay.html b/app/templates/edit_essay.html index 606add2..bb43b6f 100644 --- a/app/templates/edit_essay.html +++ b/app/templates/edit_essay.html @@ -109,7 +109,7 @@ licenseKey: '', simpleUpload: { // The URL the images are uploaded to. - uploadUrl: 'http://{{ meta.url }}/images', + uploadUrl: '{{ meta.http }}://{{ meta.url }}/images', // Headers sent along with the XMLHttpRequest to the upload server. }, diff --git a/app/templates/edit_exhibit.html b/app/templates/edit_exhibit.html index 48e4f58..3cb4276 100644 --- a/app/templates/edit_exhibit.html +++ b/app/templates/edit_exhibit.html @@ -173,7 +173,7 @@ if (typeof files !== "undefined") { fd.append('file',files); fd.append('filename', files.name); - request.open("POST", "https://{{ meta.url }}/item_images"); + request.open("POST", "{{ meta.http }}://{{ meta.url }}/item_images"); request.send(fd); let ur = request.response; let url = ur.slice(2,-2); @@ -375,7 +375,7 @@ licenseKey: '', simpleUpload: { // The URL the images are uploaded to. - uploadUrl: 'http://{{ meta.url }}/images', + uploadUrl: '{{ meta.http }}://{{ meta.url }}/images', // Headers sent along with the XMLHttpRequest to the upload server. }, @@ -623,7 +623,7 @@ licenseKey: '', simpleUpload: { // The URL the images are uploaded to. - uploadUrl: 'http://{{ meta.url }}/images', + uploadUrl: '{{ meta.http }}://{{ meta.url }}/images', // Headers sent along with the XMLHttpRequest to the upload server. }, diff --git a/app/templates/edit_item.html b/app/templates/edit_item.html index cd3d1cd..a0d4baf 100644 --- a/app/templates/edit_item.html +++ b/app/templates/edit_item.html @@ -46,6 +46,7 @@