mirror of
https://github.com/aykhans/portfolio-blog.git
synced 2025-09-08 15:10:45 +00:00
Changed static folder path
This commit is contained in:
@@ -15,6 +15,8 @@ class Settings(BaseSettings):
|
||||
APP_PATH: Path = MAIN_PATH / 'app' # path to app folder
|
||||
MEDIA_FOLDER: Path = Path('media') # name of media folder
|
||||
MEDIA_PATH: Path = MAIN_PATH / MEDIA_FOLDER # path to media folder
|
||||
STATIC_FOLDER_NAME: Path = Path('static') # name of static folder
|
||||
STATIC_FOLDER: Path = MAIN_PATH / STATIC_FOLDER_NAME # path to static folder
|
||||
|
||||
FILE_FOLDERS: dict[str, Path] = {
|
||||
'post_images': Path('post_images'),
|
||||
|
@@ -34,7 +34,7 @@ app = FastAPI(
|
||||
|
||||
# app.mount(
|
||||
# '/static',
|
||||
# StaticFiles(directory=settings.APP_PATH / 'static'),
|
||||
# StaticFiles(directory=settings.MAIN_PATH / 'static'),
|
||||
# name='static'
|
||||
# )
|
||||
|
||||
|
14435
src/app/static/bootstrap/css/bootstrap.min.css
vendored
14435
src/app/static/bootstrap/css/bootstrap.min.css
vendored
File diff suppressed because it is too large
Load Diff
6
src/app/static/bootstrap/js/bootstrap.min.js
vendored
6
src/app/static/bootstrap/js/bootstrap.min.js
vendored
File diff suppressed because one or more lines are too long
Binary file not shown.
4
src/app/static/fonts/font-awesome.min.css
vendored
4
src/app/static/fonts/font-awesome.min.css
vendored
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Before Width: | Height: | Size: 434 KiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 190 KiB |
Binary file not shown.
Before Width: | Height: | Size: 4.5 KiB |
@@ -1,36 +0,0 @@
|
||||
(function() {
|
||||
"use strict"; // Start of use strict
|
||||
|
||||
// Show the navbar when the page is scrolled up
|
||||
var MQL = 992;
|
||||
var vw = Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0);
|
||||
var mainNav = document.querySelector('#mainNav');
|
||||
|
||||
//primary navigation slide-in effect
|
||||
if (mainNav && vw > MQL) {
|
||||
var headerHeight = mainNav.offsetHeight;
|
||||
var previousTop = window.pageYOffset;
|
||||
|
||||
window.addEventListener('scroll', function() {
|
||||
var currentTop = window.pageYOffset;
|
||||
//check if user is scrolling up
|
||||
if (currentTop < previousTop) {
|
||||
//if scrolling up...
|
||||
if (currentTop > 0 && mainNav.classList.contains('is-fixed')) {
|
||||
mainNav.classList.add('is-visible');
|
||||
} else {
|
||||
mainNav.classList.remove('is-visible', 'is-fixed');
|
||||
}
|
||||
} else if (currentTop > previousTop) {
|
||||
//if scrolling down...
|
||||
mainNav.classList.remove('is-visible');
|
||||
|
||||
if (currentTop > headerHeight && !mainNav.classList.contains('is-fixed')) {
|
||||
mainNav.classList.add('is-fixed');
|
||||
}
|
||||
}
|
||||
previousTop = currentTop;
|
||||
});
|
||||
}
|
||||
|
||||
})(); // End of use strict
|
@@ -34,3 +34,44 @@
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
||||
<!-- <!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Login Example</title>
|
||||
</head>
|
||||
<body>
|
||||
<form id="loginForm">
|
||||
<input type="text" name="email" placeholder="email">
|
||||
<input type="password" name="password" placeholder="Password">
|
||||
<button type="submit">Login</button>
|
||||
</form>
|
||||
|
||||
<script>
|
||||
// Function to handle the form submission
|
||||
function handleSubmit(event) {
|
||||
event.preventDefault();
|
||||
const form = document.getElementById('loginForm');
|
||||
const formData = new FormData(form);
|
||||
|
||||
fetch('/login', {
|
||||
method: 'POST', // Adjust the HTTP method if needed
|
||||
body: formData,
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
const accessToken = data.access_token;
|
||||
console.log(accessToken);
|
||||
document.cookie = `access_token=${accessToken}`;
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Login error:', error);
|
||||
});
|
||||
}
|
||||
|
||||
// Add a submit event listener to the form
|
||||
const loginForm = document.getElementById('loginForm');
|
||||
loginForm.addEventListener('submit', handleSubmit);
|
||||
</script>
|
||||
</body>
|
||||
</html> -->
|
||||
|
@@ -4,7 +4,7 @@ from datetime import timedelta
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
|
||||
from fastapi.templating import Jinja2Templates
|
||||
from fastapi.responses import HTMLResponse
|
||||
from fastapi.responses import FileResponse, HTMLResponse
|
||||
from fastapi import (
|
||||
APIRouter,
|
||||
HTTPException,
|
||||
@@ -45,7 +45,7 @@ async def login(
|
||||
async def login(
|
||||
db: AsyncSession = Depends(get_async_db),
|
||||
form_data: LoginForm = Depends()
|
||||
) -> Any:
|
||||
):
|
||||
|
||||
user = await crud.user.authenticate(
|
||||
db, email=form_data.email, password=form_data.password
|
||||
@@ -68,10 +68,9 @@ async def login(
|
||||
}
|
||||
|
||||
|
||||
# @router.get("/test")
|
||||
# def test(
|
||||
# request: Request,
|
||||
# user: UserModel = Depends(get_current_active_superuser),
|
||||
# ) -> Any:
|
||||
@router.get("/admin")
|
||||
def admin(
|
||||
request: Request
|
||||
):
|
||||
|
||||
# return user.email
|
||||
return FileResponse(settings.STATIC_FOLDER / 'just_a.gif')
|
Reference in New Issue
Block a user