Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redirect after Titan request, generate directories #5

Merged
merged 8 commits into from
May 26, 2022

Conversation

stellarskylark
Copy link
Contributor

Hi again!

I realized that the code I submitted last time couldn't generate directories if someone wanted to write to, say, example.com/posts/test.gmi but the posts/ directory didn't exist yet. I've added code to fix that!

I also added a config flag that causes GemiNim to redirect the client to the uploaded resource after a successful Titan request.

I'd also like to write some code to allow configuration of user-specific titanPasswords, that'll be in another PR later!

src/config.nim Outdated Show resolved Hide resolved
src/geminim.nim Outdated Show resolved Hide resolved
src/geminim.nim Outdated Show resolved Hide resolved
src/geminim.nim Outdated
@@ -139,8 +139,17 @@ proc processTitanRequest(server: Server, req: Request): Future[Response] {.async
return response(StatusNotAuthorised, "Token not recognized")

var filePath = req.res.filePath
if dirExists(filePath):
filePath = filePath / "index.gmi" # assume we want to write index.gmi
let (parent, _ )= filePath.splitPath
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

) =

src/config.nim Outdated Show resolved Hide resolved
@ardek66
Copy link
Owner

ardek66 commented May 25, 2022

I'd also like to write some code to allow configuration of user-specific titanPasswords, that'll be in another PR later!

I was thinking of (finally) merging the client-side certificate authentification support the following days. This would allow for Titan password(s) to be replaced with certificate authentification, which would be safer and more flexible(i.e for a wiki you could allow clients with trusted certificates to edit certain pages).

@stellarskylark
Copy link
Contributor Author

I was thinking of (finally) merging the client-side certificate authentification support the following days. This would allow for Titan password(s) to be replaced with certificate authentification, which would be safer and more flexible(i.e for a wiki you could allow clients with trusted certificates to edit certain pages).

That sounds like a really good idea, yeah! I'll wait for you to do that then before I muck around with the passwords any more.

@stellarskylark stellarskylark requested a review from ardek66 May 25, 2022 21:28
src/config.nim Show resolved Hide resolved
src/geminim.nim Outdated Show resolved Hide resolved
src/geminim.nim Outdated Show resolved Hide resolved
@stellarskylark stellarskylark requested a review from ardek66 May 26, 2022 18:14
Copy link
Owner

@ardek66 ardek66 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You pushed the compiled binary by mistake

@stellarskylark
Copy link
Contributor Author

You pushed the compiled binary by mistake

whoops fixed

@ardek66 ardek66 merged commit 0d67c81 into ardek66:master May 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants