mirror of
https://github.com/makew0rld/amfora.git
synced 2024-12-04 14:46:29 -05:00
Merge branch 'master' into stream
This commit is contained in:
commit
386b585a41
@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
- Configurable keybindings for scrolling on pages (#211, #222)
|
||||
- Ability to save `about:` pages (#210, #236)
|
||||
- `bind_beginning` and `bind_end` keybindings
|
||||
- Display gemtext from stdin (#205, #242)
|
||||
|
||||
### Changed
|
||||
- Favicon support removed (#199)
|
||||
|
@ -46,7 +46,7 @@ Amfora is packaged in many Linux distros. It's also on [Scoop](https://scoop.sh/
|
||||
|
||||
### Homebrew
|
||||
|
||||
If you use [Homebrew](https://brew.sh/), you can install Amfora through the my personal tap.
|
||||
If you use [Homebrew](https://brew.sh/), you can install Amfora through my personal tap.
|
||||
```
|
||||
brew tap makeworld-the-better-one/tap
|
||||
brew install amfora
|
||||
|
@ -21,3 +21,4 @@ Thank you to the following contributors, who have helped make Amfora great. FOSS
|
||||
* Himanshu (@singalhimanshu)
|
||||
* @regr4
|
||||
* Anas Mohamed (@amohamed11)
|
||||
* David Jimenez (@dvejmz)
|
||||
|
21
amfora.go
21
amfora.go
@ -2,7 +2,9 @@ package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/makeworld-the-better-one/amfora/bookmarks"
|
||||
"github.com/makeworld-the-better-one/amfora/client"
|
||||
@ -68,6 +70,8 @@ func main() {
|
||||
display.NewTab()
|
||||
if len(os.Args[1:]) > 0 {
|
||||
display.URL(os.Args[1])
|
||||
} else if !isStdinEmpty() {
|
||||
renderFromStdin()
|
||||
}
|
||||
|
||||
// Start
|
||||
@ -75,3 +79,20 @@ func main() {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
func isStdinEmpty() bool {
|
||||
stat, _ := os.Stdin.Stat()
|
||||
return (stat.Mode() & os.ModeCharDevice) != 0
|
||||
}
|
||||
|
||||
func renderFromStdin() {
|
||||
stdinTextBuilder := new(strings.Builder)
|
||||
_, err := io.Copy(stdinTextBuilder, os.Stdin)
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "error reading from standard input: %v\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
stdinText := stdinTextBuilder.String()
|
||||
display.RenderFromString(stdinText)
|
||||
}
|
||||
|
@ -115,6 +115,18 @@ Contributed by **[@thumb](https://github.com/thumbfighter)**.
|
||||
![screenshot of add bookmark](https://user-images.githubusercontent.com/19327775/114432084-e8958200-9b85-11eb-9813-9982c3c0effa.png)
|
||||
</details>
|
||||
|
||||
## Iceberg Dark
|
||||
|
||||
Contributed by **[@knix3](https://github.com/knix3)**
|
||||
|
||||
![screenshot of Iceberg Dark theme](https://user-images.githubusercontent.com/69134168/118542790-7b938000-b721-11eb-81e1-ae45cdfbe546.png)
|
||||
<details>
|
||||
<summary>More screenshots</summary>
|
||||
|
||||
![screenshot of add bookmark](https://user-images.githubusercontent.com/69134168/118543243-07a5a780-b722-11eb-848a-95aa1de30044.png)
|
||||
![screenshot of error](https://user-images.githubusercontent.com/69134168/118543250-096f6b00-b722-11eb-9dca-d2b1bd6a8885.png)
|
||||
</details>
|
||||
|
||||
## Yours?
|
||||
|
||||
Contribute your own theme by opening a PR.
|
||||
|
112
contrib/themes/iceberg.toml
Normal file
112
contrib/themes/iceberg.toml
Normal file
@ -0,0 +1,112 @@
|
||||
[theme]
|
||||
# This section is for changing the COLORS used in Amfora.
|
||||
# These colors only apply if 'color' is enabled above.
|
||||
# Colors can be set using a W3C color name, or a hex value such as "#ffffff".
|
||||
|
||||
# Note that not all colors will work on terminals that do not have truecolor support.
|
||||
# If you want to stick to the standard 16 or 256 colors, you can get
|
||||
# a list of those here: https://jonasjacek.github.io/colors/
|
||||
# DO NOT use the names from that site, just the hex codes.
|
||||
|
||||
# Definitions:
|
||||
# bg = background
|
||||
# fg = foreground
|
||||
# dl = download
|
||||
# btn = button
|
||||
# hdg = heading
|
||||
# bkmk = bookmark
|
||||
# modal = a popup window/box in the middle of the screen
|
||||
|
||||
# EXAMPLES:
|
||||
# hdg_1 = "green"
|
||||
# hdg_2 = "#5f0000"
|
||||
|
||||
# Available keys to set:
|
||||
|
||||
# bg: background for pages, tab row, app in general
|
||||
# tab_num: The number/highlight of the tabs at the top
|
||||
# tab_divider: The color of the divider character between tab numbers: |
|
||||
# bottombar_label: The color of the prompt that appears when you press space
|
||||
# bottombar_text: The color of the text you type
|
||||
# bottombar_bg
|
||||
bg = "#161821"
|
||||
tab_num = "#6b7089"
|
||||
tab_divider = "#e2a478"
|
||||
bottombar_label = "#6b7089"
|
||||
bottombar_text = "#89b8c2"
|
||||
bottombar_bg = "#161821"
|
||||
|
||||
# hdg_1
|
||||
# hdg_2
|
||||
# hdg_3
|
||||
# amfora_link: A link that Amfora supports viewing. For now this is only gemini://
|
||||
# foreign_link: HTTP(S), Gopher, etc
|
||||
# link_number: The silver number that appears to the left of a link
|
||||
# regular_text: Normal gemini text, and plaintext documents
|
||||
# quote_text
|
||||
# preformatted_text
|
||||
# list_text
|
||||
hdg_1 = "#c0ca8e"
|
||||
hdg_2 = "#e98989"
|
||||
hdg_3 = "#c6c8d1"
|
||||
amfora_link = "#6b7089"
|
||||
foreign_link = "#d2d4de"
|
||||
kink_number = "#95c4ce"
|
||||
regular_text = "#c6c8d1"
|
||||
quote_text = "#e98989"
|
||||
preformatted_text = "#c6c8d1"
|
||||
list_text = "#84a0c6"
|
||||
|
||||
# btn_bg: The bg color for all modal buttons
|
||||
# btn_text: The text color for all modal buttons
|
||||
btn_bg = "#e27878"
|
||||
btn_text = "#d2d4de"
|
||||
|
||||
# dl_choice_modal_bg
|
||||
# dl_choice_modal_text
|
||||
# dl_modal_bg
|
||||
# dl_modal_text
|
||||
# info_modal_bg
|
||||
# info_modal_text
|
||||
# error_modal_bg
|
||||
# error_modal_text
|
||||
# yesno_modal_bg
|
||||
# yesno_modal_text
|
||||
# tofu_modal_bg
|
||||
# tofu_modal_text
|
||||
# subscription_modal_bg
|
||||
# subscription_modal_text
|
||||
dl_choice_modal_bg = "#84a0c6"
|
||||
dl_choice_modal_text = "#161821"
|
||||
dl_modal_bg = "#84a0c6"
|
||||
dl_modal_text = "#161821"
|
||||
info_modal_bg = "#84a0c6"
|
||||
info_modal_text = "#161821"
|
||||
error_modal_bg = "#e98989"
|
||||
error_modal_text = "#161821"
|
||||
yesno_modal_bg = "#84a0c6"
|
||||
yesno_modal_text = "#161821"
|
||||
tofu_modal_bg = "#84a0c6"
|
||||
tofu_modal_text = "#161821"
|
||||
subscription_modal_bg = "#84a0c6"
|
||||
subscription_modal_text = "#161821"
|
||||
|
||||
# input_modal_bg
|
||||
# input_modal_text
|
||||
# input_modal_field_bg: The bg of the input field, where you type the text
|
||||
# input_modal_field_text: The color of the text you type
|
||||
input_modal_bg = "#161821"
|
||||
input_modal_text = "#c6c8d1"
|
||||
input_modal_field_bg = "#d2d4de"
|
||||
input_modal_field_text = "#6b7089"
|
||||
|
||||
# bkmk_modal_bg
|
||||
# bkmk_modal_text
|
||||
# bkmk_modal_label
|
||||
# bkmk_modal_field_bg
|
||||
# bkmk_modal_field_text
|
||||
bkmk_modal_bg = "#161821"
|
||||
bkmk_modal_text = "#c6c8d1"
|
||||
bkmk_modal_label = "#c6c8d1"
|
||||
bkmk_modal_field_bg = "#d2d4de"
|
||||
bkmk_modal_field_text = "#6b7089"
|
@ -522,6 +522,25 @@ func URL(u string) {
|
||||
go t.goURL(fixUserURL(u))
|
||||
}
|
||||
|
||||
func RenderFromString(str string) {
|
||||
t := tabs[curTab]
|
||||
page, _ := renderPageFromString(str)
|
||||
setPage(t, page)
|
||||
}
|
||||
|
||||
func renderPageFromString(str string) (*structs.Page, bool) {
|
||||
rendered, links := renderer.RenderGemini(str, textWidth(), false)
|
||||
page := &structs.Page{
|
||||
Mediatype: structs.TextGemini,
|
||||
Raw: str,
|
||||
Content: rendered,
|
||||
Links: links,
|
||||
TermWidth: termW,
|
||||
}
|
||||
|
||||
return page, true
|
||||
}
|
||||
|
||||
func NumTabs() int {
|
||||
return len(tabs)
|
||||
}
|
||||
|
@ -25,4 +25,5 @@ Thank you to the following contributors, who have helped make Amfora great. FOSS
|
||||
* Himanshu (@singalhimanshu)
|
||||
* @regr4
|
||||
* Anas Mohamed (@amohamed11)
|
||||
* David Jimenez (@dvejmz)
|
||||
`)
|
||||
|
4
go.mod
4
go.mod
@ -3,11 +3,11 @@ module github.com/makeworld-the-better-one/amfora
|
||||
go 1.14
|
||||
|
||||
require (
|
||||
code.rocketnine.space/tslocum/cview v1.5.4
|
||||
code.rocketnine.space/tslocum/cview v1.5.6-0.20210525194531-92dca67ac283
|
||||
github.com/atotto/clipboard v0.1.4
|
||||
github.com/dustin/go-humanize v1.0.0
|
||||
github.com/fsnotify/fsnotify v1.4.9 // indirect
|
||||
github.com/gdamore/tcell/v2 v2.2.1-0.20210305060500-f4d402906fa3
|
||||
github.com/gdamore/tcell/v2 v2.3.3
|
||||
github.com/google/go-cmp v0.5.0 // indirect
|
||||
github.com/makeworld-the-better-one/go-gemini v0.11.0
|
||||
github.com/mitchellh/go-homedir v1.1.0
|
||||
|
20
go.sum
20
go.sum
@ -12,8 +12,8 @@ cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2k
|
||||
cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw=
|
||||
code.rocketnine.space/tslocum/cbind v0.1.5 h1:i6NkeLLNPNMS4NWNi3302Ay3zSU6MrqOT+yJskiodxE=
|
||||
code.rocketnine.space/tslocum/cbind v0.1.5/go.mod h1:LtfqJTzM7qhg88nAvNhx+VnTjZ0SXBJtxBObbfBWo/M=
|
||||
code.rocketnine.space/tslocum/cview v1.5.4 h1:zBUFAanViudrAw8ZCqNxaufqrYL6a7F1AkkIClXIzYo=
|
||||
code.rocketnine.space/tslocum/cview v1.5.4/go.mod h1:JjgoZi3b528SaV923oQq14PGUCTE/g/6iggnDUxsChE=
|
||||
code.rocketnine.space/tslocum/cview v1.5.6-0.20210525194531-92dca67ac283 h1:5KBGXdQdfV09eYXOZuFTxqDujndqtRraXj+lyFcxlPk=
|
||||
code.rocketnine.space/tslocum/cview v1.5.6-0.20210525194531-92dca67ac283/go.mod h1:KBRxzIsj8bfgFpnMpkGVoxsrPUvnQsRnX29XJ2yzB6M=
|
||||
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
|
||||
github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
|
||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||
@ -56,8 +56,8 @@ github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4
|
||||
github.com/gdamore/encoding v1.0.0 h1:+7OoQ1Bc6eTm5niUzBa0Ctsh6JbMW6Ra+YNuAtDBdko=
|
||||
github.com/gdamore/encoding v1.0.0/go.mod h1:alR0ol34c49FCSBLjhosxzcPHQbf2trDkoo5dl+VrEg=
|
||||
github.com/gdamore/tcell/v2 v2.2.0/go.mod h1:cTTuF84Dlj/RqmaCIV5p4w8uG1zWdk0SF6oBpwHp4fU=
|
||||
github.com/gdamore/tcell/v2 v2.2.1-0.20210305060500-f4d402906fa3 h1:PqyGpJlv98ynqEPq5MMiT+hcUPPvIomSS0Rnmy5Tl9A=
|
||||
github.com/gdamore/tcell/v2 v2.2.1-0.20210305060500-f4d402906fa3/go.mod h1:cTTuF84Dlj/RqmaCIV5p4w8uG1zWdk0SF6oBpwHp4fU=
|
||||
github.com/gdamore/tcell/v2 v2.3.3 h1:RKoI6OcqYrr/Do8yHZklecdGzDTJH9ACKdfECbRdw3M=
|
||||
github.com/gdamore/tcell/v2 v2.3.3/go.mod h1:cTTuF84Dlj/RqmaCIV5p4w8uG1zWdk0SF6oBpwHp4fU=
|
||||
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
|
||||
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
|
||||
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
|
||||
@ -144,8 +144,8 @@ github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaO
|
||||
github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
|
||||
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
|
||||
github.com/mattn/go-runewidth v0.0.10/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRCM46jaSJTDAk=
|
||||
github.com/mattn/go-runewidth v0.0.12 h1:Y41i/hVW3Pgwr8gV+J23B9YEY0zxjptBuCWEaxmAOow=
|
||||
github.com/mattn/go-runewidth v0.0.12/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRCM46jaSJTDAk=
|
||||
github.com/mattn/go-runewidth v0.0.13 h1:lTGmDsbAYt5DmK6OnoV7EuIF1wEIFAcxld6ypU4OSgU=
|
||||
github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
|
||||
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
|
||||
github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg=
|
||||
github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc=
|
||||
@ -313,14 +313,14 @@ golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7w
|
||||
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210223095934-7937bea0104d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210309040221-94ec62e08169/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210331175145-43e1dd70ce54 h1:rF3Ohx8DRyl8h2zw9qojyLHLhrJpEMgyPOImREEryf0=
|
||||
golang.org/x/sys v0.0.0-20210331175145-43e1dd70ce54/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210525143221-35b2ab0089ea h1:+WiDlPBBaO+h9vPNZi8uJ3k4BkKQB7Iow3aqwHVA5hI=
|
||||
golang.org/x/sys v0.0.0-20210525143221-35b2ab0089ea/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/term v0.0.0-20201210144234-2321bbc49cbf/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/term v0.0.0-20210317153231-de623e64d2a6 h1:EC6+IGYTjPpRfv9a2b/6Puw0W+hLtAhkV1tPsXhutqs=
|
||||
golang.org/x/term v0.0.0-20210317153231-de623e64d2a6/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/term v0.0.0-20210503060354-a79de5458b56 h1:b8jxX3zqjpqb2LklXPzKSGJhzyxCOZSz8ncv8Nv+y7w=
|
||||
golang.org/x/term v0.0.0-20210503060354-a79de5458b56/go.mod h1:tfny5GFUkzUvx4ps4ajbZsCe5lw1metzhBm9T3x7oIY=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
||||
|
Loading…
Reference in New Issue
Block a user