compserv / hknweb

The new HKN website (using Django, hopefully at hkn.eecs.berkeley.edu soon)
https://dev-hkn.eecs.berkeley.edu
MIT License
19 stars 108 forks source link

Shortlink url breakage #29

Open jameslzhu opened 5 years ago

jameslzhu commented 5 years ago

Currently, all shortlinks are naked, in the sense that these urls are resolved without additional prefixes:

https://hkn.eecs.berkeley.edu/<shortlink>
https://hkn.mu/<shortlink>

As currently implemented in hknweb, however, shortlinks are namespaced behind s/. In other words, all shortlink urls are only accessible at:

https://hkn.eecs.berkeley.edu/s/<shortlink>
https://hkn.mu/s/<shortlink>

This will break many existing urls to our website (decal, member signup, serv, studrel, etc.), even if namespacing is desirable. The fix should involve routing shortlinks in the root hknweb/urls.py, passing on all urls that match no other urls to the shortlinks app.

jameslzhu commented 5 years ago

Related conversation on the OCF issue tracker (https://leprosy.ocf.berkeley.edu/forum/t/ocf-io-shorturls/48).

The OCF suggests four necessary pieces for a good solution:

jameslzhu commented 5 years ago

So things you should do:

  1. Make the shortlinks accessible without the /s/ prefix. Make sure website paths take precedence over shortlink paths.
  2. Validate shortlinks are unique: this should be done in the shortlinks/models.py somehow. This is a combination of SlugField and the unique option.
  3. What's that leader field in Links? why?
  4. Can we change Links plural to Link singular?
jameslzhu commented 5 years ago

One more thing I'd like you guys to do is build some kind of edit interface for this (a form to create a new shortlink).