Skip to content

Commit 3f07649

Browse files
committed
1.0.1
0 parents  commit 3f07649

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+7055
-0
lines changed

.dockerignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/app/node_modules/
2+
/app/dist/
3+
/app/.env

.env.example

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
BASE_WEB_URL=
2+
CLOUDFLARE_TURNSTILE_KEY=
3+
CLOUDFLARE_TURNSTILE_SECRET=
4+
CLOUDFLARE_ZONE_ID=
5+
CLOUDFLARE_API_KEY=
6+
HASH_SALT=
7+
FOLDER_PREFIX=0
8+
MAXIMUM_UPLOAD_SIZE_MB=5

.github/workflows/ci.yaml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Create and publish a Docker image
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
tags:
7+
- 'v*'
8+
9+
env:
10+
IMAGE_NAME: ${{ github.repository }}
11+
12+
jobs:
13+
build-and-push-image:
14+
runs-on: ubuntu-latest
15+
permissions:
16+
contents: read
17+
packages: write
18+
19+
steps:
20+
- name: Checkout repository
21+
uses: actions/checkout@v4
22+
23+
- name: Get version from package.json
24+
run: echo "PACKAGE_VERSION=$(jq -r '.version' app/package.json)" >> $GITHUB_ENV
25+
26+
- name: Log in to GitHub Container Registry
27+
uses: docker/login-action@v3
28+
with:
29+
registry: ghcr.io
30+
username: ${{ github.actor }}
31+
password: ${{ secrets.GITHUB_TOKEN }}
32+
33+
- name: Set up QEMU
34+
uses: docker/[email protected]
35+
36+
- name: Set up Docker Buildx
37+
uses: docker/setup-buildx-action@v3
38+
39+
- name: Build and push Docker image
40+
uses: docker/build-push-action@v5
41+
with:
42+
context: .
43+
file: Dockerfile
44+
push: true
45+
platforms: linux/amd64,linux/arm64,linux/arm/v7
46+
build-args: |
47+
PACKAGE_VERSION=${{ env.PACKAGE_VERSION }}
48+
tags: |
49+
ghcr.io/${{ github.repository }}:${{ env.PACKAGE_VERSION }}
50+
ghcr.io/${{ github.repository }}:latest

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
node_modules
2+
.env
3+
.idea
4+
database.db*
5+
/userfiles/css/*
6+
/userfiles/files/*
7+
/userfiles/notes/*
8+
/app/dist/*
9+
!.gitkeep

Dockerfile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
FROM node:lts-alpine
2+
3+
COPY app /notesx/app
4+
COPY db /notesx/db
5+
COPY userfiles /notesx/userfiles
6+
7+
WORKDIR /notesx/app
8+
9+
RUN npm install --omit=dev
10+
11+
ARG PACKAGE_VERSION
12+
ENV APP_VERSION=${PACKAGE_VERSION}
13+
ENV NODE_ENV=production
14+
15+
# Build without type checking, as we have removed the Typescript
16+
# dev-dependencies above to save space in the final build.
17+
# Type checking is done in the repo before building the image.
18+
RUN npx tsc --noCheck
19+
20+
CMD ["node", "dist/index.js" ]

LICENSE

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
# PolyForm Perimeter License 1.0.0
2+
3+
<https://polyformproject.org/licenses/perimeter/1.0.0>
4+
5+
## Acceptance
6+
7+
In order to get any license under these terms, you must agree
8+
to them as both strict obligations and conditions to all
9+
your licenses.
10+
11+
## Copyright License
12+
13+
The licensor grants you a copyright license for the
14+
software to do everything you might do with the software
15+
that would otherwise infringe the licensor's copyright
16+
in it for any permitted purpose. However, you may
17+
only distribute the software according to [Distribution
18+
License](#distribution-license) and make changes or new works
19+
based on the software according to [Changes and New Works
20+
License](#changes-and-new-works-license).
21+
22+
## Distribution License
23+
24+
The licensor grants you an additional copyright license
25+
to distribute copies of the software. Your license
26+
to distribute covers distributing the software with
27+
changes and new works permitted by [Changes and New Works
28+
License](#changes-and-new-works-license).
29+
30+
## Notices
31+
32+
You must ensure that anyone who gets a copy of any part of
33+
the software from you also gets a copy of these terms or the
34+
URL for them above, as well as copies of any plain-text lines
35+
beginning with `Required Notice:` that the licensor provided
36+
with the software. For example:
37+
38+
> Required Notice: Copyright Yoyodyne, Inc. (http://example.com)
39+
40+
## Changes and New Works License
41+
42+
The licensor grants you an additional copyright license to
43+
make changes and new works based on the software for any
44+
permitted purpose.
45+
46+
## Patent License
47+
48+
The licensor grants you a patent license for the software that
49+
covers patent claims the licensor can license, or becomes able
50+
to license, that you would infringe by using the software.
51+
52+
## Noncompete
53+
54+
Any purpose is a permitted purpose, except for providing to
55+
others any product that competes with the software.
56+
57+
## Competition
58+
59+
If you use this software to market a product as a substitute
60+
for the functionality or value of the software, it competes
61+
with the software. A product may compete regardless how it is
62+
designed or deployed. For example, a product may compete even
63+
if it provides its functionality via any kind of interface
64+
(including services, libraries or plug-ins), even if it is
65+
ported to a different platforms or programming languages,
66+
and even if it is provided free of charge.
67+
68+
## Fair Use
69+
70+
You may have "fair use" rights for the software under the
71+
law. These terms do not limit them.
72+
73+
## No Other Rights
74+
75+
These terms do not allow you to sublicense or transfer any of
76+
your licenses to anyone else, or prevent the licensor from
77+
granting licenses to anyone else. These terms do not imply
78+
any other licenses.
79+
80+
## Patent Defense
81+
82+
If you make any written claim that the software infringes or
83+
contributes to infringement of any patent, your patent license
84+
for the software granted under these terms ends immediately. If
85+
your company makes such a claim, your patent license ends
86+
immediately for work on behalf of your company.
87+
88+
## Violations
89+
90+
The first time you are notified in writing that you have
91+
violated any of these terms, or done anything with the software
92+
not covered by your licenses, your licenses can nonetheless
93+
continue if you come into full compliance with these terms,
94+
and take practical steps to correct past violations, within
95+
32 days of receiving notice. Otherwise, all your licenses
96+
end immediately.
97+
98+
## No Liability
99+
100+
***As far as the law allows, the software comes as is, without
101+
any warranty or condition, and the licensor will not be liable
102+
to you for any damages arising out of these terms or the use
103+
or nature of the software, under any kind of legal claim.***
104+
105+
## Definitions
106+
107+
The **licensor** is the individual or entity offering these
108+
terms, and the **software** is the software the licensor makes
109+
available under these terms.
110+
111+
A **product** can be a good or service, or a combination
112+
of them.
113+
114+
**You** refers to the individual or entity agreeing to these
115+
terms.
116+
117+
**Your company** is any legal entity, sole proprietorship,
118+
or other kind of organization that you work for, plus all
119+
organizations that have control over, are under the control of,
120+
or are under common control with that organization. **Control**
121+
means ownership of substantially all the assets of an entity,
122+
or the power to direct its management and policies by vote,
123+
contract, or otherwise. Control can be direct or indirect.
124+
125+
**Your licenses** are all the licenses granted to you for the
126+
software under these terms.
127+
128+
**Use** means anything you do with the software requiring one
129+
of your licenses.

README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Share Note backend server
2+
3+
Backend server for [Share Note](https://github.com/alangrainger/share-note/).
4+
5+
## Run with Docker
6+
7+
1. Take a copy of the [docker-compose.yml](https://github.com/note-sx/server/blob/main/docker-compose.yml) file
8+
2. Take a copy of the [example env file](https://github.com/note-sx/server/blob/main/.env.example) and save as `.env`
9+
3. Update the `.env` options as below
10+
4. `docker-compose up -d`
11+
12+
## `.env` options
13+
14+
| Option | Example | Description |
15+
|-----------------------------|---------------------|------------------------------------------------------------------------------------------------------------------------------------------|
16+
| BASE_WEB_URL | https://example.com | The base public URL for your server. |
17+
| HASH_SALT | Any random string | |
18+
| MAXIMUM_UPLOAD_SIZE_MB | 5 | The maximum allowed size for user uploads in megabytes (MB). |
19+
| FOLDER_PREFIX | 0 | *OPTIONAL.* Set this to `1` or `2` if you want user files to be split into subfolders based on the first *N* characters of the filename. |
20+
| CLOUDFLARE_TURNSTILE_KEY | | *OPTIONAL.* If you want to use Turnstile to show a captcha when someone creates an account. |
21+
| CLOUDFLARE_TURNSTILE_SECRET | | *OPTIONAL.* If you want to use Turnstile to show a captcha when someone creates an account. |
22+
| CLOUDFLARE_ZONE_ID | | *OPTIONAL.* If you want to use Cloudflare proxy in front of your server. |
23+
| CLOUDFLARE_API_KEY | | *OPTIONAL.* If you want to use Cloudflare proxy in front of your server. |

app/.eslintrc

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"root": true,
3+
"parser": "@typescript-eslint/parser",
4+
"env": { "node": true },
5+
"plugins": [
6+
"@typescript-eslint"
7+
],
8+
"extends": [
9+
"standard",
10+
"eslint:recommended",
11+
"plugin:@typescript-eslint/eslint-recommended",
12+
"plugin:@typescript-eslint/recommended"
13+
],
14+
"parserOptions": {
15+
"sourceType": "module"
16+
},
17+
"rules": {
18+
"no-new": 0,
19+
"no-unused-vars": "off",
20+
"@typescript-eslint/no-var-requires": "off",
21+
"@typescript-eslint/no-unused-vars": ["error", { "args": "none" }],
22+
"@typescript-eslint/ban-ts-comment": "off",
23+
"no-prototype-builtins": "off",
24+
"@typescript-eslint/no-empty-function": "off"
25+
}
26+
}

app/dist/.gitkeep

Whitespace-only changes.

0 commit comments

Comments
 (0)