From 2aa2d5c8a5ba35919543ee0bdce30a2dd945c2dc Mon Sep 17 00:00:00 2001 From: Weather Date: Sat, 28 Mar 2026 03:13:44 -0400 Subject: [PATCH 01/10] feat: implements css themes and 50th start --- Dockerfile | 2 +- src/core/cshcalendar.py | 2 +- src/static/css/style.css | 91 ++++++++++++++++++++++++++++++---------- src/static/js/main.js | 58 +++++++++++++------------ src/templates/index.html | 4 +- 5 files changed, 105 insertions(+), 52 deletions(-) diff --git a/Dockerfile b/Dockerfile index 36e221c..c1a8241 100644 --- a/Dockerfile +++ b/Dockerfile @@ -21,4 +21,4 @@ RUN addgroup -g 2000 jumpgroup && adduser -S -u 1001 -G jumpgroup jumpstart && \ USER jumpstart -CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000", "--log-config", "/jumpstart/logging_config.yaml", "--proxy-headers","--forwarded-allow-ips","*"] +CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000", "--log-config", "/jumpstart/logging_config.yaml", "--proxy-headers", "--forwarded-allow-ips", "*"] diff --git a/src/core/cshcalendar.py b/src/core/cshcalendar.py index 3434ff8..dcaabc5 100644 --- a/src/core/cshcalendar.py +++ b/src/core/cshcalendar.py @@ -54,7 +54,7 @@ (WEEK - DAY): f"In %{DAY}% Days", } -BORDER_STRING: str = "
" +BORDER_STRING: str = '
' TIME_PATTERN = re.compile(r"%([^%]+)%") diff --git a/src/static/css/style.css b/src/static/css/style.css index 47b7d0a..3f70c71 100644 --- a/src/static/css/style.css +++ b/src/static/css/style.css @@ -1,3 +1,40 @@ +/* Creates a default theme, but can get overwritten */ +:root { + --panel-header-color: #B0197E; /* Standard color for panels header*/ + --panel-body-color: #FFFFFF; /* text body */ + --panel-header-text-color: #FFFFFF; /* Used for headers in panels, like Page - csh/Wikithoughts */ + --panel-body-text-color: #FFFFFF; /* Used for the text within said panels */ + --border-color: #34495E; /* Used for borders around elements */ + --shadow-color: rgb(176,25,126, 0.5); /* Used for the shadow in the calendar */ +} + +.theme-dark { + --panel-header-color: #B0197E; /* Standard color for panels header*/ + --panel-header-text-color: #FFFFFF; /* Used for headers in panels, like Page - csh/Wikithoughts */ + --panel-body-color: #000000; /* text body */ + --panel-body-text-color: #FFFFFF; /* Used for the text within said panels */ + --border-color: #34495E; /* Used for borders around elements */ + --shadow-color: rgba(255, 0, 170, 0.705); /* Used for the shadow in the calendar */ +} + +.theme-light { + --panel-header-color: #B0197E; /* Standard color for panels header*/ + --panel-body-color: #FFFFFF; /* text body */ + --panel-header-text-color: #FFFFFF; /* Used for headers in panels, like Page - csh/Wikithoughts */ + --panel-body-text-color: #000000; /* Used for the text within said panels */ + --border-color: #34495E; /* Used for borders around elements */ + --shadow-color: rgb(176,25,126, 0.5); /* Used for the shadow in the calendar */ +} + +.theme-golden { + --panel-header-color: #CC9318; /* Standard color for panels header*/ + --panel-header-text-color: #000000; /* Used for headers in panels, like Page - csh/Wikithoughts */ + --panel-body-color: #000000; /* text body */ + --panel-body-text-color: #FFFFFF; /* Used for the text within said panels */ + --border-color: #34495E; /* Used for borders around elements */ + --shadow-color: rgba(206, 191, 149, 0.767); /* Used for the shadow in the calendar */ +} + body{ background-image: url('/static/img/darkmodeF.png'); overflow: hidden; @@ -10,14 +47,21 @@ body{ } .panel-primary{ - background: #34495e; - border: 8px #34495e solid ; + background: var(--border-color); + border: 8px var(--border-color) solid ; border-radius: 10px; } +.panel-heading{ + background-color: var(--panel-header-color) !important; +} + +.panel-body{ + background-color: var(--panel-body-color) !important; +} #top-bar{ - border: 5px #B0197E solid; - background-color: #34495e; + border: 5px var(--panel-header-color) solid; + background-color: var(--border-color); } #timewidget-fake{ @@ -25,19 +69,18 @@ body{ } .file-title{ - color: #fcf6fa; + color: var(--panel-body-text-color); font-family: 'Courier New', Courier, monospace; font-size: 28px; - border-left: 5px #B0197E solid; + border-left: 5px var(--panel-header-color) solid; float: right; width: 29%; } .js-title{ - color: #fcf6fa; + color: var(--panel-body-text-color); font-family: 'Courier New', Courier, monospace; font-size: 30px; - border-left: 5px #B0197E solid; float: right; } @@ -49,18 +92,18 @@ body{ .weatherwidget{ float: right; width: 49%; - border: 8px #34495e solid; + border: 8px var(--border-color) solid; border-radius: 10px; - background-color: #34495e; + background-color: var(--border-color); margin-bottom: 1.5%; } .datadog{ margin-top: 20px; overflow: auto; - border: 8px #34495e solid; + border: 8px var(--border-color) solid; border-radius: 10px; - background-color: #34495e; + background-color: var(--border-color); width: 760px; height: 580px; float: right; @@ -78,14 +121,14 @@ body{ } .announcements-text-header{ - color: white; + color: var(--panel-header-text-color); font-family: 'Courier New', Courier, monospace; font-size: 20px; text-align: center; } .announcements-text-body{ - color: black; + color: var(--panel-body-text-color); font-family: 'Courier New', Courier, monospace; font-size: 18px; text-align: center; @@ -98,22 +141,22 @@ body{ } .wikithoughts-text-header{ - color: white; + color: var(--panel-header-text-color); font-family: 'Courier New', Courier, monospace; font-size: 20px; text-align: center; } .wikithoughts-text-body{ - color: black; + color:var(--panel-body-text-color); font-family: 'Courier New', Courier, monospace; font-size: 18px; text-align: center; } .calendar-frame-lvl1{ - background-color: #fcf6fa; - border: 8px #34495e solid; + background-color: var(--panel-body-color); + border: 8px var(--border-color) solid; border-radius: 10px; margin-top: 20px; height: 950px; @@ -127,19 +170,25 @@ body{ } .calendar-text-date{ - color: #4c4c4c; + color: var(--panel-body-text-color); font-family: 'Courier New', Courier, monospace; font-size: 20px; - text-shadow: 2px 2px 3px rgb(176,25,126, 0.5); + text-shadow: 2px 2px 3px var(--shadow-color); text-align: center; } .calendar-text{ - color: black; + color: var(--panel-body-text-color); font-family: 'Courier New', Courier, monospace; font-size: 19px; } +.calendar-border{ + border: 0px solid; + border-top: 2px solid var(--panel-header-color); + margin: 10px 0; +} + @media screen and (max-width: 1899px) { .wikithoughts{ width: 49%; diff --git a/src/static/js/main.js b/src/static/js/main.js index 92f0f18..cc2f2e9 100644 --- a/src/static/js/main.js +++ b/src/static/js/main.js @@ -1,22 +1,45 @@ +let current_theme = ""; + +function resetAllThemes(){ + document.body.classList.forEach(cls => { + if (cls.startsWith('theme-')) { + document.body.classList.remove(cls); + }}); +} + +function setNewTheme(newTheme) { + if (newTheme === current_theme) { + return; + } + resetAllThemes(); + document.body.classList.toggle(newTheme); + current_theme = newTheme; +} + async function longUpdate() { const date = new Date(); const hour = date.getHours(); const month = date.getMonth() + 1; const day = date.getDate(); + const isDay = (hour > 9 && hour < 18); + let is_golden = true; let bgImage = "url(../static/img/darkmodeF.png)"; + if (month === 2 && [12, 13, 14].includes(day)) { bgImage = "url(../static/img/valentinemode.png)"; } else if (month === 3 && day === 13) { bgImage = "url(../static/img/jumpstartbang.png)"; + } else if (month === 4 && [10, 11, 12].includes(day)) { + is_golden = true; } else if (month === 10 && [29, 30, 31].includes(day)) { bgImage = "url(../static/img/spookymode.png)"; } else if (month === 11 && day === 2) { bgImage = "url(../static/img/duckymode2.png)"; } else if ([11, 12].includes(month)) { bgImage = "url(../static/img/wintermode.png)"; - } else if (hour > 9 && hour < 18) { + } else if (isDay) { bgImage = "url(../static/img/lightmodeF.png)"; } $("body").css("background-image", bgImage); @@ -26,34 +49,15 @@ async function longUpdate() { const data = await res.json(); $("#calendar").html(data.data); - const isDay = hour > 9 && hour < 18; - const panelBody = $(".panel-body"); - const plugBody = $(".plug-body"); - const wikiPages = $(".wikithoughts-text-body"); - const announcementsBody = $(".announcements-text-body"); - const calendarFrame = $(".calendar-frame-lvl1"); - const calendarTextDate = $(".calendar-text-date"); - const calendarText = $(".calendar-text"); - - if (isDay) { - panelBody.css("background-color", "white"); - plugBody.css("background-color", "white"); - wikiPages.css({ "background-color": "white", "color": "black" }); - announcementsBody.css("color", "black"); - calendarFrame.css("background-color", "white"); - calendarTextDate.css("color", "black"); - calendarText.css("color", "black"); - } else { - panelBody.css("background-color", "black"); - plugBody.css("background-color", "black"); - wikiPages.css({ "background-color": "black", "color": "white" }); - announcementsBody.css("color", "white"); - calendarFrame.css("background-color", "black"); - calendarTextDate.css("color", "white"); - calendarText.css("color", "white"); + if (is_golden){ + setNewTheme("theme-golden") + } else if (isDay) { + setNewTheme("theme-light") + } else{ + setNewTheme("theme-dark") } - $("#datadog").attr('src', ddog_dashboard + new Date().now()); + $("#datadog").attr('src', ddog_dashboard + Date().now()); } catch (err) { console.log(err); diff --git a/src/templates/index.html b/src/templates/index.html index 1c48aa3..676ff41 100644 --- a/src/templates/index.html +++ b/src/templates/index.html @@ -15,7 +15,7 @@
- +
@@ -37,7 +37,7 @@ data-font="Fira Sans" data-icons="Climacons Animated" data-days="100" - data-theme="kitty"> + data-theme="dark"> ROCHESTER WEATHER
- {% block head %}{% endblock %} diff --git a/src/templates/index.html b/src/templates/index.html index 676ff41..a2158f2 100644 --- a/src/templates/index.html +++ b/src/templates/index.html @@ -73,4 +73,5 @@
+ {% endblock %} \ No newline at end of file From dae2e139f766e32205225be33b697762fa2d3a6d Mon Sep 17 00:00:00 2001 From: Weather Date: Mon, 30 Mar 2026 17:30:15 -0400 Subject: [PATCH 05/10] fix: 50th only being set for 50th --- src/static/js/main.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/static/js/main.js b/src/static/js/main.js index 4b9bf6d..3ea0e45 100644 --- a/src/static/js/main.js +++ b/src/static/js/main.js @@ -75,7 +75,6 @@ async function longUpdate() { const isDay = (hour > 9 && hour < 18); let is_golden = (month === 4 && [9, 10, 11, 12].includes(day)); - is_golden = true; let bgImage = "url(../static/img/darkmodeF.png)"; if (month === 2 && [12, 13, 14].includes(day)) { From f7e04b0aa9f79071628946e8b932fda09641115b Mon Sep 17 00:00:00 2001 From: Weather Date: Thu, 2 Apr 2026 01:03:47 -0400 Subject: [PATCH 06/10] fix: Weather widget not updating properly --- mkdocs.yml | 6 +- src/api/endpoints.py | 20 ++++--- src/core/cshcalendar.py | 7 +-- src/core/wikithoughts.py | 121 +++++++++++++++++++++++---------------- src/main.py | 4 +- src/requirements.txt | 2 - src/static/css/style.css | 36 ++++++------ src/static/js/main.js | 49 ++++++++++------ 8 files changed, 141 insertions(+), 104 deletions(-) diff --git a/mkdocs.yml b/mkdocs.yml index acafb5b..234a459 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -38,10 +38,10 @@ use_directory_urls: false nav: - Home: index.md - Getting Started: getting-started/getting-started.md - - Backend: - - Wikithoughts: core/Wiki-thoughts.md + - Backend: - Calendar: core/CSH Calendar.md - - Slack: core/Slack.md + - Slack Bot: core/Slack.md + - Wiki Thoughts: core/Wiki-thoughts.md - Endpoints: - Calendar: endpoints/calendar_endpoint.md - Announcements: endpoints/announcements.md diff --git a/src/api/endpoints.py b/src/api/endpoints.py index 887d28d..28de1ea 100644 --- a/src/api/endpoints.py +++ b/src/api/endpoints.py @@ -14,6 +14,8 @@ logger: Logger = getLogger(__name__) router: APIRouter = APIRouter() +ACCEPT_MESSAGE: str = "Posting right now :^)" +DENY_MESSAGE: str = "Okay :( maybe next time" @router.get("/api/calendar") async def get_calendar() -> JSONResponse: @@ -121,16 +123,18 @@ async def message_actions(payload: str = Form(...)) -> JSONResponse: slack.add_announcement(message_object) if response_url: - await httpx.post( - response_url, - json={"text": "Posting right now :^)", "replace_original": True}, - ) + async with httpx.AsyncClient() as client: + await client.post( + response_url, + json={"text": ACCEPT_MESSAGE, "replace_original": True}, + ) else: if response_url: - await httpx.post( - response_url, - json={"text": "Okay :( maybe next time", "replace_original": True}, - ) + async with httpx.AsyncClient() as client: + await client.post( + response_url, + json={"text": DENY_MESSAGE, "replace_original": True}, + ) except Exception as e: logger.error(f"Error in message_actions: {e}") diff --git a/src/core/cshcalendar.py b/src/core/cshcalendar.py index dcaabc5..a9bb7d9 100644 --- a/src/core/cshcalendar.py +++ b/src/core/cshcalendar.py @@ -314,10 +314,9 @@ async def get_future_events() -> list[CalendarInfo]: if cal_correct_length: logger.info("Calendar cache is full length, rebuilding async!") - asyncio.create_task( - rebuild_calendar() - ) # Calendar is correct length, we can just run this in the background - # Make it a variable for GC purposes? idk sonarqube told me to do it + async with asyncio.TaskGroup() as taskGroup: + taskGroup.create_task(rebuild_calendar()) + # Calendar is correct length, we can just run this in the background else: logger.info("Calendar cache is NOT full length, yielding rebuild!") await rebuild_calendar() diff --git a/src/core/wikithoughts.py b/src/core/wikithoughts.py index 4173fab..3856464 100644 --- a/src/core/wikithoughts.py +++ b/src/core/wikithoughts.py @@ -219,6 +219,64 @@ def process_category_page(r_json: dict[str, str]) -> tuple[list[str], bool | str return (titles, False) + +async def fetch_category_pages(response: httpx.Response) -> list[str]: + """ + Loops through and gets the list of every page for Jumpstart Curated + + Args: + response (httpx.Response): The response to be converted and searched through + + Returns: + list[str]: The list of titles to be fetched. + """ + + params: dict[str, str] = { + "action": "query", + "list": "categorymembers", + "cmtitle": f"Category:{WIKI_CATEGORY}", + "cmlimit": "500", + "format": "json", + } + + titles_found: list[str] = [] + + while True: + r_json: dict[str, str] = response.json() + + if "error" in r_json and r_json["error"].get("code") in ( + "readapidenied", + "notloggedin", + ): + if failed_authentication_attempts > REAUTHENTICATE_ATTEMPTS: + logger.warning( + "Reauthenticating the wikithought bot failed, sending empty response" + ) + return [] + + logger.info("Bot was unauthenticated, attempting to reauthenticate!") + await auth_bot() + if not (bot_authenticated): + logger.warning( + f"Failed to reauthenticate the bot! Attempt: {failed_authentication_attempts}" + ) + + failed_authentication_attempts += 1 + continue + + added, repeat_req = process_category_page(r_json) + titles_found += added + + if repeat_req not in (None, False, ""): + params["cmcontinue"] = repeat_req + + response = await client.get( + WIKI_API, params=params + ) + continue + break + return titles_found + async def refresh_category_pages() -> list[str]: """ Refreshes all pages of the category @@ -227,7 +285,8 @@ async def refresh_category_pages() -> list[str]: category (str): The name of the category to search through Returns: - list[str]: All the page titles found in this category, None if the bot is not authorized + list[str] + : All the page titles found in this category, None if the bot is not authorized """ global page_title_cache, last_updated_time, queued_pages, shown_pages time_now: datetime = datetime.now() @@ -245,54 +304,19 @@ async def refresh_category_pages() -> list[str]: } headers: dict[str, str] = headers_formatting() - # This needs to loop due to mediawiki limitations - - failed_authentication_attempts: int = 0 + response: httpx.Response = await client.get( + WIKI_API, params=params, headers=headers + ) - while True: - response: httpx.Response = await client.get( - WIKI_API, params=params, headers=headers - ) - - if response.status_code == 304: - last_updated_time = time_now - return page_title_cache - - elif response.status_code == 200: - headers_formatting(etag, last_modifed) - r_json: dict[str, str] = response.json() - - if "error" in r_json and r_json["error"].get("code") in ( - "readapidenied", - "notloggedin", - ): - if failed_authentication_attempts > REAUTHENTICATE_ATTEMPTS: - logger.warning( - "Reauthenticating the wikithought bot failed, sending empty response" - ) - return [] - - logger.info(f"Both was unauthenticated, attempting to reauthenticate!") - await auth_bot() - if not (bot_authenticated): - logger.warning( - "Failed to reauthenticate the bot! Attempt: " - + failed_authentication_attempts - ) - - failed_authentication_attempts += 1 - continue - - added, repeat_req = process_category_page(r_json) - titles += added - - if repeat_req not in (None, False, ""): - params["cmcontinue"] = repeat_req - continue - break - else: - logger.warning("Failed to update the CSH wiki page!") - return page_title_cache + if response.status_code == 304: + last_updated_time = time_now + return page_title_cache + + elif response.status_code == 200: + titles = await fetch_category_pages(response=response) + else: + logger.warning("Failed to update the CSH wiki page!") + return page_title_cache last_updated_time = time_now page_title_cache = titles @@ -335,7 +359,6 @@ async def refresh_page_dictionary() -> None: if "query" in r_json: for page in r_json["query"]["pages"].values(): wikitext = page["revisions"][0]["slots"]["main"]["*"] - cleaned_text = clean_wikitext(wikitext) # unfuck the text paragraphs = cleaned_text.split("\n\n") # Cut the first line diff --git a/src/main.py b/src/main.py index 43b7f13..cd14e90 100644 --- a/src/main.py +++ b/src/main.py @@ -27,8 +27,10 @@ @asynccontextmanager async def lifespan(app: FastAPI): logger.info("Starting up the Jumpstart application!") - asyncio.create_task(cshcalendar.rebuild_calendar()) + async with asyncio.TaskGroup() as tg: + tg.create_task(cshcalendar.rebuild_calendar()) await wikithoughts.auth_bot() + yield logger.info("Shutting down the Jumpstart application!") await cshcalendar.close_client() diff --git a/src/requirements.txt b/src/requirements.txt index 0b1faf8..305684d 100644 --- a/src/requirements.txt +++ b/src/requirements.txt @@ -19,8 +19,6 @@ icalendar==7.0.3 recurring-ical-events==3.8.1 arrow==1.4.0 -# For Wikithoughts - # For the docker to run uvicorn==0.41.0 pyyaml==6.0.3 diff --git a/src/static/css/style.css b/src/static/css/style.css index ef5a5a5..750eb83 100644 --- a/src/static/css/style.css +++ b/src/static/css/style.css @@ -9,30 +9,30 @@ } .theme-dark { - --panel-header-color: #B0197E; /* Standard color for panels header*/ - --panel-header-text-color: #FFFFFF; /* Used for headers in panels, like Page - csh/Wikithoughts */ - --panel-body-color: #000000; /* text body */ - --panel-body-text-color: #FFFFFF; /* Used for the text within said panels */ - --border-color: #34495E; /* Used for borders around elements */ - --shadow-color: rgba(255, 0, 170, 0.705); /* Used for the shadow in the calendar */ + --panel-header-color: #B0197E; + --panel-header-text-color: #FFFFFF; + --panel-body-color: #000000; + --panel-body-text-color: #FFFFFF; + --border-color: #34495E; + --shadow-color: rgba(255, 0, 170, 0.705); } .theme-light { - --panel-header-color: #B0197E; /* Standard color for panels header*/ - --panel-body-color: #FFFFFF; /* text body */ - --panel-header-text-color: #FFFFFF; /* Used for headers in panels, like Page - csh/Wikithoughts */ - --panel-body-text-color: #000000; /* Used for the text within said panels */ - --border-color: #34495E; /* Used for borders around elements */ - --shadow-color: rgb(176,25,126, 0.5); /* Used for the shadow in the calendar */ + --panel-header-color: #B0197E; + --panel-body-color: #FFFFFF; + --panel-header-text-color: #FFFFFF; + --panel-body-text-color: #000000; + --border-color: #34495E; + --shadow-color: rgb(176,25,126, 0.5); } .theme-golden { - --panel-header-color: #FFC64A; /* Standard color for panels header*/ - --panel-header-text-color: #000000; /* Used for headers in panels, like Page - csh/Wikithoughts */ - --panel-body-color: #000000; /* text body */ - --panel-body-text-color: #FFFFFF; /* Used for the text within said panels */ - --border-color: #34495E; /* Used for borders around elements */ - --shadow-color: rgba(206, 191, 149, 0.767); /* Used for the shadow in the calendar */ + --panel-header-color: #FFC64A; + --panel-header-text-color: #000000; + --panel-body-color: #000000; + --panel-body-text-color: #FFFFFF; + --border-color: #34495E; + --shadow-color: rgb(255, 212, 94); } body{ diff --git a/src/static/js/main.js b/src/static/js/main.js index 3ea0e45..6f22885 100644 --- a/src/static/js/main.js +++ b/src/static/js/main.js @@ -2,6 +2,7 @@ let currentPageTheme = ""; let currentDatadogTheme = ""; let currentWeatherTheme = ""; +let mode_enabled = false; /* The struct of all the different themes. - Page: The .css page theme to be loaded (make sure they start with theme-)! @@ -28,9 +29,7 @@ const allThemes = { function setDatadogTheme(newTheme) { - if (newTheme === currentDatadogTheme) { - return; - } + if (newTheme === currentDatadogTheme) return; currentDatadogTheme = newTheme; const iframe = document.getElementById("datadog"); @@ -40,23 +39,35 @@ function setDatadogTheme(newTheme) { } function setWeatherTheme(newTheme) { - if (newTheme === currentWeatherTheme) { - return; - } + if (newTheme === currentWeatherTheme) return; currentWeatherTheme = newTheme; - const widget = document.getElementById("weather-image"); - widget.setAttribute("data-theme", newTheme); - - if (globalThis.weatherWidget) { - widget.innerHTML = widget.innerHTML; - weatherWidget.init(); - } + + const oldWidget = document.getElementById("weather-image"); + + const newWidget = document.createElement("a"); + newWidget.className = "weatherwidget-io"; + newWidget.id = "weather-image"; + newWidget.href = "https://forecast7.com/en/43d16n77d61/rochester/?unit=us"; + + newWidget.setAttribute("data-label_1", "ROCHESTER"); + newWidget.setAttribute("data-label_2", "WEATHER"); + newWidget.setAttribute("data-font", "Fira Sans"); + newWidget.setAttribute("data-icons", "Climacons Animated"); + newWidget.setAttribute("data-days", "100"); + newWidget.setAttribute("data-theme", newTheme); + + newWidget.textContent = "ROCHESTER WEATHER"; + oldWidget.replaceWith(newWidget); + + setTimeout(() => { + if (globalThis.__weatherwidget_init) { + globalThis.__weatherwidget_init(); + } + }, 100); } function setNewPageTheme(newTheme) { - if (newTheme === currentPageTheme) { - return; - } + if (newTheme === currentPageTheme) return; currentPageTheme = newTheme; document.body.classList.forEach(cls => { @@ -77,6 +88,9 @@ async function longUpdate() { let is_golden = (month === 4 && [9, 10, 11, 12].includes(day)); let bgImage = "url(../static/img/darkmodeF.png)"; + is_golden = mode_enabled; + mode_enabled = !mode_enabled; + if (month === 2 && [12, 13, 14].includes(day)) { bgImage = "url(../static/img/valentinemode.png)"; } else if (month === 3 && day === 13) { @@ -111,9 +125,6 @@ async function longUpdate() { const res = await fetch('/api/calendar', { method: 'GET', mode: 'cors' }); const data = await res.json(); $("#calendar").html(data.data); - - $("#datadog").attr('src', ddog_dashboard + Date().now()); - } catch (err) { console.log(err); } From a7f3ecb7c37a20e4b91482df09ca09b27b47eca6 Mon Sep 17 00:00:00 2001 From: Weather Date: Thu, 2 Apr 2026 01:19:27 -0400 Subject: [PATCH 07/10] fix: formatted --- src/api/endpoints.py | 1 + src/core/cshcalendar.py | 2 +- src/core/wikithoughts.py | 20 +++++++++----------- src/main.py | 2 +- 4 files changed, 12 insertions(+), 13 deletions(-) diff --git a/src/api/endpoints.py b/src/api/endpoints.py index 28de1ea..af56e1d 100644 --- a/src/api/endpoints.py +++ b/src/api/endpoints.py @@ -17,6 +17,7 @@ ACCEPT_MESSAGE: str = "Posting right now :^)" DENY_MESSAGE: str = "Okay :( maybe next time" + @router.get("/api/calendar") async def get_calendar() -> JSONResponse: """ diff --git a/src/core/cshcalendar.py b/src/core/cshcalendar.py index a9bb7d9..8b44d53 100644 --- a/src/core/cshcalendar.py +++ b/src/core/cshcalendar.py @@ -316,7 +316,7 @@ async def get_future_events() -> list[CalendarInfo]: logger.info("Calendar cache is full length, rebuilding async!") async with asyncio.TaskGroup() as taskGroup: taskGroup.create_task(rebuild_calendar()) - # Calendar is correct length, we can just run this in the background + # Calendar is correct length, we can just run this in the background else: logger.info("Calendar cache is NOT full length, yielding rebuild!") await rebuild_calendar() diff --git a/src/core/wikithoughts.py b/src/core/wikithoughts.py index 3856464..81a8c49 100644 --- a/src/core/wikithoughts.py +++ b/src/core/wikithoughts.py @@ -219,16 +219,15 @@ def process_category_page(r_json: dict[str, str]) -> tuple[list[str], bool | str return (titles, False) - async def fetch_category_pages(response: httpx.Response) -> list[str]: """ - Loops through and gets the list of every page for Jumpstart Curated - - Args: - response (httpx.Response): The response to be converted and searched through + Loops through and gets the list of every page for Jumpstart Curated + + Args: + response (httpx.Response): The response to be converted and searched through - Returns: - list[str]: The list of titles to be fetched. + Returns: + list[str]: The list of titles to be fetched. """ params: dict[str, str] = { @@ -270,13 +269,12 @@ async def fetch_category_pages(response: httpx.Response) -> list[str]: if repeat_req not in (None, False, ""): params["cmcontinue"] = repeat_req - response = await client.get( - WIKI_API, params=params - ) + response = await client.get(WIKI_API, params=params) continue break return titles_found + async def refresh_category_pages() -> list[str]: """ Refreshes all pages of the category @@ -311,7 +309,7 @@ async def refresh_category_pages() -> list[str]: if response.status_code == 304: last_updated_time = time_now return page_title_cache - + elif response.status_code == 200: titles = await fetch_category_pages(response=response) else: diff --git a/src/main.py b/src/main.py index cd14e90..43bc793 100644 --- a/src/main.py +++ b/src/main.py @@ -30,7 +30,7 @@ async def lifespan(app: FastAPI): async with asyncio.TaskGroup() as tg: tg.create_task(cshcalendar.rebuild_calendar()) await wikithoughts.auth_bot() - + yield logger.info("Shutting down the Jumpstart application!") await cshcalendar.close_client() From 4c8e037fa2b959a9bf0f449c952dfea8a69c6907 Mon Sep 17 00:00:00 2001 From: Weather Date: Thu, 2 Apr 2026 11:14:33 -0400 Subject: [PATCH 08/10] fix: Oops, It isin't 50th yet --- src/static/js/main.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/static/js/main.js b/src/static/js/main.js index 6f22885..3181218 100644 --- a/src/static/js/main.js +++ b/src/static/js/main.js @@ -2,7 +2,6 @@ let currentPageTheme = ""; let currentDatadogTheme = ""; let currentWeatherTheme = ""; -let mode_enabled = false; /* The struct of all the different themes. - Page: The .css page theme to be loaded (make sure they start with theme-)! @@ -88,9 +87,6 @@ async function longUpdate() { let is_golden = (month === 4 && [9, 10, 11, 12].includes(day)); let bgImage = "url(../static/img/darkmodeF.png)"; - is_golden = mode_enabled; - mode_enabled = !mode_enabled; - if (month === 2 && [12, 13, 14].includes(day)) { bgImage = "url(../static/img/valentinemode.png)"; } else if (month === 3 && day === 13) { From 14b403e5b6dc9054acf9bf695e5317c4a111e3dd Mon Sep 17 00:00:00 2001 From: Weather Date: Thu, 2 Apr 2026 11:25:13 -0400 Subject: [PATCH 09/10] fix: Javascript moment --- src/static/js/main.js | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/src/static/js/main.js b/src/static/js/main.js index 3181218..4c9c694 100644 --- a/src/static/js/main.js +++ b/src/static/js/main.js @@ -57,12 +57,6 @@ function setWeatherTheme(newTheme) { newWidget.textContent = "ROCHESTER WEATHER"; oldWidget.replaceWith(newWidget); - - setTimeout(() => { - if (globalThis.__weatherwidget_init) { - globalThis.__weatherwidget_init(); - } - }, 100); } function setNewPageTheme(newTheme) { @@ -144,12 +138,15 @@ async function mediumUpdate() { -mediumUpdate(); -longUpdate(); +document.addEventListener("DOMContentLoaded", () => { + mediumUpdate(); + longUpdate(); + + setInterval(longUpdate, 60000); + setInterval(mediumUpdate, 22000); -setInterval(longUpdate, 60000); -setInterval(mediumUpdate, 22000); -setInterval(() => { - if (globalThis.__weatherwidget_init) - globalThis.__weatherwidget_init(); -}, 1800000); \ No newline at end of file + setInterval(() => { + if (globalThis.__weatherwidget_init) + globalThis.__weatherwidget_init(); + }, 1800000); +}); From bc670369f86b922733da27026982178aba9d81d3 Mon Sep 17 00:00:00 2001 From: Weather Date: Thu, 2 Apr 2026 11:28:15 -0400 Subject: [PATCH 10/10] fix: no --- src/static/js/main.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/static/js/main.js b/src/static/js/main.js index 725a474..2c5a8c9 100644 --- a/src/static/js/main.js +++ b/src/static/js/main.js @@ -87,8 +87,6 @@ async function longUpdate() { bgImage = "url(../static/img/jumpstartbang.png)"; } else if (is_golden) { bgImage = "url(../static/img/goldenmode.png)"; - } else if (is_golden) { - bgImage = "url(../static/img/goldenmode.png)"; } else if (month === 10 && [29, 30, 31].includes(day)) { bgImage = "url(../static/img/spookymode.png)"; } else if (month === 11 && day === 2) {