Skip to content

Commit

Permalink
Elaborate roadmap, tidy up
Browse files Browse the repository at this point in the history
  • Loading branch information
sergetymo committed Jan 29, 2021
1 parent 7c1609b commit 055ed4b
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 14 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Kaksik
Middleware application microframework for [Gemini](https://gemini.circumlunar.space) protocol
Middleware library for creating applications for [Gemini](https://gemini.circumlunar.space) protocol
on top of [Deno](https://deno.land) runtime, written in TypeScript.

Heavily inspired by [oak](https://github.com/oakserver/oak) and [denoscuri](https://github.com/caranatar/denoscuri).
Expand All @@ -10,6 +10,10 @@ Heavily inspired by [oak](https://github.com/oakserver/oak) and [denoscuri](http
- [x] Serve programmable resources at configured URLs (via middleware, see [handleRoutes](#handleroutes))
- [x] Serve redirect responses at configured URLs (via middleware, see [handleRedirects](#handleredirects))
- [ ] Serve gone responses at configured URLs (via middleware)
- [ ] Improve `Response` class
- [ ] Document `Gemtext` usage
- [ ] -- 'Good enough' point --
- [ ] *Propose yours by [filing an issue](https://github.com/sergetymo/kaksik/issues/new)*

## Usage
### Prerequisites
Expand Down
3 changes: 0 additions & 3 deletions classes/Application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ export class Application<S extends State> {
}
}

// TODO: public stop?

public use <AS extends State = S> (
...middleware: Array<Middleware<AS, Context<AS>>>
): Application<AS extends S ? AS : (AS & S)> {
Expand All @@ -68,7 +66,6 @@ export class Application<S extends State> {
try {
await this.compose()(ctx)
} catch (error) {
// TODO: catch redirects, goners and failures
ctx.response = new ResponseFailure()
}
await connection.write(ctx.response.contents)
Expand Down
11 changes: 4 additions & 7 deletions classes/LineLink.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
import { Line } from './Line.ts'

export class LineLink extends Line {
private readonly link: string
private readonly description?: string

constructor (link: string, description?: string) {
constructor (
private readonly link: string,
private readonly description?: string,
) {
super()
// TODO: validate link?
this.link = link
this.description = description
}

protected get contents (): string {
Expand Down
4 changes: 1 addition & 3 deletions classes/LineText.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import { Line } from './Line.ts'

export class LineText extends Line {
private readonly text: string

constructor (text: string = '') {
constructor (private readonly text: string = '') {
super()
// TODO: replace CRLFs with spaces?
this.text = text
Expand Down

0 comments on commit 055ed4b

Please sign in to comment.