Compare commits
3 Commits
906674fcdb
...
75b99251eb
Author | SHA1 | Date | |
---|---|---|---|
75b99251eb | |||
225c80f2f9 | |||
c693756a43 |
@@ -76,7 +76,23 @@ async def photo_upload(file: UploadFile, album: str, ignore_duplicates: bool = F
|
|||||||
)
|
)
|
||||||
|
|
||||||
coords = extract_location(path.join("data", "users", current_user.user, "albums", album, filename))
|
coords = extract_location(path.join("data", "users", current_user.user, "albums", album, filename))
|
||||||
uploaded = col_photos.insert_one( {"user": current_user.user, "album": album, "hash": file_hash, "filename": filename, "location": [coords["lng"], coords["lat"], coords["alt"]]} )
|
uploaded = col_photos.insert_one(
|
||||||
|
{
|
||||||
|
"user": current_user.user,
|
||||||
|
"album": album,
|
||||||
|
"hash": file_hash,
|
||||||
|
"filename": filename,
|
||||||
|
"dates": {
|
||||||
|
"uploaded": datetime.utcnow(),
|
||||||
|
"modifies": datetime.utcnow()
|
||||||
|
},
|
||||||
|
"location": [
|
||||||
|
coords["lng"],
|
||||||
|
coords["lat"],
|
||||||
|
coords["alt"]
|
||||||
|
]
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
if compress is True:
|
if compress is True:
|
||||||
scheduler.add_job(compress_image, trigger="date", run_date=datetime.now()+timedelta(seconds=1), args=[path.join("data", "users", current_user.user, "albums", album, filename)])
|
scheduler.add_job(compress_image, trigger="date", run_date=datetime.now()+timedelta(seconds=1), args=[path.join("data", "users", current_user.user, "albums", album, filename)])
|
||||||
@@ -128,7 +144,7 @@ async def photo_move(id: str, album: str, current_user: User = Security(get_curr
|
|||||||
else:
|
else:
|
||||||
filename = image["filename"]
|
filename = image["filename"]
|
||||||
|
|
||||||
col_photos.find_one_and_update( {"_id": ObjectId(id)}, {"$set": {"album": album, "filename": filename}} )
|
col_photos.find_one_and_update( {"_id": ObjectId(id)}, {"$set": {"album": album, "filename": filename, "dates.modified": datetime.utcnow()}} )
|
||||||
|
|
||||||
move(
|
move(
|
||||||
path.join("data", "users", current_user.user, "albums", image["album"], image["filename"]),
|
path.join("data", "users", current_user.user, "albums", image["album"], image["filename"]),
|
||||||
|
@@ -50,7 +50,7 @@ if configGet("registration_requires_confirmation") is True:
|
|||||||
|
|
||||||
if configGet("registration_enabled") is True:
|
if configGet("registration_enabled") is True:
|
||||||
@app.post("/users")
|
@app.post("/users")
|
||||||
async def user_create(user: str, email: str, password: str):
|
async def user_create(user: str = Form(), email: str = Form(), password: str = Form()):
|
||||||
if col_users.find_one( {"user": user} ) is not None:
|
if col_users.find_one( {"user": user} ) is not None:
|
||||||
return HTTPException(HTTP_406_NOT_ACCEPTABLE, detail=configGet("user_already_exists", "messages"))
|
return HTTPException(HTTP_406_NOT_ACCEPTABLE, detail=configGet("user_already_exists", "messages"))
|
||||||
col_users.insert_one( {"user": user, "email": email, "hash": get_password_hash(password), "disabled": configGet("registration_requires_confirmation")} )
|
col_users.insert_one( {"user": user, "email": email, "hash": get_password_hash(password), "disabled": configGet("registration_requires_confirmation")} )
|
||||||
|
@@ -6,6 +6,7 @@ from magic import Magic
|
|||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from os import makedirs, path, remove
|
from os import makedirs, path, remove
|
||||||
from classes.models import Video, SearchResults
|
from classes.models import Video, SearchResults
|
||||||
|
#from modules.unified_exif_reader import extract_location
|
||||||
from modules.security import User, get_current_active_user
|
from modules.security import User, get_current_active_user
|
||||||
from modules.app import app
|
from modules.app import app
|
||||||
from modules.database import col_videos, col_albums, col_tokens
|
from modules.database import col_videos, col_albums, col_tokens
|
||||||
@@ -49,8 +50,24 @@ async def video_upload(file: UploadFile, album: str, current_user: User = Securi
|
|||||||
# },
|
# },
|
||||||
# status_code=HTTP_409_CONFLICT
|
# status_code=HTTP_409_CONFLICT
|
||||||
# )
|
# )
|
||||||
|
|
||||||
uploaded = col_videos.insert_one( {"user": current_user.user, "album": album, "filename": filename} )
|
#coords = extract_location(path.join("data", "users", current_user.user, "albums", album, filename))
|
||||||
|
uploaded = col_videos.insert_one(
|
||||||
|
{
|
||||||
|
"user": current_user.user,
|
||||||
|
"album": album,
|
||||||
|
"filename": filename,
|
||||||
|
"dates": {
|
||||||
|
"uploaded": datetime.utcnow(),
|
||||||
|
"modifies": datetime.utcnow()
|
||||||
|
},
|
||||||
|
# "location": [
|
||||||
|
# coords["lng"],
|
||||||
|
# coords["lat"],
|
||||||
|
# coords["alt"]
|
||||||
|
# ]
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
return UJSONResponse(
|
return UJSONResponse(
|
||||||
{
|
{
|
||||||
@@ -98,7 +115,7 @@ async def video_move(id: str, album: str, current_user: User = Security(get_curr
|
|||||||
else:
|
else:
|
||||||
filename = video["filename"]
|
filename = video["filename"]
|
||||||
|
|
||||||
col_videos.find_one_and_update( {"_id": ObjectId(id)}, {"$set": {"album": album, "filename": filename}} )
|
col_videos.find_one_and_update( {"_id": ObjectId(id)}, {"$set": {"album": album, "filename": filename, "dates.modified": datetime.utcnow()}} )
|
||||||
|
|
||||||
move(
|
move(
|
||||||
path.join("data", "users", current_user.user, "albums", video["album"], video["filename"]),
|
path.join("data", "users", current_user.user, "albums", video["album"], video["filename"]),
|
||||||
|
@@ -1,10 +1,10 @@
|
|||||||
fastapi[all]
|
fastapi[all]
|
||||||
pymongo==4.3.3
|
pymongo==4.3.3
|
||||||
ujson~=5.6.0
|
ujson~=5.7.0
|
||||||
scipy~=1.9.3
|
scipy~=1.9.3
|
||||||
python-magic~=0.4.27
|
python-magic~=0.4.27
|
||||||
opencv-python~=4.6.0.66
|
opencv-python~=4.6.0.68
|
||||||
python-jose[cryptography]~=3.3.0
|
python-jose[cryptography]~=3.3.0
|
||||||
passlib~=1.7.4
|
passlib~=1.7.4
|
||||||
apscheduler~=3.9.1.post1
|
apscheduler~=3.9.1.post1
|
||||||
exif==1.4.2
|
exif==1.5.0
|
Reference in New Issue
Block a user