Compare commits

..

No commits in common. "3e9a3d0769fd58ad8245370bb694c5065df1a34a" and "efcc4a14b6a0577d8ba4de1a5886b16bf009098a" have entirely different histories.

3 changed files with 128 additions and 161 deletions

1
.gitignore vendored
View File

@ -1,4 +1,3 @@
*.db *.db
uploads uploads
merged_source_files.txt merged_source_files.txt
__pycache__

97
main.py
View File

@ -24,7 +24,7 @@ app.add_middleware(
) )
# Database setup # Database setup
DB_PATH = "rant_community.db" DB_PATH = "devrant_community.db"
UPLOAD_DIR = Path("uploads") UPLOAD_DIR = Path("uploads")
UPLOAD_DIR.mkdir(exist_ok=True) UPLOAD_DIR.mkdir(exist_ok=True)
@ -145,7 +145,7 @@ def hash_password(password: str) -> str:
def generate_token() -> str: def generate_token() -> str:
return secrets.token_urlsafe(32) return secrets.token_urlsafe(32)
async def DELETE_get_current_user(token_id: Optional[int] = Form(None), async def get_current_user(token_id: Optional[int] = Form(None),
token_key: Optional[str] = Form(None), token_key: Optional[str] = Form(None),
user_id: Optional[int] = Form(None)): user_id: Optional[int] = Form(None)):
if not all([token_id, token_key, user_id]): if not all([token_id, token_key, user_id]):
@ -318,7 +318,7 @@ async def login(
} }
} }
@app.get("/api/rant/rants") @app.get("/api/devrant/rants")
async def get_rants( async def get_rants(
sort: str = "recent", sort: str = "recent",
limit: int = 20, limit: int = 20,
@ -328,7 +328,7 @@ async def get_rants(
token_key: Optional[str] = None, token_key: Optional[str] = None,
user_id: Optional[int] = None user_id: Optional[int] = None
): ):
current_user_id = await authenticate_user(token_id, token_key, user_id) if token_id else None current_user_id = await get_current_user(token_id, token_key, user_id) if token_id else None
# Get rants with user info # Get rants with user info
order_by = "r.created_time DESC" if sort == "recent" else "r.score DESC" order_by = "r.created_time DESC" if sort == "recent" else "r.score DESC"
@ -384,7 +384,7 @@ async def get_rants(
} }
} }
@app.get("/api/rant/rants/{rant_id}") @app.get("/api/devrant/rants/{rant_id}")
async def get_rant( async def get_rant(
rant_id: int, rant_id: int,
app: int = 3, app: int = 3,
@ -393,7 +393,7 @@ async def get_rant(
token_key: Optional[str] = None, token_key: Optional[str] = None,
user_id: Optional[int] = None user_id: Optional[int] = None
): ):
current_user_id = await authenticate_user(token_id, token_key, user_id) if token_id else None current_user_id = await get_current_user(token_id, token_key, user_id) if token_id else None
# Get rant with user info # Get rant with user info
rant_row = await db.query_one( rant_row = await db.query_one(
@ -474,7 +474,7 @@ async def get_rant(
"subscribed": subscribed "subscribed": subscribed
} }
@app.post("/api/rant/rants") @app.post("/api/devrant/rants")
async def create_rant( async def create_rant(
rant: str = Form(...), rant: str = Form(...),
tags: str = Form(...), tags: str = Form(...),
@ -485,7 +485,7 @@ async def create_rant(
user_id: int = Form(...), user_id: int = Form(...),
image: Optional[UploadFile] = File(None) image: Optional[UploadFile] = File(None)
): ):
current_user_id = await authenticate_user(token_id, token_key, user_id) current_user_id = await get_current_user(token_id, token_key, user_id)
if not current_user_id: if not current_user_id:
return {"success": False, "error": "Authentication required"} return {"success": False, "error": "Authentication required"}
@ -499,7 +499,7 @@ async def create_rant(
if duplicate: if duplicate:
return { return {
"success": False, "success": False,
"error": "It looks like you just posted this same rant! Your connection might have timed out while posting so you might have seen an error, but sometimes the rant still gets posted and in this case it seems it did, so please check :) If this was not the case please contact info@rant.io. Thanks!" "error": "It looks like you just posted this same rant! Your connection might have timed out while posting so you might have seen an error, but sometimes the rant still gets posted and in this case it seems it did, so please check :) If this was not the case please contact info@devrant.io. Thanks!"
} }
# Handle image upload # Handle image upload
@ -529,7 +529,7 @@ async def create_rant(
return {"success": True, "rant_id": rant_id} return {"success": True, "rant_id": rant_id}
@app.post("/api/rant/rants/{rant_id}") @app.post("/api/devrant/rants/{rant_id}")
async def update_rant( async def update_rant(
rant_id: int, rant_id: int,
rant: str = Form(...), rant: str = Form(...),
@ -539,7 +539,7 @@ async def update_rant(
token_key: str = Form(...), token_key: str = Form(...),
user_id: int = Form(...) user_id: int = Form(...)
): ):
current_user_id = await authenticate_user(token_id, token_key, user_id) current_user_id = await get_current_user(token_id, token_key, user_id)
if not current_user_id: if not current_user_id:
return {"success": False, "error": "Authentication required"} return {"success": False, "error": "Authentication required"}
@ -560,7 +560,7 @@ async def update_rant(
return {"success": True} return {"success": True}
@app.delete("/api/rant/rants/{rant_id}") @app.delete("/api/devrant/rants/{rant_id}")
async def delete_rant( async def delete_rant(
rant_id: int, rant_id: int,
app: int = 3, app: int = 3,
@ -568,7 +568,7 @@ async def delete_rant(
token_key: str = None, token_key: str = None,
user_id: int = None user_id: int = None
): ):
current_user_id = await authenticate_user(token_id, token_key, user_id) current_user_id = await get_current_user(token_id, token_key, user_id)
if not current_user_id: if not current_user_id:
return {"success": False, "error": "Authentication required"} return {"success": False, "error": "Authentication required"}
@ -589,7 +589,7 @@ async def delete_rant(
return {"success": True} return {"success": True}
@app.post("/api/rant/rants/{rant_id}/vote") @app.post("/api/devrant/rants/{rant_id}/vote")
async def vote_rant( async def vote_rant(
rant_id: int, rant_id: int,
vote: int = Form(...), vote: int = Form(...),
@ -599,7 +599,7 @@ async def vote_rant(
token_key: str = Form(...), token_key: str = Form(...),
user_id: int = Form(...) user_id: int = Form(...)
): ):
current_user_id = await authenticate_user(token_id, token_key, user_id) current_user_id = await get_current_user(token_id, token_key, user_id)
if not current_user_id: if not current_user_id:
return {"success": False, "error": "Authentication required"} return {"success": False, "error": "Authentication required"}
@ -688,7 +688,7 @@ async def vote_rant(
"rant": await format_rant(rant_data, user_data, current_user_id) "rant": await format_rant(rant_data, user_data, current_user_id)
} }
@app.post("/api/rant/rants/{rant_id}/favorite") @app.post("/api/devrant/rants/{rant_id}/favorite")
async def favorite_rant( async def favorite_rant(
rant_id: int, rant_id: int,
app: int = Form(3), app: int = Form(3),
@ -696,7 +696,7 @@ async def favorite_rant(
token_key: str = Form(...), token_key: str = Form(...),
user_id: int = Form(...) user_id: int = Form(...)
): ):
current_user_id = await authenticate_user(token_id, token_key, user_id) current_user_id = await get_current_user(token_id, token_key, user_id)
if not current_user_id: if not current_user_id:
return {"success": False, "error": "Authentication required"} return {"success": False, "error": "Authentication required"}
@ -709,7 +709,7 @@ async def favorite_rant(
except Exception: except Exception:
return {"success": False, "error": "Already favorited"} return {"success": False, "error": "Already favorited"}
@app.post("/api/rant/rants/{rant_id}/unfavorite") @app.post("/api/devrant/rants/{rant_id}/unfavorite")
async def unfavorite_rant( async def unfavorite_rant(
rant_id: int, rant_id: int,
app: int = Form(3), app: int = Form(3),
@ -717,7 +717,7 @@ async def unfavorite_rant(
token_key: str = Form(...), token_key: str = Form(...),
user_id: int = Form(...) user_id: int = Form(...)
): ):
current_user_id = await authenticate_user(token_id, token_key, user_id) current_user_id = await get_current_user(token_id, token_key, user_id)
if not current_user_id: if not current_user_id:
return {"success": False, "error": "Authentication required"} return {"success": False, "error": "Authentication required"}
@ -728,7 +728,7 @@ async def unfavorite_rant(
return {"success": True} return {"success": True}
@app.post("/api/rant/rants/{rant_id}/comments") @app.post("/api/devrant/rants/{rant_id}/comments")
async def create_comment( async def create_comment(
rant_id: int, rant_id: int,
comment: str = Form(...), comment: str = Form(...),
@ -738,7 +738,7 @@ async def create_comment(
user_id: int = Form(...), user_id: int = Form(...),
image: Optional[UploadFile] = File(None) image: Optional[UploadFile] = File(None)
): ):
current_user_id = await authenticate_user(token_id, token_key, user_id) current_user_id = await get_current_user(token_id, token_key, user_id)
if not current_user_id: if not current_user_id:
return {"success": False, "confirmed": False} return {"success": False, "confirmed": False}
@ -792,7 +792,7 @@ async def get_comment(
token_key: Optional[str] = None, token_key: Optional[str] = None,
user_id: Optional[int] = None user_id: Optional[int] = None
): ):
current_user_id = await authenticate_user(token_id, token_key, user_id) if token_id else None current_user_id = await get_current_user(token_id, token_key, user_id) if token_id else None
row = await db.query_one( row = await db.query_one(
"""SELECT c.*, u.id as user_id, u.username, u.score as user_score, """SELECT c.*, u.id as user_id, u.username, u.score as user_score,
@ -835,7 +835,7 @@ async def update_comment(
token_key: str = Form(...), token_key: str = Form(...),
user_id: int = Form(...) user_id: int = Form(...)
): ):
current_user_id = await authenticate_user(token_id, token_key, user_id) current_user_id = await get_current_user(token_id, token_key, user_id)
if not current_user_id: if not current_user_id:
return {"success": False, "error": "Authentication required"} return {"success": False, "error": "Authentication required"}
@ -864,7 +864,7 @@ async def delete_comment(
token_key: str = None, token_key: str = None,
user_id: int = None user_id: int = None
): ):
current_user_id = await authenticate_user(token_id, token_key, user_id) current_user_id = await get_current_user(token_id, token_key, user_id)
if not current_user_id: if not current_user_id:
return {"success": False, "error": "Authentication required"} return {"success": False, "error": "Authentication required"}
@ -893,7 +893,7 @@ async def vote_comment(
token_key: str = Form(...), token_key: str = Form(...),
user_id: int = Form(...) user_id: int = Form(...)
): ):
current_user_id = await authenticate_user(token_id, token_key, user_id) current_user_id = await get_current_user(token_id, token_key, user_id)
if not current_user_id: if not current_user_id:
return {"success": False, "error": "Authentication required"} return {"success": False, "error": "Authentication required"}
@ -952,7 +952,7 @@ async def get_profile(
token_key: Optional[str] = None, token_key: Optional[str] = None,
auth_user_id: Optional[int] = None auth_user_id: Optional[int] = None
): ):
current_user_id = await authenticate_user(token_id, token_key, auth_user_id) if token_id else None current_user_id = await get_current_user(token_id, token_key, auth_user_id) if token_id else None
# Get user # Get user
user = await db.get("users", {"id": user_id}) user = await db.get("users", {"id": user_id})
@ -1097,7 +1097,7 @@ async def get_user_id(
return {"success": True, "user_id": user['id']} return {"success": True, "user_id": user['id']}
@app.get("/api/rant/search") @app.get("/api/devrant/search")
async def search( async def search(
term: str, term: str,
app: int = 3, app: int = 3,
@ -1105,7 +1105,7 @@ async def search(
token_key: Optional[str] = None, token_key: Optional[str] = None,
user_id: Optional[int] = None user_id: Optional[int] = None
): ):
current_user_id = await authenticate_user(token_id, token_key, user_id) if token_id else None current_user_id = await get_current_user(token_id, token_key, user_id) if token_id else None
# Search rants # Search rants
rows = await db.query_raw( rows = await db.query_raw(
@ -1148,12 +1148,11 @@ async def get_notifications(
ext_prof: int = 1, ext_prof: int = 1,
last_time: Optional[int] = None, last_time: Optional[int] = None,
app: int = 3, app: int = 3,
token_id: Optional[int] = None, token_id: int = None,
token_key: Optional[str] = None, token_key: str = None,
user_id: Optional[int] = None user_id: int = None
): ):
# Use the generic authenticate_user function current_user_id = await get_current_user(token_id, token_key, user_id)
current_user_id = await authenticate_user(token_id, token_key, user_id)
if not current_user_id: if not current_user_id:
return {"success": False, "error": "Authentication required"} return {"success": False, "error": "Authentication required"}
@ -1186,9 +1185,8 @@ async def get_notifications(
if not row['read']: if not row['read']:
unread_count += 1 unread_count += 1
# Mark notifications as read # Mark as read
if rows: # Only update if there are notifications await db.update("notifications", {"read": 1}, {"user_id": current_user_id})
await db.update("notifications", {"read": 1}, {"user_id": current_user_id})
return { return {
"success": True, "success": True,
@ -1208,25 +1206,6 @@ async def get_notifications(
} }
} }
async def authenticate_user(token_id: Optional[int] = None,
token_key: Optional[str] = None,
user_id: Optional[int] = None):
"""Generic authentication function that works with any parameter source"""
if not all([token_id, token_key, user_id]):
return None
token = await db.get("auth_tokens", {
"id": token_id,
"token_key": token_key,
"user_id": user_id
})
if not token or token['expire_time'] <= int(datetime.now().timestamp()):
return None
return user_id
@app.delete("/api/users/me/notif-feed") @app.delete("/api/users/me/notif-feed")
async def clear_notifications( async def clear_notifications(
app: int = Form(3), app: int = Form(3),
@ -1234,7 +1213,7 @@ async def clear_notifications(
token_key: str = Form(...), token_key: str = Form(...),
user_id: int = Form(...) user_id: int = Form(...)
): ):
current_user_id = await authenticate_user(token_id, token_key, user_id) current_user_id = await get_current_user(token_id, token_key, user_id)
if not current_user_id: if not current_user_id:
return {"success": False, "error": "Authentication required"} return {"success": False, "error": "Authentication required"}
@ -1254,7 +1233,7 @@ async def edit_profile(
token_key: str = Form(...), token_key: str = Form(...),
user_id: int = Form(...) user_id: int = Form(...)
): ):
current_user_id = await authenticate_user(token_id, token_key, user_id) current_user_id = await get_current_user(token_id, token_key, user_id)
if not current_user_id: if not current_user_id:
return {"success": False, "error": "Authentication required"} return {"success": False, "error": "Authentication required"}
@ -1283,7 +1262,7 @@ async def resend_confirmation(
token_key: str = Form(...), token_key: str = Form(...),
user_id: int = Form(...) user_id: int = Form(...)
): ):
current_user_id = await authenticate_user(token_id, token_key, user_id) current_user_id = await get_current_user(token_id, token_key, user_id)
if not current_user_id: if not current_user_id:
return {"success": False, "error": "Authentication required"} return {"success": False, "error": "Authentication required"}
@ -1298,7 +1277,7 @@ async def mark_news_read(
token_key: str = Form(...), token_key: str = Form(...),
user_id: int = Form(...) user_id: int = Form(...)
): ):
current_user_id = await authenticate_user(token_id, token_key, user_id) current_user_id = await get_current_user(token_id, token_key, user_id)
if not current_user_id: if not current_user_id:
return {"success": False, "error": "Authentication required"} return {"success": False, "error": "Authentication required"}

View File

@ -3,7 +3,7 @@
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Rant Community</title> <title>DevRant Community</title>
<style> <style>
* { * {
margin: 0; margin: 0;
@ -555,7 +555,7 @@
<!-- Navigation --> <!-- Navigation -->
<nav> <nav>
<div class="nav-container"> <div class="nav-container">
<a href="#" class="logo" onclick="showFeed()">Rant</a> <a href="#" class="logo" onclick="showFeed()">DevRant</a>
<div class="nav-links"> <div class="nav-links">
<a href="#" onclick="showFeed()">Feed</a> <a href="#" onclick="showFeed()">Feed</a>
<a href="#" onclick="showSearch()">Search</a> <a href="#" onclick="showSearch()">Search</a>
@ -636,41 +636,39 @@
document.getElementById('createRantBtn').style.display = isLoggedIn ? 'flex' : 'none'; document.getElementById('createRantBtn').style.display = isLoggedIn ? 'flex' : 'none';
} }
async function apiCall(endpoint, options = {}) {
const url = `${API_URL}${endpoint}`;
// Add auth to FormData or URLSearchParams if logged in
if (currentUser && options.body) {
if (options.body instanceof FormData) {
options.body.append('app', APP_ID);
options.body.append('token_id', currentUser.token_id);
options.body.append('token_key', currentUser.token_key);
options.body.append('user_id', currentUser.id);
} else if (options.body instanceof URLSearchParams) {
options.body.append('app', APP_ID);
options.body.append('token_id', currentUser.token_id);
options.body.append('token_key', currentUser.token_key);
options.body.append('user_id', currentUser.id);
}
}
async function apiCall(endpoint, options = {}) { // Add auth to query params for GET requests
let url = `${API_URL}${endpoint}`; if (currentUser && (options.method === 'GET' || !options.method)) {
const separator = endpoint.includes('?') ? '&' : '?';
// Add auth to FormData or URLSearchParams if logged in endpoint += `${separator}app=${APP_ID}&token_id=${currentUser.token_id}&token_key=${currentUser.token_key}&user_id=${currentUser.id}`;
if (currentUser && options.body) { }
if (options.body instanceof FormData) {
options.body.append('app', APP_ID); try {
options.body.append('token_id', currentUser.token_id); const response = await fetch(url, options);
options.body.append('token_key', currentUser.token_key); const data = await response.json();
options.body.append('user_id', currentUser.id); return data;
} else if (options.body instanceof URLSearchParams) { } catch (error) {
options.body.append('app', APP_ID); console.error('API Error:', error);
options.body.append('token_id', currentUser.token_id); return { success: false, error: error.message };
options.body.append('token_key', currentUser.token_key); }
options.body.append('user_id', currentUser.id);
} }
}
// Add auth to query params for GET requests
if (currentUser && (options.method === 'GET' || !options.method)) {
const separator = endpoint.includes('?') ? '&' : '?';
url += `${separator}app=${APP_ID}&token_id=${currentUser.token_id}&token_key=${currentUser.token_key}&user_id=${currentUser.id}`;
}
try {
const response = await fetch(url, options);
const data = await response.json();
return data;
} catch (error) {
console.error('API Error:', error);
return { success: false, error: error.message };
}
}
// View functions // View functions
async function showFeed(sort = 'recent') { async function showFeed(sort = 'recent') {
@ -691,7 +689,7 @@ async function apiCall(endpoint, options = {}) {
`; `;
const params = new URLSearchParams({ sort, limit: 50, skip: 0, app: APP_ID }); const params = new URLSearchParams({ sort, limit: 50, skip: 0, app: APP_ID });
const data = await apiCall(`/rant/rants?${params}`); const data = await apiCall(`/devrant/rants?${params}`);
if (data.success) { if (data.success) {
content.innerHTML = ` content.innerHTML = `
@ -753,7 +751,7 @@ async function apiCall(endpoint, options = {}) {
`; `;
const params = new URLSearchParams({ app: APP_ID }); const params = new URLSearchParams({ app: APP_ID });
const data = await apiCall(`/rant/rants/${rantId}?${params}`); const data = await apiCall(`/devrant/rants/${rantId}?${params}`);
if (data.success) { if (data.success) {
const rant = data.rant; const rant = data.rant;
@ -972,7 +970,7 @@ async function apiCall(endpoint, options = {}) {
`; `;
const params = new URLSearchParams({ term, app: APP_ID }); const params = new URLSearchParams({ term, app: APP_ID });
const data = await apiCall(`/rant/search?${params}`); const data = await apiCall(`/devrant/search?${params}`);
if (data.success) { if (data.success) {
if (data.results.length === 0) { if (data.results.length === 0) {
@ -983,66 +981,57 @@ async function apiCall(endpoint, options = {}) {
} }
} }
async function showNotifications() { async function showNotifications() {
currentView = 'notifications'; currentView = 'notifications';
const content = document.getElementById('content'); const content = document.getElementById('content');
content.innerHTML = ` content.innerHTML = `
<div class="loading"> <div class="loading">
<div class="spinner"></div> <div class="spinner"></div>
<p>Loading notifications...</p> <p>Loading notifications...</p>
</div>
`;
const params = new URLSearchParams({
ext_prof: 1,
last_time: Math.floor(Date.now() / 1000) - 86400
});
const data = await apiCall(`/users/me/notif-feed?${params}`);
if (data.success) {
const items = data.data.items;
content.innerHTML = `
<h2>Notifications</h2>
${items.length === 0 ? '<p style="text-align: center; color: var(--text-dim); margin-top: 2rem;">No notifications</p>' : ''}
${items.map(notif => `
<div class="rant-card" onclick="showRant(${notif.rant_id})" style="cursor: pointer;">
<p><strong>${notif.username}</strong> ${notif.type === 'comment' ? 'commented on your rant' : 'mentioned you'}</p>
<p style="color: var(--text-dim); font-size: 0.9rem;">${formatTime(notif.created_time)}</p>
</div> </div>
`).join('')} `;
`;
const params = new URLSearchParams({
// Update notification count ext_prof: 1,
updateNotificationCount(0); last_time: Math.floor(Date.now() / 1000) - 86400,
} else { app: APP_ID
content.innerHTML = ` });
<h2>Notifications</h2> const data = await apiCall(`/users/me/notif-feed?${params}`);
<p style="text-align: center; color: var(--error); margin-top: 2rem;">Failed to load notifications: ${data.error || 'Unknown error'}</p>
`; if (data.success) {
} const items = data.data.items;
}
content.innerHTML = `
<h2>Notifications</h2>
${items.length === 0 ? '<p style="text-align: center; color: var(--text-dim); margin-top: 2rem;">No notifications</p>' : ''}
${items.map(notif => `
async function checkNotifications() { <div class="rant-card" onclick="showRant(${notif.rant_id})">
if (!currentUser) return; <p><strong>${notif.username}</strong> ${notif.type === 'comment' ? 'commented on your rant' : 'mentioned you'}</p>
<p style="color: var(--text-dim); font-size: 0.9rem;">${formatTime(notif.created_time)}</p>
const params = new URLSearchParams({ </div>
ext_prof: 1, `).join('')}
last_time: Math.floor(Date.now() / 1000) - 86400 `;
});
// Update notification count
const data = await apiCall(`/users/me/notif-feed?${params}`); updateNotificationCount(0);
}
if (data.success) { }
updateNotificationCount(data.data.num_unread);
}
}
async function checkNotifications() {
if (!currentUser) return;
const params = new URLSearchParams({
ext_prof: 1,
last_time: Math.floor(Date.now() / 1000) - 86400,
app: APP_ID
});
const data = await apiCall(`/users/me/notif-feed?${params}`);
if (data.success) {
updateNotificationCount(data.data.num_unread);
}
}
function updateNotificationCount(count) { function updateNotificationCount(count) {
const notifCount = document.getElementById('notifCount'); const notifCount = document.getElementById('notifCount');
@ -1230,7 +1219,7 @@ async function checkNotifications() {
event.preventDefault(); event.preventDefault();
const formData = new FormData(event.target); const formData = new FormData(event.target);
const data = await apiCall('/rant/rants', { const data = await apiCall('/devrant/rants', {
method: 'POST', method: 'POST',
body: formData body: formData
}); });
@ -1255,7 +1244,7 @@ async function checkNotifications() {
formData.append('reason', 0); // Not for me formData.append('reason', 0); // Not for me
} }
const data = await apiCall(`/rant/rants/${rantId}/vote`, { const data = await apiCall(`/devrant/rants/${rantId}/vote`, {
method: 'POST', method: 'POST',
body: formData body: formData
}); });
@ -1300,7 +1289,7 @@ async function checkNotifications() {
const endpoint = isFavorited ? 'unfavorite' : 'favorite'; const endpoint = isFavorited ? 'unfavorite' : 'favorite';
const formData = new FormData(); const formData = new FormData();
const data = await apiCall(`/rant/rants/${rantId}/${endpoint}`, { const data = await apiCall(`/devrant/rants/${rantId}/${endpoint}`, {
method: 'POST', method: 'POST',
body: formData body: formData
}); });
@ -1314,7 +1303,7 @@ async function checkNotifications() {
event.preventDefault(); event.preventDefault();
const formData = new FormData(event.target); const formData = new FormData(event.target);
const data = await apiCall(`/rant/rants/${rantId}/comments`, { const data = await apiCall(`/devrant/rants/${rantId}/comments`, {
method: 'POST', method: 'POST',
body: formData body: formData
}); });
@ -1333,7 +1322,7 @@ async function checkNotifications() {
params.append('token_key', currentUser.token_key); params.append('token_key', currentUser.token_key);
params.append('user_id', currentUser.id); params.append('user_id', currentUser.id);
const data = await apiCall(`/rant/rants/${rantId}?${params}`, { const data = await apiCall(`/devrant/rants/${rantId}?${params}`, {
method: 'DELETE' method: 'DELETE'
}); });