Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
dump.rdb

dump2.rdb
dist/
yarn.lock
npm-debug.log
Expand Down Expand Up @@ -78,3 +78,5 @@ test.sh
dump.rdb
.archiver_shadow/
.snapshots/

.env
32 changes: 32 additions & 0 deletions Dockerfile.railway
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
FROM mcr.microsoft.com/devcontainers/javascript-node:1-22-bookworm
COPY . /app
WORKDIR /app

ARG NODEBB_PORT
ARG NODEBB_DB
ARG REDIS_URL
ARG NODEBB_ADMIN_USERNAME
ARG NODEBB_ADMIN_PASSWORD
ARG NODEBB_ADMIN_EMAIL
ARG NODEBB_URL
ARG NODE_ENV
SHELL ["/bin/bash", "-c"]

RUN rm -f ./dump.rdb
RUN apt-get update \
&& apt-get install -y \
iputils-ping \
redis-server \
&& rm -rf /var/lib/apt/lists/*

RUN set -eu; \
. ./parse-redis-url.sh \
&& curl https://qlty.sh | /bin/bash \
&& mv ~/.qlty/bin/qlty /usr/local/bin/qlty \
&& rm -rf ~/.qlty \
&& qlty --version \
&& ./nodebb setup

EXPOSE 4567
RUN npm i
CMD ["/bin/sh","./railway-start.sh"]
17 changes: 17 additions & 0 deletions config2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"url": "http://127.0.0.1:4567",
"secret": "e132a0f9-93e4-4750-91cc-7f82bcd0a4d3",
"database": "redis",
"port": "4567",
"redis": {
"host": "127.0.0.1",
"port": 6379,
"password": "",
"database": 0
},
"test_database": {
"host": "127.0.0.1",
"database": 1,
"port": 6379
}
}
43 changes: 43 additions & 0 deletions parse-redis-url.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/usr/bin/env sh
set -eu

uri="${REDIS_URL:-}"

# Drop scheme
rest="${uri#redis://}"

# Defaults
REDIS_USERNAME=""
REDIS_PASSWORD=""

# Split creds vs host:port
if [ "${rest#*@}" != "$rest" ]; then
creds="${rest%@*}" # user:password (or just user)
hostport="${rest#*@}" # host:port[/...]
if [ "${creds#*:}" != "$creds" ]; then
REDIS_USERNAME="${creds%%:*}"
REDIS_PASSWORD="${creds#*:}"
else
REDIS_USERNAME="$creds"
REDIS_PASSWORD=""
fi
else
hostport="$rest"
fi

# Strip any /db suffix
hostport="${hostport%%/*}"

REDIS_HOST="${hostport%%:*}"
REDIS_PORT="${hostport##*:}"

# Export generic vars
# export REDIS_HOST REDIS_PORT REDIS_USERNAME REDIS_PASSWORD

# Export NodeBB vars
export NODEBB_DB_HOST="$REDIS_HOST"
export NODEBB_DB_PORT="$REDIS_PORT"
export NODEBB_DB_USER="$REDIS_USERNAME"
export NODEBB_DB_PASSWORD="$REDIS_PASSWORD"

exec "$@"
59 changes: 48 additions & 11 deletions public/openapi/components/schemas/PostObject.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,19 @@ PostObject:
description: A single post in the array returned from `Posts.getPostSummaryByPids`
type: object
properties:
endorsedVotes:
type: array
items:
type: object
properties:
username:
type: string
uid:
type: number
displayname:
type: string
isLocal:
type: boolean
pid:
type: number
tid:
Expand Down Expand Up @@ -54,7 +67,8 @@ PostObject:
description: This is either username or fullname depending on forum and user settings
userslug:
type: string
description: An URL-safe variant of the username (i.e. lower-cased, spaces
description:
An URL-safe variant of the username (i.e. lower-cased, spaces
removed, etc.)
picture:
type: string
Expand All @@ -63,12 +77,14 @@ PostObject:
type: string
icon:text:
type: string
description: A single-letter representation of a username. This is used in the
description:
A single-letter representation of a username. This is used in the
auto-generated icon given to users without
an avatar
icon:bgColor:
type: string
description: A six-character hexadecimal colour code assigned to the user. This
description:
A six-character hexadecimal colour code assigned to the user. This
value is used in conjunction with
`icon:text` for the user's auto-generated
icon
Expand Down Expand Up @@ -102,7 +118,8 @@ PostObject:
type: number
mainPid:
type: number
description: The post id of the first post in this topic (also called the
description:
The post id of the first post in this topic (also called the
"original post")
teaserPid:
type: number
Expand Down Expand Up @@ -140,7 +157,8 @@ PostObject:
type: string
parentCid:
type: number
description: The category identifier for the category that is the immediate
description:
The category identifier for the category that is the immediate
ancestor of the current category
bgColor:
type: string
Expand All @@ -160,6 +178,19 @@ PostDataObject:
allOf:
- type: object
properties:
endorsedVotes:
type: array
items:
type: object
properties:
username:
type: string
uid:
type: number
displayname:
type: string
isLocal:
type: boolean
pid:
type: number
uid:
Expand Down Expand Up @@ -212,7 +243,8 @@ PostDataObject:
description: This is either username or fullname depending on forum and user settings
userslug:
type: string
description: An URL-safe variant of the username (i.e. lower-cased, spaces
description:
An URL-safe variant of the username (i.e. lower-cased, spaces
removed, etc.)
reputation:
type: number
Expand Down Expand Up @@ -249,12 +281,14 @@ PostDataObject:
nullable: true
icon:text:
type: string
description: A single-letter representation of a username. This is used in the
description:
A single-letter representation of a username. This is used in the
auto-generated icon given to users without
an avatar
icon:bgColor:
type: string
description: A six-character hexadecimal colour code assigned to the user. This
description:
A six-character hexadecimal colour code assigned to the user. This
value is used in conjunction with
`icon:text` for the user's auto-generated
icon
Expand Down Expand Up @@ -317,7 +351,8 @@ PostDataObject:
description: A friendly name for a given user account
userslug:
type: string
description: An URL-safe variant of the username (i.e. lower-cased, spaces
description:
An URL-safe variant of the username (i.e. lower-cased, spaces
removed, etc.)
picture:
type: string
Expand All @@ -326,12 +361,14 @@ PostDataObject:
description: A user identifier
icon:text:
type: string
description: A single-letter representation of a username. This is used in the
description:
A single-letter representation of a username. This is used in the
auto-generated icon given to users without
an avatar
icon:bgColor:
type: string
description: A six-character hexadecimal colour code assigned to the user. This
description:
A six-character hexadecimal colour code assigned to the user. This
value is used in conjunction with
`icon:text` for the user's auto-generated
icon
Expand Down
38 changes: 29 additions & 9 deletions public/openapi/components/schemas/TopicObject.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
TopicObject:
allOf:
- $ref: '#/TopicObjectSlim'
- $ref: "#/TopicObjectSlim"
- type: object
properties:
lastposttime:
Expand Down Expand Up @@ -48,7 +48,8 @@ TopicObject:
type: string
userslug:
type: string
description: An URL-safe variant of the username (i.e. lower-cased, spaces
description:
An URL-safe variant of the username (i.e. lower-cased, spaces
removed, etc.)
reputation:
type: number
Expand All @@ -66,12 +67,14 @@ TopicObject:
type: string
icon:text:
type: string
description: A single-letter representation of a username. This is used in the
description:
A single-letter representation of a username. This is used in the
auto-generated icon given to users without
an avatar
icon:bgColor:
type: string
description: A six-character hexadecimal colour code assigned to the user. This
description:
A six-character hexadecimal colour code assigned to the user. This
value is used in conjunction with
`icon:text` for the user's auto-generated
icon
Expand Down Expand Up @@ -109,6 +112,19 @@ TopicObject:
sourceContent:
type: string
nullable: true
endorsedVotes:
type: array
items:
type: object
properties:
username:
type: string
uid:
type: number
displayname:
type: string
isLocal:
type: boolean
timestampISO:
type: string
description: An ISO 8601 formatted date string (complementing `timestamp`)
Expand All @@ -127,19 +143,22 @@ TopicObject:
type: boolean
userslug:
type: string
description: An URL-safe variant of the username (i.e. lower-cased, spaces
description:
An URL-safe variant of the username (i.e. lower-cased, spaces
removed, etc.)
picture:
nullable: true
type: string
icon:text:
type: string
description: A single-letter representation of a username. This is used in the
description:
A single-letter representation of a username. This is used in the
auto-generated icon given to users
without an avatar
icon:bgColor:
type: string
description: A six-character hexadecimal colour code assigned to the user. This
description:
A six-character hexadecimal colour code assigned to the user. This
value is used in conjunction with
`icon:text` for the user's
auto-generated icon
Expand Down Expand Up @@ -239,7 +258,8 @@ TopicObjectSlim:
type: number
pinned:
type: number
description: Whether or not this particular topic is pinned to the top of the
description:
Whether or not this particular topic is pinned to the top of the
category
timestamp:
type: number
Expand Down Expand Up @@ -295,4 +315,4 @@ TopicObjectSlim:
type: number
description: The number of thumbnails associated with this topic
required:
- tid
- tid
Loading