A small non-functional browser
I've been coding a small 'browser' from scratch these days.
The idea was to keep dependencies at minimum. So, I would use raw sockets to do everything and use raylib to render it.
In the end I gave up understanding how open_ssl cryptography worked from specification and ended up just calling openssl and including it as dependency.
it can handle http:// https:// (both on text mode) and did I say it can also display gemini capsules if given a gemini:// url?
/u/LucasMW/image/465.jpeg
Note: design not final
Did you like it?
Render gemini is beautiful:
render_gemini_response :: proc(gemtext : string) {
lines := strings.split(gemtext,"\n")
line_number : i32 = 0
draw_height : i32 = 50
for line in lines {
if len(line) < 3 {
continue
}
first_char := line[0]
switch first_char {
case '#':
heading := 1
if line[1] == '#' {
heading += 1
if line[2] == '#' {
heading += 1
}
}
fsize :i32 = i32(10 + 10 / heading)
rl.DrawText(rl.TextFormat("%d",line_number),10,draw_height + i32(camera_position),fsize,rl.GRAY)
rl.DrawText(rl.TextFormat("%s",line[heading:]),50,draw_height + i32(camera_position),fsize,rl.BLACK/9*8)
draw_height += fsize + 1
break
case '=':
if line[1] == '>' {
//fmt.println("link ")
rl.DrawText(rl.TextFormat("%d",line_number),10,draw_height + i32(camera_position),12,rl.GRAY)
rl.DrawText(rl.TextFormat("%s",line[:]),50,draw_height + i32(camera_position),12,rl.DARKBLUE)
draw_height += 12 + 1
}
break
case '>':
rl.DrawText(rl.TextFormat("%d",line_number),10,draw_height + i32(camera_position),15,rl.GRAY)
rl.DrawText(rl.TextFormat("\""),45,draw_height + i32(camera_position),20,rl.GOLD)
rl.DrawText(rl.TextFormat("%s",line[1:]),50+3,draw_height + i32(camera_position),12,rl.LIME)
draw_height += 15 + 1
//fmt.println("quote ")
break
case '*':
rl.DrawText(rl.TextFormat("%d",line_number),10,draw_height + i32(camera_position),12,rl.GRAY)
rl.DrawText(rl.TextFormat(". %s",line[1:]),50,draw_height + i32(camera_position),12,rl.BLACK)
draw_height += 12 + 1
//fmt.println("quote ")
break
case:
fsize :: 15
rl.DrawText(rl.TextFormat("%d",line_number),10,draw_height + i32(camera_position),fsize,rl.GRAY)
rl.DrawTextEx(font,rl.TextFormat("%s",line[:]),rl.Vector2(rl.Vector2{50,f32(draw_height) + f32(camera_position)}),fsize,0,rl.BLACK)
draw_height += fsize + 1
break
}
line_number += 1
}
}
Poll Results
1. yes
โโโโโโโโโโโโโโโโโโโโโโโโ 88%
2. no
โโโโโโโโโโโโโโโโโโโโโโโโ 12%
26 votes were cast.
#gemini ๐ณ๏ธ #programming #software #web
๐ LucasMW
2025-06-02 ยท 11 months ago ยท ๐ norayr, akkartik, DocEdelgas, ps, 0x, Not4uffinonMobile, the_mantelman ยท ๐ฅ 1
๐ง the_mantelman ยท 2025-06-03 at 16:58:
So, where can I find the source code?
๐ LucasMW [OP] ยท 2025-06-03 at 19:50:
I haven't publish it anywhere except snippets. It still buggy and unfinished. I don't know if I want to opensource it either.
๐ LucasMW [OP] ยท 2025-06-04 at 20:53:
Added some code which renders gemtext as an example.
We don't handle emojis an other special chars yet.