Make paths absolute and append file:// before publishing
This commit is contained in:
parent
5834d8ecf4
commit
692c455f18
|
@ -7,5 +7,4 @@ There are two utilites, `xdg-open` and `uri_runner`. The former connects to a sh
|
||||||
The [protocol.nim](./src/protocol.nim) file is generated from the [protocol.prs](./protocol.prs) schema, a [Tupfile](https://gittup.org/tup/) file is provided to do this.
|
The [protocol.nim](./src/protocol.nim) file is generated from the [protocol.prs](./protocol.prs) schema, a [Tupfile](https://gittup.org/tup/) file is provided to do this.
|
||||||
|
|
||||||
## TODO
|
## TODO
|
||||||
- Pattern back-references in commands
|
|
||||||
- Fallback commands?
|
- Fallback commands?
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
# SPDX-License-Identifier: Unlicense
|
# SPDX-License-Identifier: Unlicense
|
||||||
|
|
||||||
import std/[asyncdispatch, os]
|
import std/[asyncdispatch, os]
|
||||||
import preserves
|
from std/sequtils import map
|
||||||
import syndicate, syndicate/capabilities
|
import syndicate, syndicate/capabilities
|
||||||
import ./protocol
|
import ./protocol
|
||||||
|
|
||||||
|
@ -17,7 +17,12 @@ proc mintCap: SturdyRef =
|
||||||
|
|
||||||
bootDataspace("main") do (root: Ref; turn: var Turn):
|
bootDataspace("main") do (root: Ref; turn: var Turn):
|
||||||
connectUnix(turn, unixSocketPath(), mintCap()) do (turn: var Turn; ds: Ref):
|
connectUnix(turn, unixSocketPath(), mintCap()) do (turn: var Turn; ds: Ref):
|
||||||
message(turn, ds, XdgOpen(uris: commandLineParams()))
|
var uris = commandLineParams().map do (param: string) -> string:
|
||||||
|
if fileExists param:
|
||||||
|
"file://" & absolutePath(param)
|
||||||
|
else:
|
||||||
|
param
|
||||||
|
message(turn, ds, XdgOpen(uris: uris))
|
||||||
|
|
||||||
for i in 0..7: poll(20)
|
for i in 0..7: poll(20)
|
||||||
# A hack to exit
|
# A hack to exit
|
||||||
|
|
|
@ -25,5 +25,8 @@ let ?root_ds = dataspace
|
||||||
|
|
||||||
<action-handler "gemini://.*|file:///.*.gmi" ["/run/current-system/sw/bin/kristall" 0]>
|
<action-handler "gemini://.*|file:///.*.gmi" ["/run/current-system/sw/bin/kristall" 0]>
|
||||||
<action-handler ".*\\.avi|.*\\.mkv|.*\\.mp4|.*\\.ogg|.*\\.opus", ["/run/current-system/sw/bin/mpv" 0]>
|
<action-handler ".*\\.avi|.*\\.mkv|.*\\.mp4|.*\\.ogg|.*\\.opus", ["/run/current-system/sw/bin/mpv" 0]>
|
||||||
|
|
||||||
|
; filesystem paths are always prefixed with file://
|
||||||
|
<action-handler "file://(.*.pdf)" ["/run/current-system/sw/bin/mupdf" 1]>
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Package
|
# Package
|
||||||
|
|
||||||
version = "0.3.1"
|
version = "0.3.2"
|
||||||
author = "Emery"
|
author = "Emery"
|
||||||
description = "A better xdg-open"
|
description = "A better xdg-open"
|
||||||
license = "Unlicense"
|
license = "Unlicense"
|
||||||
|
|
Loading…
Reference in New Issue