# Updating staff_panel.html to add Announcement UI, and updating final.html to display announcement banner. from pathlib import Path import re base = Path("/mnt/data/pulsebot_store_extracted") login_path = base / "staff_login.html" panel_path = base / "staff_panel.html" final_path = base / "final.html" if not panel_path.exists() or not final_path.exists(): raise FileNotFoundError("Required files not found. Ensure staff_panel.html and final.html exist.") panel_html = panel_path.read_text(encoding="utf-8") final_html = final_path.read_text(encoding="utf-8") # Add Announcement UI to the sidebar in staff_panel.html (insert before closing of the aside's card section) announce_ui = """
Published announcements are stored in browser localStorage and displayed on the public site (client-side).
""" # Insert the UI into the first aside card area (we'll find the inviteInput block and insert after it) if "Announcements" not in panel_html: # Find location: after the inviteInput block in the aside card insert_after = 'input id="inviteInput" class="field" value="https://discord.gg/YBs9cE2cas" />' if insert_after in panel_html: panel_html = panel_html.replace(insert_after, insert_after + announce_ui) else: # fallback: append to end of first aside card before its closing div (search for "of panel_html panel_html = panel_path.read_text(encoding='utf-8') panel_html = panel_html.replace("", js_snippet + "\n") panel_path.write_text(panel_html, encoding="utf-8") print("Added announcement JS handlers to staff_panel.html") else: print("Announcement JS appears already present in staff_panel.html") # Now update final.html to display announcement banner reading from localStorage if "pulsebot_announcement" not in final_html: banner_css = """ """ banner_js = """ """ # Insert banner CSS and JS near end of
and before respectively. # Place CSS before closing if "" in final_html: final_html = final_html.replace("", banner_css + "\n") else: final_html = banner_css + final_html # Place JS before closing if "" in final_html: final_html = final_html.replace("", banner_js + "\n") else: final_html = final_html + banner_js final_path.write_text(final_html, encoding="utf-8") print("Inserted announcement banner rendering into final.html") else: print("Announcement banner code already present in final.html") # Output paths for user {"staff_login": str(login_path), "staff_panel": str(panel_path), "final": str(final_path)}