Compare commits

...

4 Commits

Author SHA1 Message Date
Dirk Nederveen c98dc674d5
Update dockerfiles 2023-02-04 20:11:32 +01:00
Dirk Nederveen de7b46a85d
Add docker files
Build: docker build
2023-02-04 20:11:31 +01:00
Ted Unangst 50524cade2 just be explicit about match checking 2023-02-03 22:48:19 -05:00
Ted Unangst 91db81b44d more flexible regex for quick mentions, reported by dirk 2023-02-03 22:37:19 -05:00
4 changed files with 42 additions and 2 deletions

4
.dockerignore Normal file
View File

@ -0,0 +1,4 @@
honk.db*
blob.db*
./honk
.git*

20
Dockerfile Normal file
View File

@ -0,0 +1,20 @@
FROM golang:1.19
RUN apt update && apt install -y libsqlite3-dev && rm -rf /var/cache/apt/*
RUN mkdir /honk-src
WORKDIR /honk-src
COPY go.mod go.sum /honk-src/
COPY . /honk-src/
RUN go get && go mod vendor
RUN make
RUN mv ./honk /bin/honk
CMD ["/bin/honk", "-datadir", "/honk-data"]
COPY docker-entrypoint.sh /honk-src/docker-entrypoint.sh
ENTRYPOINT ["/honk-src/docker-entrypoint.sh"]

15
docker-entrypoint.sh Executable file
View File

@ -0,0 +1,15 @@
#!/bin/sh
if [ ! -r "/honk-data/honk.db" ]; then
set -u
(
echo "$HONK_USERNAME"
echo "$HONK_PASSWORD"
echo "${HONK_LISTEN_ADDR:-"0.0.0.0:8080"}"
echo "${HONK_SERVER_HOSTNAME}"
) | honk -datadir "/honk-data" init
set +u
fi
exec $*

5
fun.go
View File

@ -457,7 +457,7 @@ func memetize(honk *Honk) {
honk.Noise = re_memes.ReplaceAllStringFunc(honk.Noise, repl)
}
var re_quickmention = regexp.MustCompile("(^|[ \n])@[[:alnum:]]+([ \n.]|$)")
var re_quickmention = regexp.MustCompile("(^|[ \n])@[[:alnum:]]+([ \n.,']|$)")
func quickrename(s string, userid int64) string {
nonstop := true
@ -472,7 +472,8 @@ func quickrename(s string, userid int64) string {
prefix += "@"
m = m[1:]
tail := ""
if last := m[len(m)-1]; last == ' ' || last == '\n' || last == '.' {
if last := m[len(m)-1]; last == ' ' || last == '\n' ||
last == '.' || last == ',' || last == '\'' {
tail = m[len(m)-1:]
m = m[:len(m)-1]
}