ritstudentgovernment / PawPrints

PawPrints petition application for the RIT community.
https://pawprints.rit.edu
Apache License 2.0
16 stars 13 forks source link

set petition metadata if a fresh page is loaded from the server with the new url format #151

Closed MoralCode closed 1 year ago

MoralCode commented 1 year ago

I know this doesnt include every way a user can get to a page that will show a pawprints modal, but this is only intended to cover the usecase for bots as outlined in #145, so users never actually see the changes on the site itself as theyre all in the page <head>

This builds on the existing functionality by making it work for the new URL format (?p=), not just the old /petitions/bots/ url format.

This requires a conditional database lookup if the request URL contains the p query parameter when loading the index page.

i was able to test to confirm this works on localhost using an opengraph browser extension. Discord doesn't seem to want to query for opengraph tags to localhost sites though so i cant 100% test it without hosting my dev version of pawprints on a public domain.

fixes #145

MoralCode commented 1 year ago

This also can allow for the removal of the old bots routes and special nginx rules (as mentioned in the wiki tab) in favor of a redirect from the old url formats (/petition/ID and /petition/bots/ID) to the new /?p=ID format, which should now serve both roles