Comment by ~panda-roux on ~panda-roux/MoonGem
After starting to implement this feature, I came to the realization that, since MoonGem doesn't have a concept of virtual directories (i.e. it can only process URLs that refer to physical files or directories with 'index.gmi' files in them), this isn't going to be feasible to implement.
As much as I would like to emulate the functionality that ASP.NET offers here, there just isn't a simple way for developers to indicate to the server that URLs with arbitrary dynamic data should correspond to specific files on-disk. ASP.NET uses attributes (compile-time metadata markers) to accomplish this, and implementing something like that would be far outside the scope of MoonGem.
Feature added by ~panda-roux on ~panda-roux/MoonGem
Ticket created by ~panda-roux on ~panda-roux/MoonGem
A means of parsing arguments from a URL into named fields in a Lua table object would be incredibly useful. I think that ASP.NET does a good job of this with its parameter routing feature, so I'm basing this functionality on that.
Example usage:
Assuming a path
/dir/start/3
:local params = PATH:params('/dir/{document}/{id}') assert(params.document == 'start') assert(params.id == 3)Considerations:
- Would it make sense to implement this as a member of the "PATH" object? If so, we'd have to switch PATH from a simple global string to a table with a
__tostring
metatable method (which isn't a big deal, just need to note that).
Comment by ~panda-roux on ~panda-roux/MoonGem
I agree that hiding .dotfiles in directories is a good idea, both in terms of safety and as a means of configuration.
Disabling directory listing by default makes sense. I think a file name like "directory-listing-ok" is a bit wordy though. I'm likely to forget it. I would like that either to be configurable, or something shorter, like ".list".
Comment by ~panda-roux on ~panda-roux/MoonGem
The following methods were added to the Lua API:
HEAD:has_cert()
- checks for a cert and returns a boolean indicating the presence of one
HEAD:get_cert([prompt])
- if a cert exists, returns a table with the cert's expiration time and fingerprint; otherwise, sends a code-60 status to the client along with the provided optional prompt in order to request that such a cert be sent with the next request
Comment by ~panda-roux on ~panda-roux/MoonGem
Added in c6e9420297bf861ff09552d6a2d8ca29374101b3
REPORTED
RESOLVED IMPLEMENTEDComment by ~panda-roux on ~panda-roux/MoonGem
Implemented by 8bccc062a0e6f8904583249284f8faba4ed35eff
REPORTED
RESOLVED IMPLEMENTEDComment by ~panda-roux on ~panda-roux/MoonGem
Implemented in a120aea988c627b2d78e35b5d7d79a69d14c3a70
REPORTED
RESOLVED IMPLEMENTEDComment by ~panda-roux on ~panda-roux/MoonGem
Environment variable checked is MOONGEM_PORT