From e96d6f917d609e2c26be9a7540544d726d8c55e9 Mon Sep 17 00:00:00 2001 From: Jaydin_MacBook <74679492+TheManWhoLikesToCode@users.noreply.github.com> Date: Fri, 19 Jan 2024 14:40:38 -0500 Subject: [PATCH 1/7] Checkpoint JAN 19 Slowly implementing a cookies based user system --- backend/app.py | 52 ++++++------ backend/blackboard_session.py | 3 +- backend/blackboard_session_manager.py | 47 +++++++---- frontend/app.py | 16 ++++ frontend/static/default.css | 1 - frontend/static/scripts.js | 12 +-- frontend/templates/index.html | 2 +- frontend/templates/login.html | 73 +++++++++++++++++ frontend/templates/userPage.html | 114 ++++++++++++++++++++++++++ 9 files changed, 270 insertions(+), 50 deletions(-) create mode 100644 frontend/templates/login.html create mode 100644 frontend/templates/userPage.html diff --git a/backend/app.py b/backend/app.py index e37b9f8..018f412 100644 --- a/backend/app.py +++ b/backend/app.py @@ -1,10 +1,11 @@ +from functools import wraps import logging import os import threading import time from dotenv import load_dotenv -from flask import Flask, abort, after_this_request, jsonify, request, send_from_directory +from flask import Flask, abort, after_this_request, jsonify, make_response, request, send_from_directory from flask_cors import CORS, cross_origin from flask_apscheduler import APScheduler @@ -22,12 +23,15 @@ # Initialize Logging logging.basicConfig(level=logging.INFO) -log_level = logging.WARNING -app.logger.setLevel(log_level) +#log_level = logging.WARNING +#app.logger.setLevel(log_level) # Import dot env variables load_dotenv() +def is_user_logged_in(): + user_session = request.cookies.get('user_session') + return user_session and bb_session_manager.retrieve_bb_session(user_session) @scheduler.task('interval', id='clean_up', seconds=600) def clean_up_and_upload_files_to_google_drive(file_path=None): @@ -46,25 +50,13 @@ def clean_up_and_upload_files_to_google_drive(file_path=None): bb_session_manager = BlackboardSessionManager() - -@scheduler.task('interval', id='delete_sessions', seconds=60) -def delete_inactive_bb_sessions(inactivity_threshold_seconds=180): - current_time = time.time() - - # Collect usernames with inactive sessions for deletion - usernames_to_delete = [] - for username, session_id in bb_session_manager.user_session_map.items(): - session = bb_session_manager.bb_sessions.get(session_id) - if session: - last_activity_time = session.last_activity_time - inactive_duration = current_time - last_activity_time - if inactive_duration > inactivity_threshold_seconds: - usernames_to_delete.append(username) - - # Delete collected usernames' sessions - for username in usernames_to_delete: - bb_session_manager.delete_bb_session(username) - +def login_required(f): + @wraps(f) + def decorated_function(*args, **kwargs): + if not is_user_logged_in(): + return jsonify({'error': 'Unauthorized access'}), 401 + return f(*args, **kwargs) + return decorated_function @app.route('/') @cross_origin() @@ -73,7 +65,7 @@ def index(): @app.route('/login', methods=['POST']) -@cross_origin() +@cross_origin(supports_credentials=True) def login(): data = request.json username = data.get('username') @@ -83,7 +75,6 @@ def login(): return jsonify({'error': 'Missing username or password'}), 400 try: - # Retrieve or create a session for the user bb_session = bb_session_manager.get_bb_session(username) bb_session.username = username bb_session.password = password @@ -92,7 +83,12 @@ def login(): response = bb_session.get_response() if response == 'Login successful.': bb_session_manager.put_bb_session(username, bb_session) - return jsonify({'message': 'Logged in successfully'}) + + resp = make_response( + jsonify({'message': 'Logged in successfully'})) + resp.set_cookie('user_session', bb_session.session_id, + max_age=3600, secure=True, httponly=True) + return resp else: return jsonify({'error': response}), 401 except Exception as e: @@ -100,6 +96,7 @@ def login(): @app.route('/scrape', methods=['GET']) +@login_required def scrape(): username = request.args.get('username') if not username: @@ -127,6 +124,7 @@ def scrape(): @app.route('/download/', methods=['GET']) @cross_origin() +@login_required def download(file_key): """ Download a file by its file key and then delete it from the server. @@ -152,6 +150,7 @@ def trigger_post_download_operations(response): @app.route('/browse/', defaults={'path': None}) @app.route('/browse/') @cross_origin() +@login_required def list_directory(path): if path is None: @@ -165,6 +164,7 @@ def list_directory(path): return jsonify({'folders': folders, 'files': files}) + def handle_single_file(file_id, file_name): session_files_path = get_session_files_path() if not os.path.exists(session_files_path): @@ -183,7 +183,9 @@ def trigger_post_download_operations(response): return send_from_directory(session_files_path, file_name, as_attachment=True) + @app.route('/browse') +@login_required def list_root_directory(): return list_directory(None) diff --git a/backend/blackboard_session.py b/backend/blackboard_session.py index bdb8244..147a608 100644 --- a/backend/blackboard_session.py +++ b/backend/blackboard_session.py @@ -12,7 +12,7 @@ class BlackboardSession: - def __init__(self, username=None, password=None, max_threads=100): + def __init__(self, session_id=None, username=None, password=None, max_threads=100): """ Creates a blackboard session instance. @@ -29,6 +29,7 @@ def __init__(self, username=None, password=None, max_threads=100): self.username = username self.password = password self.max_threads = max_threads + self.session_id = session_id self.courses = {} self.download_tasks = [] self.is_logged_in = False diff --git a/backend/blackboard_session_manager.py b/backend/blackboard_session_manager.py index 773fffe..ccd54a8 100644 --- a/backend/blackboard_session_manager.py +++ b/backend/blackboard_session_manager.py @@ -1,35 +1,48 @@ import uuid +import threading +import time from blackboard_session import BlackboardSession class BlackboardSessionManager: def __init__(self): self.bb_sessions = {} self.user_session_map = {} + self.lock = threading.Lock() def get_bb_session(self, username): - if username not in self.user_session_map: - session_id = str(uuid.uuid4()) # Generate a unique session ID - self.user_session_map[username] = session_id - # Store the session object - self.bb_sessions[session_id] = BlackboardSession() + with self.lock: + if username not in self.user_session_map: + session_id = str(uuid.uuid4()) # Generate a unique session ID + self.user_session_map[username] = session_id + # Store the session object + self.bb_sessions[session_id] = BlackboardSession(session_id, time.time()) - return self.bb_sessions[self.user_session_map[username]] + return self.bb_sessions[self.user_session_map[username]] def put_bb_session(self, username, bb_session): - session_id = self.user_session_map.get(username) - if session_id: - self.bb_sessions[session_id] = bb_session + with self.lock: + session_id = self.user_session_map.get(username) + if session_id: + self.bb_sessions[session_id] = bb_session def retrieve_bb_session(self, username): - session_id = self.user_session_map.get(username) - if session_id: - return self.bb_sessions.get(session_id) + with self.lock: + session_id = self.user_session_map.get(username) + if session_id: + return self.bb_sessions.get(session_id) return None def delete_bb_session(self, username): - session_id = self.user_session_map.get(username) - if session_id: - session_to_delete = self.bb_sessions.pop(session_id, None) - if session_to_delete: - del self.user_session_map[username] + with self.lock: + session_id = self.user_session_map.pop(username, None) + if session_id: + return self.bb_sessions.pop(session_id, None) + + def clean_up_inactive_sessions(self, inactivity_threshold_seconds=3600): + with self.lock: + current_time = time.time() + inactive_sessions = [username for username, session_id in self.user_session_map.items() + if current_time - self.bb_sessions[session_id].last_activity_time > inactivity_threshold_seconds] + for username in inactive_sessions: + self.delete_bb_session(username) diff --git a/frontend/app.py b/frontend/app.py index 9e8a390..d2681e3 100644 --- a/frontend/app.py +++ b/frontend/app.py @@ -12,21 +12,37 @@ # Initialize Logging logging.basicConfig(level=logging.INFO) + @app.route('/') @cross_origin() def index(): return render_template('index.html') + @app.route('/demo') @cross_origin() def demo(): return render_template('demo.html') + @app.route('/TOS') @cross_origin() def TOS(): return render_template('TOS.html') + +@app.route('/login') +@cross_origin() +def login(): + return render_template('login.html') + + +@app.route('/userpage') +@cross_origin() +def userPage(): + return render_template('userPage.html') + + @app.route('/directory/') @cross_origin() def directory(): diff --git a/frontend/static/default.css b/frontend/static/default.css index 86971ba..3ea7863 100755 --- a/frontend/static/default.css +++ b/frontend/static/default.css @@ -2426,7 +2426,6 @@ select.form-control-lg:not([size]):not([multiple]), line-height: 1.5; border-radius: 0.3rem; transition: all 0.2s; - margin-bottom: 5rem; } @media screen and (prefers-reduced-motion: reduce) { .btn { diff --git a/frontend/static/scripts.js b/frontend/static/scripts.js index 6b76fb3..9f595a6 100755 --- a/frontend/static/scripts.js +++ b/frontend/static/scripts.js @@ -140,17 +140,18 @@ const app = (() => { username: username, password: password, }), + credentials: 'include', }); const data = await response.json(); - const message = data.message || 'Error occurred'; - responseContainer.textContent = message; - // Store username in session storage if login is successful if (response.ok) { sessionStorage.setItem("user", JSON.stringify({ username: username })); + window.location.href = '/userpage'; + } else { + const message = data.message || 'Error occurred'; + responseContainer.textContent = message; + responseContainer.classList.add("alert-danger"); } - responseContainer.textContent = message; - responseContainer.classList.add("alert-success"); } catch (error) { responseContainer.textContent = error.message; responseContainer.classList.add("alert-danger"); @@ -160,6 +161,7 @@ const app = (() => { } }; + const archiveCourses = async () => { showLoadingScreen(); try { diff --git a/frontend/templates/index.html b/frontend/templates/index.html index 744acf5..08e6233 100755 --- a/frontend/templates/index.html +++ b/frontend/templates/index.html @@ -184,7 +184,7 @@

Revolutionize Your Learning Experience

Try the live demo
-
+
Work 2 Work 3 diff --git a/frontend/templates/login.html b/frontend/templates/login.html new file mode 100644 index 0000000..4ad150f --- /dev/null +++ b/frontend/templates/login.html @@ -0,0 +1,73 @@ + + + + + + + Login - Archive Me + + + + + + + + + + + + +
+
+ +
+
+ +
+
+
+
+
+
+

Login to Archive Me

+
+
+ +
+
+ +
+ + +
+
+
+
+
+
+
+ + + + + + + + + + + \ No newline at end of file diff --git a/frontend/templates/userPage.html b/frontend/templates/userPage.html new file mode 100644 index 0000000..d9d7b5b --- /dev/null +++ b/frontend/templates/userPage.html @@ -0,0 +1,114 @@ + + + + + + + User Dashboard - Archive Me + + + + + + + + + + + + + + + +
+
+ +
+
+ + +
+
+
+
+

+ Welcome to Your Dashboard +

+

+ Manage your courses and archives efficiently. +

+
+
+
+
+ + +
+
+
+
+

+ Your Courses +

+

+ Access and manage your current and archived courses here. +

+
+
+ +
+
+ + +
+
+
+
+

Account Settings

+

Manage your account settings and preferences.

+
+
+ +
+
+ + +
+ +
+ + + + + + + + + + + \ No newline at end of file From da75605db2439e642fd2bd480114ed97d03f955a Mon Sep 17 00:00:00 2001 From: Jaydin_MacBook <74679492+TheManWhoLikesToCode@users.noreply.github.com> Date: Sat, 20 Jan 2024 01:09:31 -0500 Subject: [PATCH 2/7] Checkpoint 2 Rem to enable log filters --- backend/app.py | 34 +++++++++++++- backend/blackboard_session_manager.py | 17 +++++-- frontend/app.py | 4 ++ frontend/static/scripts.js | 53 ++++++++++++++++++++- frontend/templates/logout.html | 63 +++++++++++++++++++++++++ frontend/templates/userPage.html | 67 ++++++++++++++------------- 6 files changed, 201 insertions(+), 37 deletions(-) create mode 100644 frontend/templates/logout.html diff --git a/backend/app.py b/backend/app.py index 018f412..0da0a8a 100644 --- a/backend/app.py +++ b/backend/app.py @@ -23,16 +23,18 @@ # Initialize Logging logging.basicConfig(level=logging.INFO) -#log_level = logging.WARNING -#app.logger.setLevel(log_level) +# log_level = logging.WARNING +# app.logger.setLevel(log_level) # Import dot env variables load_dotenv() + def is_user_logged_in(): user_session = request.cookies.get('user_session') return user_session and bb_session_manager.retrieve_bb_session(user_session) + @scheduler.task('interval', id='clean_up', seconds=600) def clean_up_and_upload_files_to_google_drive(file_path=None): @@ -50,6 +52,7 @@ def clean_up_and_upload_files_to_google_drive(file_path=None): bb_session_manager = BlackboardSessionManager() + def login_required(f): @wraps(f) def decorated_function(*args, **kwargs): @@ -58,6 +61,7 @@ def decorated_function(*args, **kwargs): return f(*args, **kwargs) return decorated_function + @app.route('/') @cross_origin() def index(): @@ -95,6 +99,32 @@ def login(): return jsonify({'error': str(e)}), 500 +@app.route('/logout', methods=['POST']) +@cross_origin(supports_credentials=True) +def logout(): + user_session = request.cookies.get('user_session') + if user_session: + # Remove the session from BlackboardSessionManager + bb_session_manager.delete_bb_session(user_session) + + # Clear the user's session cookie + resp = make_response(jsonify({'message': 'Logged out successfully'})) + resp.set_cookie('user_session', '', expires=0) + return resp + else: + return jsonify({'error': 'No active session'}), 400 + + +@app.route('/is_logged_in', methods=['GET']) +@cross_origin(supports_credentials=True) +def is_logged_in(): + user_session = request.cookies.get('user_session') + if user_session and bb_session_manager.retrieve_bb_session(user_session): + return jsonify({'logged_in': True}), 200 + else: + return jsonify({'logged_in': False}), 401 + + @app.route('/scrape', methods=['GET']) @login_required def scrape(): diff --git a/backend/blackboard_session_manager.py b/backend/blackboard_session_manager.py index ccd54a8..d2677c6 100644 --- a/backend/blackboard_session_manager.py +++ b/backend/blackboard_session_manager.py @@ -3,6 +3,7 @@ import time from blackboard_session import BlackboardSession + class BlackboardSessionManager: def __init__(self): self.bb_sessions = {} @@ -15,7 +16,8 @@ def get_bb_session(self, username): session_id = str(uuid.uuid4()) # Generate a unique session ID self.user_session_map[username] = session_id # Store the session object - self.bb_sessions[session_id] = BlackboardSession(session_id, time.time()) + self.bb_sessions[session_id] = BlackboardSession( + session_id, time.time()) return self.bb_sessions[self.user_session_map[username]] @@ -25,14 +27,23 @@ def put_bb_session(self, username, bb_session): if session_id: self.bb_sessions[session_id] = bb_session - def retrieve_bb_session(self, username): + def retrieve_bb_session_by_username(self, username): with self.lock: session_id = self.user_session_map.get(username) if session_id: return self.bb_sessions.get(session_id) - return None + def retrieve_bb_session_by_id(self, session_id): + with self.lock: + return self.bb_sessions.get(session_id) + + def retrieve_bb_session(self, identifier): + if isinstance(identifier, str) and '-' in identifier: + return self.retrieve_bb_session_by_id(identifier) + else: + return self.retrieve_bb_session_by_username(identifier) + def delete_bb_session(self, username): with self.lock: session_id = self.user_session_map.pop(username, None) diff --git a/frontend/app.py b/frontend/app.py index d2681e3..93a1685 100644 --- a/frontend/app.py +++ b/frontend/app.py @@ -36,6 +36,10 @@ def TOS(): def login(): return render_template('login.html') +@app.route('/logout') +@cross_origin() +def logout(): + return render_template('logout.html') @app.route('/userpage') @cross_origin() diff --git a/frontend/static/scripts.js b/frontend/static/scripts.js index 9f595a6..76faeea 100755 --- a/frontend/static/scripts.js +++ b/frontend/static/scripts.js @@ -161,6 +161,45 @@ const app = (() => { } }; + const logoutUser = async () => { + try { + const response = await fetch(`${apiUrl}/logout`, { + method: 'POST', // or 'POST' if your backend is expecting a POST request + credentials: 'include' + }); + + if (response.ok) { + sessionStorage.removeItem("user"); // Clear user session data + window.location.href = '/logout'; // Redirect to logout page + } else { + console.error('Logout failed'); + } + } catch (error) { + console.error('Error:', error); + } + }; + + const checkLoginStatus = async () => { + try { + const response = await fetch(`${apiUrl}/is_logged_in`, { + method: 'GET', + credentials: 'include' // Necessary for including cookies + }); + + const data = await response.json(); + + if (!data.logged_in) { + console.log(data); + window.location.href = '/login'; // Redirect to login page + } + // Optionally, handle the case when the user is logged in + // e.g., display a welcome message, load user data, etc. + } catch (error) { + console.error('Error:', error); + window.location.href = '/login'; // Redirect to login page in case of error + } + }; + const archiveCourses = async () => { showLoadingScreen(); @@ -292,6 +331,15 @@ const app = (() => { }); const init = () => { + + const logoutLink = document.querySelector('a[href="/logout"]'); + if (logoutLink) { + logoutLink.addEventListener('click', (event) => { + event.preventDefault(); + logoutUser(); + }); + } + const loginForm = document.querySelector("#loginForm"); if (loginForm) { loginForm.addEventListener("submit", loginEventHandler); @@ -307,12 +355,15 @@ const app = (() => { if (window.location.pathname === '/directory/') { updateDirectoryList(''); } + if (window.location.pathname === '/userpage') { + checkLoginStatus(); + } hideLoadingScreen(); updateDownloadButtonVisibility(); }; - return { init }; + return { init, logoutUser }; })(); document.addEventListener("DOMContentLoaded", app.init); \ No newline at end of file diff --git a/frontend/templates/logout.html b/frontend/templates/logout.html new file mode 100644 index 0000000..83a1fab --- /dev/null +++ b/frontend/templates/logout.html @@ -0,0 +1,63 @@ + + + + + + + Logged Out - Archive Me + + + + + + + + + + + + + + + +
+ +
+ + +
+
+
+
+

+ You've been logged out +

+

+ Thank you for using Archive Me. Click here to log in again. +

+
+
+
+
+ + +
+ +
+ + + + + + + + + + + diff --git a/frontend/templates/userPage.html b/frontend/templates/userPage.html index d9d7b5b..e884eda 100644 --- a/frontend/templates/userPage.html +++ b/frontend/templates/userPage.html @@ -1,6 +1,5 @@ - @@ -34,13 +33,10 @@ - -
+ +

- Welcome to Your Dashboard + Interactive Demo of Archive-Me

- Manage your courses and archives efficiently. + Explore how Archive-Me works. This demo simulates the core functionalities of the application.

+ +
+

Login to Your Account

+ +
+
+ +
+
+ +
+ + + + + +
+
- -
+ +
-
+

- Your Courses + Directory Listing

- Access and manage your current and archived courses here. + Browse through your directory of courses and resources.

+
+

Directory Listing for /path/to/directory

+ +
    +
+
- -
-
- - -
-
-
-
-

Account Settings

-

Manage your account settings and preferences.

-
-
-
@@ -110,5 +116,4 @@

Account Settings

- - \ No newline at end of file + From cf76e988e57a6580002ea9827598172e6dd70d6c Mon Sep 17 00:00:00 2001 From: Jaydin_MacBook <74679492+TheManWhoLikesToCode@users.noreply.github.com> Date: Sun, 21 Jan 2024 10:43:04 -0500 Subject: [PATCH 3/7] Working Version 0 --- backend/app.py | 5 +- frontend/app.py | 14 +--- frontend/static/scripts.js | 24 +++--- frontend/templates/demo.html | 120 ------------------------------ frontend/templates/directory.html | 72 ------------------ frontend/templates/index.html | 17 +++-- frontend/templates/userPage.html | 73 +++++++++--------- 7 files changed, 64 insertions(+), 261 deletions(-) delete mode 100644 frontend/templates/demo.html delete mode 100644 frontend/templates/directory.html diff --git a/backend/app.py b/backend/app.py index 0da0a8a..68030f4 100644 --- a/backend/app.py +++ b/backend/app.py @@ -126,6 +126,7 @@ def is_logged_in(): @app.route('/scrape', methods=['GET']) +@cross_origin(supports_credentials=True) @login_required def scrape(): username = request.args.get('username') @@ -153,7 +154,7 @@ def scrape(): @app.route('/download/', methods=['GET']) -@cross_origin() +@cross_origin(supports_credentials=True) @login_required def download(file_key): """ @@ -179,7 +180,7 @@ def trigger_post_download_operations(response): @app.route('/browse/', defaults={'path': None}) @app.route('/browse/') -@cross_origin() +@cross_origin(supports_credentials=True) @login_required def list_directory(path): diff --git a/frontend/app.py b/frontend/app.py index 93a1685..918a253 100644 --- a/frontend/app.py +++ b/frontend/app.py @@ -19,12 +19,6 @@ def index(): return render_template('index.html') -@app.route('/demo') -@cross_origin() -def demo(): - return render_template('demo.html') - - @app.route('/TOS') @cross_origin() def TOS(): @@ -36,22 +30,18 @@ def TOS(): def login(): return render_template('login.html') + @app.route('/logout') @cross_origin() def logout(): return render_template('logout.html') + @app.route('/userpage') @cross_origin() def userPage(): return render_template('userPage.html') -@app.route('/directory/') -@cross_origin() -def directory(): - return render_template('directory.html') - - if __name__ == '__main__': app.run(host='0.0.0.0', port=app.config['PORT'], debug=app.config['DEBUG']) diff --git a/frontend/static/scripts.js b/frontend/static/scripts.js index 76faeea..8e1b414 100755 --- a/frontend/static/scripts.js +++ b/frontend/static/scripts.js @@ -106,7 +106,7 @@ const app = (() => { const downloadButton = document.getElementById("downloadButton"); if (downloadButton) { if (fileKeyGlobal) { - downloadButton.style.display = "block"; // Show button if file_key is present + downloadButton.style.display = ""; } else { downloadButton.style.display = "none"; // Hide button otherwise } @@ -164,13 +164,13 @@ const app = (() => { const logoutUser = async () => { try { const response = await fetch(`${apiUrl}/logout`, { - method: 'POST', // or 'POST' if your backend is expecting a POST request + method: 'POST', credentials: 'include' }); if (response.ok) { - sessionStorage.removeItem("user"); // Clear user session data - window.location.href = '/logout'; // Redirect to logout page + sessionStorage.removeItem("user"); + window.location.href = '/logout'; } else { console.error('Logout failed'); } @@ -220,7 +220,8 @@ const app = (() => { const response = await fetchWithErrorHandler(url, { method: "GET", - headers: { "Content-Type": "application/json" } + headers: { "Content-Type": "application/json" }, + credentials: 'include' }); const data = await response.json(); @@ -246,10 +247,12 @@ const app = (() => { showLoadingScreen(); try { console.log("Downloading file..."); - console.log(fileKeyGlobal) + console.log(fileKeyGlobal); const baseUrl = window.location.origin; const downloadUrl = `${apiUrl}/download/${encodeURIComponent(fileKeyGlobal)}`; - const response = await fetchWithErrorHandler(downloadUrl); + const response = await fetchWithErrorHandler(downloadUrl, { + credentials: 'include' + }); const blob = await response.blob(); const url = window.URL.createObjectURL(blob); @@ -274,7 +277,9 @@ const app = (() => { const updateDirectoryList = async (path, directoryName = '/') => { try { - const response = await fetchWithErrorHandler(`${apiUrl}/browse/${path}`); + const response = await fetchWithErrorHandler(`${apiUrl}/browse/${path}`, { + credentials: 'include' + }); const contentType = response.headers.get('content-type'); if (contentType && contentType.includes('application/json')) { const { folders, files } = await response.json(); @@ -335,7 +340,6 @@ const app = (() => { const logoutLink = document.querySelector('a[href="/logout"]'); if (logoutLink) { logoutLink.addEventListener('click', (event) => { - event.preventDefault(); logoutUser(); }); } @@ -352,7 +356,7 @@ const app = (() => { if (downloadButton) { downloadButton.addEventListener("click", downloadFile); } - if (window.location.pathname === '/directory/') { + if (window.location.pathname === '/userpage') { updateDirectoryList(''); } if (window.location.pathname === '/userpage') { diff --git a/frontend/templates/demo.html b/frontend/templates/demo.html deleted file mode 100644 index 0b382e9..0000000 --- a/frontend/templates/demo.html +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - Archive-Me Demo - - - - - - - - - - - - - - -
-
- -
-
- - -
-
-

Interactive Demo of Archive-Me

-

- Explore how Archive-Me works. This demo simulates the core - functionalities of the application. -

- - -
-

Login to Your Account

- -
-
- -
-
- -
- - - - - -
-
- -
-
- - -
-
-
-
-
About Archive Me
-

- This is a demo page for the Archive-Me, designed to - help Kettering University students manage their educational - resources efficiently. -

- -
- -
-
-
- - - - - - - - - - - - - - \ No newline at end of file diff --git a/frontend/templates/directory.html b/frontend/templates/directory.html deleted file mode 100644 index 9caf720..0000000 --- a/frontend/templates/directory.html +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - Directory - Blackboard Scrapper - - - - - - - - - - - - - - -
-
- -
-
- -
-
-
-
-

Directory Listing for /path/to/directory

- -
    -
-
-
-
-
- - - - - - - - - - - \ No newline at end of file diff --git a/frontend/templates/index.html b/frontend/templates/index.html index 08e6233..18c61b1 100755 --- a/frontend/templates/index.html +++ b/frontend/templates/index.html @@ -49,9 +49,9 @@ FAQ @@ -81,6 +81,7 @@

+
@@ -184,14 +185,14 @@

Revolutionize Your Learning Experience

Try the live demo
-
- Work 2 - Work 3 -
+
+ Work 2 + Work 3
+
@@ -372,4 +373,4 @@
Help
- + \ No newline at end of file diff --git a/frontend/templates/userPage.html b/frontend/templates/userPage.html index e884eda..0a081a4 100644 --- a/frontend/templates/userPage.html +++ b/frontend/templates/userPage.html @@ -1,5 +1,6 @@ + @@ -47,53 +48,50 @@
- -
-
-
-
-

- Interactive Demo of Archive-Me -

-

- Explore how Archive-Me works. This demo simulates the core functionalities of the application. -

- -
-

Login to Your Account

- -
-
- -
-
- -
- - - - - -
+ + +
+
+
+
+

+ Archive with Archive-Me +

+

+ Utilize Archive-Me to manage and organize your digital resources effectively. +

+ +
+

You are Logged In

+

Access and manage your archived courses and resources with ease.

+
+ +
-
+
+
+ + -
+
-
-

- Directory Listing -

+
+
+

+ Directory Listing +

+ Back +

Browse through your directory of courses and resources.

-
-

Directory Listing for /path/to/directory

+
+

Directory Listing for /path/to/directory

@@ -116,4 +114,5 @@

Directory Listing for /path/to/directory

- + + \ No newline at end of file From 2ff0e0c53ea6342063356c1b1a9cfa757cd665f0 Mon Sep 17 00:00:00 2001 From: Jaydin_MacBook <74679492+TheManWhoLikesToCode@users.noreply.github.com> Date: Sun, 21 Jan 2024 10:57:05 -0500 Subject: [PATCH 4/7] demo -> login --- frontend/templates/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/templates/index.html b/frontend/templates/index.html index 18c61b1..00f305a 100755 --- a/frontend/templates/index.html +++ b/frontend/templates/index.html @@ -72,7 +72,7 @@

Archive me is a tool that allows you to archive your courses at the end of the term so you don't have to.

- + Get started now From 6402de9495a2a8b18088865fb706269c13d317a9 Mon Sep 17 00:00:00 2001 From: Jaydin_MacBook <74679492+TheManWhoLikesToCode@users.noreply.github.com> Date: Sun, 21 Jan 2024 15:53:57 -0500 Subject: [PATCH 5/7] [dev,prod,local] V1 --- frontend/static/helpers.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/frontend/static/helpers.js b/frontend/static/helpers.js index 1e31f32..89e4fb7 100644 --- a/frontend/static/helpers.js +++ b/frontend/static/helpers.js @@ -1,8 +1,9 @@ function getConfig() { const config = { apiUrl: { - dev: "http://localhost:5003", - prod: "https://api.archive-me.net" + dev: "http://devapi.archive-me.net", + prod: "https://api.archive-me.net", + local: "http://localhost:5003" } }; return config; @@ -10,7 +11,9 @@ function getConfig() { function getEnv() { const hostname = window.location.hostname; - return hostname.includes('localhost') ? 'dev' : 'prod'; + if (hostname.includes('localhost')) return 'local'; + if (hostname.includes('devapi')) return 'dev'; + return 'prod'; } function getApiUrl() { From 03272e9aa34746a805be93b30a5bb07c0bc83843 Mon Sep 17 00:00:00 2001 From: Jaydin_MacBook <74679492+TheManWhoLikesToCode@users.noreply.github.com> Date: Sun, 21 Jan 2024 16:40:00 -0500 Subject: [PATCH 6/7] devapi -> dev --- frontend/static/helpers.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/static/helpers.js b/frontend/static/helpers.js index 89e4fb7..09a7403 100644 --- a/frontend/static/helpers.js +++ b/frontend/static/helpers.js @@ -12,7 +12,7 @@ function getConfig() { function getEnv() { const hostname = window.location.hostname; if (hostname.includes('localhost')) return 'local'; - if (hostname.includes('devapi')) return 'dev'; + if (hostname.includes('dev')) return 'dev'; return 'prod'; } From f6294e26e87f986934d692f0d1067a5bbae90138 Mon Sep 17 00:00:00 2001 From: Jaydin_MacBook <74679492+TheManWhoLikesToCode@users.noreply.github.com> Date: Sun, 21 Jan 2024 17:25:23 -0500 Subject: [PATCH 7/7] http -> https Frontend Config --- frontend/static/helpers.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/static/helpers.js b/frontend/static/helpers.js index 09a7403..0ad0e05 100644 --- a/frontend/static/helpers.js +++ b/frontend/static/helpers.js @@ -1,7 +1,7 @@ function getConfig() { const config = { apiUrl: { - dev: "http://devapi.archive-me.net", + dev: "https://devapi.archive-me.net", prod: "https://api.archive-me.net", local: "http://localhost:5003" }