Add v1 shortener: Bearer API, public 302, landing, and CI.
CI / test (pull_request) Successful in 6s
CI / test (pull_request) Successful in 6s
Standalone Django service so callers can mint links and phones get a 302. Closes #1.
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
from django import forms
|
||||
|
||||
from links.services import ValidationError, validate_target_url
|
||||
|
||||
|
||||
class DebugCreateForm(forms.Form):
|
||||
target_url = forms.URLField(
|
||||
label="Target URL",
|
||||
widget=forms.URLInput(
|
||||
attrs={"placeholder": "https://mkdrealtor.com/listings/oak-st", "autofocus": True}
|
||||
),
|
||||
)
|
||||
title = forms.CharField(label="Title", required=False, max_length=200)
|
||||
external_ref = forms.CharField(label="External ref", required=False, max_length=64)
|
||||
|
||||
def clean_target_url(self) -> str:
|
||||
raw = self.cleaned_data["target_url"]
|
||||
try:
|
||||
return validate_target_url(raw)
|
||||
except ValidationError as exc:
|
||||
raise forms.ValidationError(str(exc)) from exc
|
||||
Reference in New Issue
Block a user