This PR add a token generator that accepts a path and returns a hash. In addition, the OnlineBase model has a new function get_preview_url that appends ?preview=PATH_HASH if the model is offline. Finally, the PublicationMiddleware now has two different conditions for allowing a user to view an offline page.
The same as the old check, except it just checks if the GET parameter preview exists
The value of the GET parameter preview is equal to the hash of the requested path.
This means elsewhere (OSM Jet), we can add links to object.get_preview_url to have shareable links to offline pages that can be viewed by people not logged in.
This PR add a token generator that accepts a
path
and returns a hash. In addition, theOnlineBase
model has a new functionget_preview_url
that appends?preview=PATH_HASH
if the model is offline. Finally, thePublicationMiddleware
now has two different conditions for allowing a user to view an offline page.preview
existspreview
is equal to the hash of the requestedpath
.This means elsewhere (OSM Jet), we can add links to
object.get_preview_url
to have shareable links to offline pages that can be viewed by people not logged in.