microbin
microbin copied to clipboard
Add custom URL support
Support https://github.com/szabodanika/microbin/issues/83
What changed
- add MICROBIN_ENABLE_CUSTOM_URL argument, default: false
- replace
pasta.id == idto lambda functionalias_comparatorfor better code reuse. - add
custom_aliasfield in database
Why replace pasta.id == id
There are a large number of statements in the code that compare pasta.id == id, and implementing custom URL inevitably introduces additional fields, requiring a large number of duplicate judgments to be written at all positions. Therefore, I choose to extract the comparison logic into a lambda function to reduce duplicate code.
Todo
Custom URL validity check.