From 5e2c41d1dc8693eeb0648bd02e6bcd882de02bea Mon Sep 17 00:00:00 2001 From: Davidhero Date: Mon, 23 Sep 2024 17:32:39 +0100 Subject: [PATCH 1/7] refactor: new changes --- app/controllers/controllers.py | 6 +++--- app/service/service.py | 4 ++-- app/templates/profile.html | 2 +- main.py | 10 +++++++++- 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/app/controllers/controllers.py b/app/controllers/controllers.py index 062bf34..650ad4d 100644 --- a/app/controllers/controllers.py +++ b/app/controllers/controllers.py @@ -87,18 +87,18 @@ async def get_user_domains( ) -@router.get("/domains/{name}", response_model=PaginatedSubDomainsResponse) +@router.get("/domains/{id}", response_model=PaginatedSubDomainsResponse) @limiter.limit("10/minute") async def read_user_domain( request: Request, - name: str, + id: int, skip: int = Query(0, ge=0), limit: int = Query(10, ge=1, le=100), current_user: User = Depends(get_user_from_cookie), db: Session = Depends(get_database) ): domain, total_subdomains = get_user_domain_with_subdomains( - db, current_user, name, skip, limit) + db, current_user, id, skip, limit) if domain is None: raise HTTPException(status_code=404, detail="Domain cannot be found") return PaginatedSubDomainsResponse( diff --git a/app/service/service.py b/app/service/service.py index da7bbdb..b5efcd7 100644 --- a/app/service/service.py +++ b/app/service/service.py @@ -182,9 +182,9 @@ def get_user_domains(db: Session, user: User, skip: int = 0, limit: int = 10) -> return domains, total -def get_user_domain_with_subdomains(db: Session, user: User, domain_name: str, skip: int = 0, limit: int = 10) -> Tuple[Domain, int]: +def get_user_domain_with_subdomains(db: Session, user: User, id: int, skip: int = 0, limit: int = 10) -> Tuple[Domain, int]: domain:Domain = db.query(Domain).filter( - Domain.domain_name == domain_name, + Domain.id == id, Domain.user_id == user.id ).first() diff --git a/app/templates/profile.html b/app/templates/profile.html index 8c3f00c..59866ad 100644 --- a/app/templates/profile.html +++ b/app/templates/profile.html @@ -9,7 +9,7 @@
-

User Profile

+

Hi, {{ name }}

Email: {{ user.email }}

Member since: {{ user.createdDate.strftime('%B %d, %Y') }}

diff --git a/main.py b/main.py index 5a74c4b..514e4ff 100644 --- a/main.py +++ b/main.py @@ -52,7 +52,8 @@ async def user_profile_page(request: Request, current_user: User = Depends(get_u return templates.TemplateResponse(request=request, name="profile.html", context={ "request": request, "user": current_user, - "search": current_user.domains + "search": current_user.domains, + "name": get_name_from_email(current_user.email) }) @@ -105,5 +106,12 @@ async def add_no_cache_headers(request: Request, call_next): response.headers["Expires"] = "0" return response + +def get_name_from_email(email): + at_index = email.find('@') + if at_index != -1: + return email[:at_index] + return email + if __name__ == "__main__": uvicorn.run("main:app", host="0.0.0.0", port=8000, reload=True) From a8f138e03e31133507d2c3ede80a327f99a8d020 Mon Sep 17 00:00:00 2001 From: Davidhero Date: Mon, 23 Sep 2024 18:02:07 +0100 Subject: [PATCH 2/7] refactor: new changes --- app/controllers/controllers.py | 23 +++++------ app/static/js/login.js | 71 ++++------------------------------ 2 files changed, 20 insertions(+), 74 deletions(-) diff --git a/app/controllers/controllers.py b/app/controllers/controllers.py index 650ad4d..b62f35d 100644 --- a/app/controllers/controllers.py +++ b/app/controllers/controllers.py @@ -63,6 +63,7 @@ def handle_login_user(data: LoginData, request: Request, response: Response, db: ) return data + @router.get("/profile/me") @limiter.limit("5/minute") def my_profile(request: Request, user: User = Depends(get_user_from_cookie), db: Session = Depends(get_database)): @@ -72,7 +73,7 @@ def my_profile(request: Request, user: User = Depends(get_user_from_cookie), db: @router.get("/domains", response_model=PaginatedDomainsResponse) @limiter.limit("10/minute") async def get_user_domains( - request:Request, + request: Request, skip: int = Query(0, ge=0), limit: int = Query(10, ge=1, le=100), current_user: User = Depends(get_user_from_cookie), @@ -87,7 +88,7 @@ async def get_user_domains( ) -@router.get("/domains/{id}", response_model=PaginatedSubDomainsResponse) +@router.get("/domains/{id}") @limiter.limit("10/minute") async def read_user_domain( request: Request, @@ -101,17 +102,17 @@ async def read_user_domain( db, current_user, id, skip, limit) if domain is None: raise HTTPException(status_code=404, detail="Domain cannot be found") - return PaginatedSubDomainsResponse( - domain=domain, - sub_domains=domain.sub_domains, - total_subdomains=total_subdomains, - skip=skip, - limit=limit - ) + return { + "domain": domain, + "sub_domains": domain.sub_domains, + "total_subdomains": total_subdomains, + "skip": skip, + "limit": limit + } @router.get("/domain/check-updates") @limiter.limit("5/minute") -async def get_domain_updates(request:Request, domain:str, user:User = Depends(get_user_from_cookie), db:Session = Depends(get_database)): +async def get_domain_updates(request: Request, domain: str, user: User = Depends(get_user_from_cookie), db: Session = Depends(get_database)): data = await get_updated_domains(db=db, domain=domain, user=user) - return SubdomainSearchResponse(**data) \ No newline at end of file + return SubdomainSearchResponse(**data) diff --git a/app/static/js/login.js b/app/static/js/login.js index 34a4337..47396aa 100644 --- a/app/static/js/login.js +++ b/app/static/js/login.js @@ -24,74 +24,28 @@ document.addEventListener("DOMContentLoaded", function () { console.log(email); const password = document.getElementById("login-password").value; console.log(password); - // document.getElementById("loginMessage").textContent = - // HandleAuthInputValidation(email, password, "loginMessage"); + document.getElementById("loginMessage").textContent = + HandleAuthInputValidation(email, password, "loginMessage"); const data = await handleAuthRequest(email, password, "login") // const data = await loginRequest(email, password) document.getElementById("loginMessage").textContent = data - // try { - // const response = await fetch("/api/v1/token", { - // method: "POST", - // headers: { "Content-Type": "application/x-www-form-urlencoded" }, - // body: `email=${encodeURIComponent( - // email - // )}&password=${encodeURIComponent(password)}`, - // }); - // if (response.ok) { - // window.location.href = "/profile"; - // } else { - // const data = await response.json(); - // document.getElementById("loginMessage").textContent = - // data.detail || "Login failed"; - // } - // } catch (error) { - // console.error("Login error:", error); - // document.getElementById("loginMessage").textContent = - // "An error occurred. Please try again."; - // } }); document .querySelector("#registerForm form") .addEventListener("submit", async (e) => { e.preventDefault(); - // const username = document.getElementById("register-username").value; const email = document.getElementById("register-email").value; const password = document.getElementById("register-password").value; - const confirmPassword = document.getElementById( - "register-confirm-password" - ).value; - - if (password !== confirmPassword) { - document.getElementById("registerMessage").textContent = - "Passwords do not match"; - return; - } - - try { - const response = await fetch("/api/v1/users", { - method: "POST", - headers: { "Content-Type": "application/json" }, - body: JSON.stringify({ email, password }), - }); - if (response.ok) { - document.getElementById("registerMessage").textContent = - "Registration successful! Please login."; - } else { - const data = await response.json(); - document.getElementById("registerMessage").textContent = - data.detail || "Registration failed"; - } - } catch (error) { - console.error("Registration error:", error); - document.getElementById("registerMessage").textContent = - "An error occurred. Please try again."; - } + + document.getElementById("registerMessage").textContent = + HandleAuthInputValidation(email, password, "registerMessage"); + const data = await handleAuthRequest(email, password, "signup"); + document.getElementById("registerMessage").textContent = data; }); }); function HandleAuthInputValidation(email, password, element) { - console.log("hello here", email); const messageElement = document.getElementById(element); messageElement.textContent = ""; @@ -132,13 +86,4 @@ export async function handleAuthRequest(email, password, type) { alert(error); console.log(error); } -} - - -/* -test data -{ - "email": "a11@gmail.com", - "password": "some_password" -} -*/ \ No newline at end of file +} \ No newline at end of file From adabc1f7ea03ec89862d27711f76d957a3a27fc0 Mon Sep 17 00:00:00 2001 From: Davidhero Date: Mon, 23 Sep 2024 18:08:10 +0100 Subject: [PATCH 3/7] base: making progress --- app/static/css/profile.css | 70 ++++++++++++++++++++-- app/static/js/profile.js | 118 ++++++++++++++++++++++++++++++++++--- app/templates/profile.html | 13 +++- 3 files changed, 187 insertions(+), 14 deletions(-) diff --git a/app/static/css/profile.css b/app/static/css/profile.css index a46f09a..4fca163 100644 --- a/app/static/css/profile.css +++ b/app/static/css/profile.css @@ -1,25 +1,28 @@ -.domain-table { +.domain-table, .subdomain-table { width: 100%; border-collapse: collapse; margin-top: 20px; } -.domain-table th, .domain-table td { +.domain-table th, .domain-table td, +.subdomain-table th, .subdomain-table td { border: 1px solid #ddd; padding: 12px; text-align: left; } -.domain-table th { +.domain-table th, .subdomain-table th { background-color: #f2f2f2; font-weight: bold; } -.domain-table tr:nth-child(even) { +.domain-table tr:nth-child(even), +.subdomain-table tr:nth-child(even) { background-color: #f9f9f9; } -.domain-table tr:hover { +.domain-table tr:hover, +.subdomain-table tr:hover { background-color: #f5f5f5; } @@ -43,4 +46,61 @@ .view-btn:hover, .delete-btn:hover { opacity: 0.8; +} + +#pagination { + margin-top: 20px; + text-align: center; +} + +#pagination button, #pagination span { + margin: 0 5px; + padding: 5px 10px; + border: 1px solid #ddd; + background-color: #f8f8f8; + cursor: pointer; +} + +#pagination span { + background-color: #4CAF50; + color: white; + border-color: #4CAF50; +} + +#pagination button:hover { + background-color: #ddd; +} + +.modal { + display: none; + position: fixed; + z-index: 1; + left: 0; + top: 0; + width: 100%; + height: 100%; + overflow: auto; + background-color: rgba(0,0,0,0.4); +} + +.modal-content { + background-color: #fefefe; + margin: 15% auto; + padding: 20px; + border: 1px solid #888; + width: 80%; +} + +.close { + color: #aaa; + float: right; + font-size: 28px; + font-weight: bold; +} + +.close:hover, +.close:focus { + color: black; + text-decoration: none; + cursor: pointer; } \ No newline at end of file diff --git a/app/static/js/profile.js b/app/static/js/profile.js index 5571797..2bfb2a9 100644 --- a/app/static/js/profile.js +++ b/app/static/js/profile.js @@ -1,9 +1,113 @@ -function checkIfTokenPresent(){ - const h = new Headers().get('dom_explorer') - console.log(h) - const token = document.cookie - console.log(token) - console.log("hello world") +let currentDomainId = null; +let currentPage = 1; +const itemsPerPage = 10; + +document.addEventListener("DOMContentLoaded", function () { + const modal = document.getElementById("subdomainModal"); + const closeBtn = modal.querySelector(".close"); + const viewButtons = document.querySelectorAll(".view-btn"); + + viewButtons.forEach((button) => { + button.addEventListener("click", function () { + currentDomainId = this.getAttribute("data-domain-id"); + currentPage = 1; + fetchSubdomains(currentDomainId, 0, itemsPerPage); + }); + }); + + closeBtn.addEventListener("click", function () { + modal.style.display = "none"; + }); + + window.addEventListener("click", function (event) { + if (event.target === modal) { + modal.style.display = "none"; + } + }); +}); + +async function fetchSubdomains(domainId, skip, limit) { + try { + const response = await fetch( + `/api/v1/domains/${domainId}?skip=${skip}&limit=${limit}` + ); + if (!response.ok) { + throw new Error("Failed to fetch subdomains"); + } + const data = await response.json(); + displaySubdomains(data); + } catch (error) { + console.error("Error:", error); + alert("Failed to fetch subdomains. Please try again."); + } } -checkIfTokenPresent() \ No newline at end of file +function displaySubdomains(data) { + const subdomainList = document.getElementById("subdomainList"); + const pagination = document.getElementById("pagination"); + const modal = document.getElementById("subdomainModal"); + + // Create table structure + let tableHTML = ` + + + + + + + + + + `; + + data.sub_domains.forEach((subdomain) => { + tableHTML += ` + + + + + + `; + }); + + tableHTML += ` + +
Subdomain NameStatusCreated Date
${subdomain.name}${subdomain.isActive ? "Active" : "Active"}${new Date(subdomain.createdDate).toLocaleString()}
+ `; + + subdomainList.innerHTML = tableHTML; + updatePagination(data); + modal.style.display = "block"; +} + +function updatePagination(data) { + const pagination = document.getElementById("pagination"); + pagination.innerHTML = ""; + const totalPages = Math.ceil(data.total_subdomains / itemsPerPage); + + if (currentPage > 1) { + pagination.innerHTML += ``; + } + + for (let i = 1; i <= totalPages; i++) { + if (i === currentPage) { + pagination.innerHTML += `${i}`; + } else { + pagination.innerHTML += ``; + } + } + + if (currentPage < totalPages) { + pagination.innerHTML += ``; + } +} + +function changePage(newPage) { + currentPage = newPage; + const skip = (currentPage - 1) * itemsPerPage; + fetchSubdomains(currentDomainId, skip, itemsPerPage); +} diff --git a/app/templates/profile.html b/app/templates/profile.html index 59866ad..4cf106b 100644 --- a/app/templates/profile.html +++ b/app/templates/profile.html @@ -14,7 +14,7 @@

Member since: {{ user.createdDate.strftime('%B %d, %Y') }}

-

Your Recent Searches

+

Your Domains

{% if search %} @@ -42,9 +42,18 @@

Your Recent Searches

{% else %} -

No recent searches found.

+

No domains found.

{% endif %} + +
{% endblock %} From 948584aa81c19a76b247c866ebc7e501365bd34e Mon Sep 17 00:00:00 2001 From: Davidhero Date: Mon, 23 Sep 2024 19:10:36 +0100 Subject: [PATCH 4/7] new changes --- app/controllers/controllers.py | 6 +-- app/service/search_enumerator.py | 2 + app/static/css/style.css | 91 +++++++++++++++++++++++++++----- app/static/js/login.js | 5 +- app/static/js/main.js | 63 ++++++++++++++++++++++ app/static/js/profile.js | 11 ++-- app/templates/base.html | 4 +- app/templates/index.html | 11 ++-- 8 files changed, 162 insertions(+), 31 deletions(-) diff --git a/app/controllers/controllers.py b/app/controllers/controllers.py index b62f35d..2f11015 100644 --- a/app/controllers/controllers.py +++ b/app/controllers/controllers.py @@ -9,7 +9,7 @@ from app.schema.schema import UserCreate, DomainResponse, Token, CreateUserResponse, LoginData, LoginResponse, PaginatedDomainsResponse, PaginatedSubDomainsResponse, SubdomainSearchResponse from app.database.database import User, Domain, SubDomain, get_database from app.service.search_enumerator import get_subdomain_data, get_updated_domains -from app.service.service import create_new_user, create_access_token, get_user_from_cookie, isAdmin, get_user, login_user, get_my_profile, get_user_domain_with_subdomains, get_user_domains +from app.service.service import create_new_user, create_access_token, get_user_from_cookie, isAdmin, get_user, login_user, get_my_profile, get_user_domain_with_subdomains, get_user_domains, get_auth_user router = APIRouter() @@ -44,7 +44,7 @@ def create_user(user: UserCreate, response: Response, request: Request, db: Sess httponly=True, secure=True, samesite="strict", - max_age=6*60 + max_age=14 * 24 * 60 * 60 ) return new_user @@ -59,7 +59,7 @@ def handle_login_user(data: LoginData, request: Request, response: Response, db: httponly=True, secure=True, samesite="strict", - max_age=6*60, + max_age=14 * 24 * 60 * 60, ) return data diff --git a/app/service/search_enumerator.py b/app/service/search_enumerator.py index 3e2b5cf..260f1ca 100644 --- a/app/service/search_enumerator.py +++ b/app/service/search_enumerator.py @@ -327,6 +327,7 @@ async def run_all_query_async(self): async def get_subdomain_data(domain: str, db: Session, user: User) -> Dict[str, List[str]]: try: + print("is it coming?") parsed_domain = urlparse(f"http://{domain}").netloc res = SubDomainScrapper(parsed_domain) data = await res.run_all_query_async() @@ -355,6 +356,7 @@ async def get_subdomain_data(domain: str, db: Session, user: User) -> Dict[str, "wildcards": sorted(list(res.wildcard_subdomains)) } except Exception as e: + print(e) raise HTTPException( status_code=500, detail=f"An error occurred: {str(e)}") diff --git a/app/static/css/style.css b/app/static/css/style.css index 429a1ab..362d4a7 100644 --- a/app/static/css/style.css +++ b/app/static/css/style.css @@ -146,16 +146,6 @@ nav ul li a { margin-bottom: 1rem; } -.results { - padding: 4rem 0; -} - -.results h3 { - text-align: center; - font-size: 2rem; - margin-bottom: 2rem; -} - #subdomainList { list-style: none; display: grid; @@ -179,10 +169,6 @@ footer { margin-top: auto; } -.hidden { - display: none; -} - @media (max-width: 768px) { header .container { flex-direction: column; @@ -200,3 +186,80 @@ footer { width: 100%; } } +.results { + padding: 4rem 0; +} + +.results h3 { + text-align: center; + font-size: 2rem; + margin-bottom: 2rem; +} + +#resultsContent { + background-color: #fff; + padding: 2rem; + border-radius: 5px; + box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1); +} + +#resultsContent p { + font-size: 1.2rem; + margin-bottom: 1rem; +} + +#resultsContent h4 { + color: var(--primary-color); + margin-top: 1.5rem; + margin-bottom: 1rem; +} + +#resultsContent ul { + list-style: none; + display: grid; + grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); + gap: 1rem; +} + +#resultsContent li { + background-color: var(--secondary-color); + padding: 0.5rem 1rem; + border-radius: 5px; +} + +.hidden { + display: none; +} + +.loader { + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + padding: 2rem 0; +} + +.spinner { + border: 4px solid var(--secondary-color); + border-top: 4px solid var(--primary-color); + border-radius: 50%; + width: 40px; + height: 40px; + animation: spin 1s linear infinite; +} + +@keyframes spin { + 0% { transform: rotate(0deg); } + 100% { transform: rotate(360deg); } +} + +.loader p { + margin-top: 1rem; + font-size: 1.2rem; + color: var(--primary-color); +} + +/* Ensure hidden class actually hides the element */ +.hidden { + display: none !important; +} \ No newline at end of file diff --git a/app/static/js/login.js b/app/static/js/login.js index 47396aa..ba78fb1 100644 --- a/app/static/js/login.js +++ b/app/static/js/login.js @@ -23,12 +23,11 @@ document.addEventListener("DOMContentLoaded", function () { const email = document.getElementById("login-email").value; console.log(email); const password = document.getElementById("login-password").value; - console.log(password); document.getElementById("loginMessage").textContent = HandleAuthInputValidation(email, password, "loginMessage"); const data = await handleAuthRequest(email, password, "login") // const data = await loginRequest(email, password) - document.getElementById("loginMessage").textContent = data + document.getElementById("loginMessage").textContent = data.detail }); document @@ -41,7 +40,7 @@ document.addEventListener("DOMContentLoaded", function () { document.getElementById("registerMessage").textContent = HandleAuthInputValidation(email, password, "registerMessage"); const data = await handleAuthRequest(email, password, "signup"); - document.getElementById("registerMessage").textContent = data; + document.getElementById("registerMessage").textContent = data.detail; }); }); diff --git a/app/static/js/main.js b/app/static/js/main.js index e69de29..c839d1a 100644 --- a/app/static/js/main.js +++ b/app/static/js/main.js @@ -0,0 +1,63 @@ +document.addEventListener("DOMContentLoaded", function () { + const searchForm = document.getElementById("searchForm"); + const resultsSection = document.getElementById("results"); + const resultsContent = document.getElementById("resultsContent"); + const loader = document.getElementById("loader"); + + loader.classList.add("hidden"); + + searchForm.addEventListener("submit", async function (e) { + e.preventDefault(); + const domain = document.getElementById("domainInput").value; + + // Show loader only when search is initiated + loader.classList.remove("hidden"); + resultsSection.classList.add("hidden"); + + try { + const response = await fetch( + `/api/v1/search?domain=${encodeURIComponent(domain)}` + ); + + if (response.status === 401) { + window.location.href = "/auth/login"; + return; + } + + if (!response.ok) { + throw new Error("Search failed"); + } + + const data = await response.json(); + displayResults(data); + } catch (error) { + console.error("Error:", error); + resultsContent.innerHTML = + "

An error occurred while searching. Please try again.

"; + resultsSection.classList.remove("hidden"); + } finally { + loader.classList.add("hidden"); + } + }); + + function displayResults(data) { + let html = ` +

Total subdomains found: ${data.count}

+

Regular Subdomains:

+ +

Wildcard Subdomains:

+ + `; + + resultsContent.innerHTML = html; + resultsSection.classList.remove("hidden"); + } +}); diff --git a/app/static/js/profile.js b/app/static/js/profile.js index 2bfb2a9..1b05efc 100644 --- a/app/static/js/profile.js +++ b/app/static/js/profile.js @@ -1,3 +1,9 @@ +function changePage(newPage) { + currentPage = newPage; + const skip = (currentPage - 1) * itemsPerPage; + fetchSubdomains(currentDomainId, skip, itemsPerPage); +} + let currentDomainId = null; let currentPage = 1; const itemsPerPage = 10; @@ -106,8 +112,3 @@ function updatePagination(data) { } } -function changePage(newPage) { - currentPage = newPage; - const skip = (currentPage - 1) * itemsPerPage; - fetchSubdomains(currentDomainId, skip, itemsPerPage); -} diff --git a/app/templates/base.html b/app/templates/base.html index d39c4c1..e11fe35 100644 --- a/app/templates/base.html +++ b/app/templates/base.html @@ -37,8 +37,8 @@

Dom Explorer

+ {% block extra_js %} - - {% block extra_js %}{% endblock %} + {% endblock %} \ No newline at end of file diff --git a/app/templates/index.html b/app/templates/index.html index 121e514..e08bdac 100644 --- a/app/templates/index.html +++ b/app/templates/index.html @@ -32,16 +32,19 @@

Security Insights

+ + {% endblock %} {% block extra_js %} - + {% endblock %} \ No newline at end of file From 23190f80df94e9f42b0c1137f684373b0ca5e442 Mon Sep 17 00:00:00 2001 From: Davidhero Date: Mon, 23 Sep 2024 19:13:09 +0100 Subject: [PATCH 5/7] new changes --- app/static/js/profile.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/app/static/js/profile.js b/app/static/js/profile.js index 1b05efc..7a3aa3c 100644 --- a/app/static/js/profile.js +++ b/app/static/js/profile.js @@ -1,9 +1,3 @@ -function changePage(newPage) { - currentPage = newPage; - const skip = (currentPage - 1) * itemsPerPage; - fetchSubdomains(currentDomainId, skip, itemsPerPage); -} - let currentDomainId = null; let currentPage = 1; const itemsPerPage = 10; @@ -70,7 +64,7 @@ function displaySubdomains(data) { tableHTML += ` ${subdomain.name} - ${subdomain.isActive ? "Active" : "Active"} + ${subdomain.isActive ? "Active" : "Inactive"} ${new Date(subdomain.createdDate).toLocaleString()} `; @@ -92,7 +86,7 @@ function updatePagination(data) { const totalPages = Math.ceil(data.total_subdomains / itemsPerPage); if (currentPage > 1) { - pagination.innerHTML += ``; } @@ -101,14 +95,20 @@ function updatePagination(data) { if (i === currentPage) { pagination.innerHTML += `${i}`; } else { - pagination.innerHTML += ``; + pagination.innerHTML += ``; } } if (currentPage < totalPages) { - pagination.innerHTML += ``; } } +// Make changePage function globally accessible +window.changePage = function (newPage) { + currentPage = newPage; + const skip = (currentPage - 1) * itemsPerPage; + fetchSubdomains(currentDomainId, skip, itemsPerPage); +}; From 378c1a11e545ac3653f0c5cfa17a867dc025db86 Mon Sep 17 00:00:00 2001 From: Davidhero Date: Mon, 23 Sep 2024 19:14:09 +0100 Subject: [PATCH 6/7] new changes --- app/controllers/controllers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/controllers.py b/app/controllers/controllers.py index 2f11015..a71fd04 100644 --- a/app/controllers/controllers.py +++ b/app/controllers/controllers.py @@ -89,7 +89,7 @@ async def get_user_domains( @router.get("/domains/{id}") -@limiter.limit("10/minute") +@limiter.limit("15/minute") async def read_user_domain( request: Request, id: int, From a541d9683bd02c1aaec8fb2b8977a1f8e8ddbb0b Mon Sep 17 00:00:00 2001 From: Davidhero Date: Tue, 24 Sep 2024 10:51:20 +0100 Subject: [PATCH 7/7] new changes --- app/static/js/profile.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/static/js/profile.js b/app/static/js/profile.js index 7a3aa3c..5597fc2 100644 --- a/app/static/js/profile.js +++ b/app/static/js/profile.js @@ -64,7 +64,7 @@ function displaySubdomains(data) { tableHTML += ` ${subdomain.name} - ${subdomain.isActive ? "Active" : "Inactive"} + ${subdomain.isActive ? "Active" : "Active"} ${new Date(subdomain.createdDate).toLocaleString()} `;