Compare commits
19 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
4be72056d2 | ||
|
f0ab450af6 | ||
|
0c56fad0b8 | ||
|
cdef84f7ca | ||
|
37371cf298 | ||
|
1646553973 | ||
|
7f8622f48d | ||
|
e11a99000d | ||
|
ccca5549ac | ||
|
0a1b6dc9ce | ||
|
7a6a4c097d | ||
|
9b97290df1 | ||
|
a96d961142 | ||
|
07d7fbe1d2 | ||
|
96d8ab52a1 | ||
|
10c7a6b151 | ||
|
64b3d11de2 | ||
|
cfccc4e4d5 | ||
|
9cb2670fb2 |
44
.woodpecker.yml
Normal file
44
.woodpecker.yml
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
pipeline:
|
||||||
|
buildweb:
|
||||||
|
group: build
|
||||||
|
image: node
|
||||||
|
when:
|
||||||
|
path: "web/*"
|
||||||
|
environment:
|
||||||
|
- VITE_API_URL=https://api.treadl.com
|
||||||
|
- VITE_IMAGINARY_URL=https://images.treadl.com
|
||||||
|
- VITE_SOURCE_REPO_URL=https://git.wilw.dev/wilw/treadl
|
||||||
|
- VITE_PATREON_URL=https://www.patreon.com/treadl
|
||||||
|
- VITE_KOFI_URL=https://ko-fi.com/wilw88
|
||||||
|
- VITE_CONTACT_EMAIL=hello@treadl.com
|
||||||
|
- VITE_APP_NAME=Treadl
|
||||||
|
commands:
|
||||||
|
- cd web
|
||||||
|
- yarn install
|
||||||
|
- yarn build
|
||||||
|
|
||||||
|
buildapi:
|
||||||
|
group: build
|
||||||
|
image: woodpeckerci/plugin-docker-buildx
|
||||||
|
secrets: [docker_username, docker_password]
|
||||||
|
when:
|
||||||
|
path: "api/*"
|
||||||
|
settings:
|
||||||
|
repo: wilw/treadl-api
|
||||||
|
dockerfile: api/Dockerfile
|
||||||
|
context: api
|
||||||
|
|
||||||
|
deployweb:
|
||||||
|
image: alpine
|
||||||
|
secrets: [ LINODE_ACCESS_KEY, LINODE_SECRET_ACCESS_KEY, BUNNY_KEY ]
|
||||||
|
when:
|
||||||
|
path: "web/*"
|
||||||
|
commands:
|
||||||
|
- cd web
|
||||||
|
- apk update
|
||||||
|
- apk add s3cmd curl
|
||||||
|
- s3cmd --configure --access_key=$LINODE_ACCESS_KEY --secret_key=$LINODE_SECRET_ACCESS_KEY --host=https://eu-central-1.linodeobjects.com --host-bucket="%(bucket)s.eu-central-1.linodeobjects.com" --dump-config > /root/.s3cfg
|
||||||
|
- s3cmd -c /root/.s3cfg sync --no-mime-magic --guess-mime-type dist/* s3://treadl.com
|
||||||
|
- 'curl -X POST -H "AccessKey: $BUNNY_KEY" https://api.bunny.net/pullzone/782753/purgeCache'
|
||||||
|
|
||||||
|
branches: main
|
BIN
api/.DS_Store
vendored
Normal file
BIN
api/.DS_Store
vendored
Normal file
Binary file not shown.
@ -13,6 +13,7 @@ RUN poetry export --without-hashes -f requirements.txt | pip install -r /dev/std
|
|||||||
|
|
||||||
# Add remaining files
|
# Add remaining files
|
||||||
COPY app.py .
|
COPY app.py .
|
||||||
COPY chalicelib/ ./chalicelib
|
COPY api/ .
|
||||||
|
COPY util/ .
|
||||||
|
|
||||||
CMD ["gunicorn" , "-b", "0.0.0.0:8000", "app:app"]
|
CMD ["gunicorn" , "-b", "0.0.0.0:8000", "app:app"]
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import datetime, jwt, bcrypt, re, os
|
import datetime, jwt, bcrypt, re, os
|
||||||
from bson.objectid import ObjectId
|
from bson.objectid import ObjectId
|
||||||
from chalicelib.util import database, mail, util
|
from util import database, mail, util
|
||||||
from chalicelib.api import uploads
|
from api import uploads
|
||||||
|
|
||||||
jwt_secret = os.environ['JWT_SECRET']
|
jwt_secret = os.environ['JWT_SECRET']
|
||||||
MIN_PASSWORD_LENGTH = 8
|
MIN_PASSWORD_LENGTH = 8
|
@ -1,6 +1,6 @@
|
|||||||
import os, re
|
import os, re
|
||||||
from chalicelib.util import database, util
|
from util import database, util
|
||||||
from chalicelib.api import uploads
|
from api import uploads
|
||||||
|
|
||||||
DOMAIN = os.environ.get('APP_DOMAIN')
|
DOMAIN = os.environ.get('APP_DOMAIN')
|
||||||
|
|
@ -1,8 +1,8 @@
|
|||||||
import datetime, re, os
|
import datetime, re, os
|
||||||
import pymongo
|
import pymongo
|
||||||
from bson.objectid import ObjectId
|
from bson.objectid import ObjectId
|
||||||
from chalicelib.util import database, util, mail, push
|
from util import database, util, mail, push
|
||||||
from chalicelib.api import uploads
|
from api import uploads
|
||||||
|
|
||||||
APP_NAME = os.environ.get('APP_NAME')
|
APP_NAME = os.environ.get('APP_NAME')
|
||||||
APP_URL = os.environ.get('APP_URL')
|
APP_URL = os.environ.get('APP_URL')
|
@ -1,8 +1,8 @@
|
|||||||
import re, datetime, os
|
import re, datetime, os
|
||||||
import pymongo
|
import pymongo
|
||||||
from bson.objectid import ObjectId
|
from bson.objectid import ObjectId
|
||||||
from chalicelib.util import database, util, mail
|
from util import database, util, mail
|
||||||
from chalicelib.api import uploads, groups
|
from api import uploads, groups
|
||||||
|
|
||||||
APP_NAME = os.environ.get('APP_NAME')
|
APP_NAME = os.environ.get('APP_NAME')
|
||||||
APP_URL = os.environ.get('APP_URL')
|
APP_URL = os.environ.get('APP_URL')
|
@ -1,8 +1,8 @@
|
|||||||
import datetime, base64, os
|
import datetime, base64, os
|
||||||
from bson.objectid import ObjectId
|
from bson.objectid import ObjectId
|
||||||
import requests
|
import requests
|
||||||
from chalicelib.util import database, wif, util, mail
|
from util import database, wif, util, mail
|
||||||
from chalicelib.api import uploads
|
from api import uploads
|
||||||
|
|
||||||
APP_NAME = os.environ.get('APP_NAME')
|
APP_NAME = os.environ.get('APP_NAME')
|
||||||
|
|
@ -1,7 +1,7 @@
|
|||||||
import datetime, re
|
import datetime, re
|
||||||
from bson.objectid import ObjectId
|
from bson.objectid import ObjectId
|
||||||
from chalicelib.util import database, wif, util
|
from util import database, wif, util
|
||||||
from chalicelib.api import uploads
|
from api import uploads
|
||||||
|
|
||||||
default_pattern = {
|
default_pattern = {
|
||||||
'warp': {
|
'warp': {
|
@ -1,8 +1,8 @@
|
|||||||
import re, datetime
|
import re, datetime
|
||||||
import pymongo
|
import pymongo
|
||||||
from bson.objectid import ObjectId
|
from bson.objectid import ObjectId
|
||||||
from chalicelib.util import database, util, mail
|
from util import database, util, mail
|
||||||
from chalicelib.api import uploads, groups
|
from api import uploads, groups
|
||||||
|
|
||||||
def get_users(user):
|
def get_users(user):
|
||||||
db = database.get_db()
|
db = database.get_db()
|
@ -1,7 +1,7 @@
|
|||||||
import re, random
|
import re, random
|
||||||
import pymongo
|
import pymongo
|
||||||
from chalicelib.util import database, util
|
from util import database, util
|
||||||
from chalicelib.api import uploads
|
from api import uploads
|
||||||
|
|
||||||
def all(user, params):
|
def all(user, params):
|
||||||
if not params or 'query' not in params: raise util.errors.BadRequest('Username parameter needed')
|
if not params or 'query' not in params: raise util.errors.BadRequest('Username parameter needed')
|
@ -4,7 +4,7 @@ from bson.objectid import ObjectId
|
|||||||
import boto3
|
import boto3
|
||||||
from botocore.client import Config
|
from botocore.client import Config
|
||||||
import blurhash
|
import blurhash
|
||||||
from chalicelib.util import database
|
from util import database
|
||||||
|
|
||||||
def sanitise_filename(s):
|
def sanitise_filename(s):
|
||||||
bad_chars = re.compile('[^a-zA-Z0-9_.]')
|
bad_chars = re.compile('[^a-zA-Z0-9_.]')
|
@ -1,7 +1,7 @@
|
|||||||
import datetime
|
import datetime
|
||||||
from bson.objectid import ObjectId
|
from bson.objectid import ObjectId
|
||||||
from chalicelib.util import database, util
|
from util import database, util
|
||||||
from chalicelib.api import uploads
|
from api import uploads
|
||||||
|
|
||||||
def me(user):
|
def me(user):
|
||||||
return {
|
return {
|
@ -5,8 +5,8 @@ from flask_cors import CORS
|
|||||||
import werkzeug
|
import werkzeug
|
||||||
import sentry_sdk
|
import sentry_sdk
|
||||||
from sentry_sdk.integrations.flask import FlaskIntegration
|
from sentry_sdk.integrations.flask import FlaskIntegration
|
||||||
from chalicelib.util import util
|
from util import util
|
||||||
from chalicelib.api import accounts, users, projects, objects, uploads, groups, search, invitations, root, activitypub
|
from api import accounts, users, projects, objects, uploads, groups, search, invitations, root, activitypub
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
CORS(app)
|
CORS(app)
|
||||||
|
@ -6,7 +6,7 @@ export MAILGUN_KEY=""
|
|||||||
export MONGO_URL="mongodb://localhost"
|
export MONGO_URL="mongodb://localhost"
|
||||||
export MONGO_DATABASE="treadl"
|
export MONGO_DATABASE="treadl"
|
||||||
export JWT_SECRET="devsecret"
|
export JWT_SECRET="devsecret"
|
||||||
export GOOGLE_APPLICATION_CREDENTIALS="chalicelib/firebase.json"
|
export GOOGLE_APPLICATION_CREDENTIALS="firebase.json"
|
||||||
export AWS_S3_ENDPOINT="https://eu-central-1.linodeobjects.com/"
|
export AWS_S3_ENDPOINT="https://eu-central-1.linodeobjects.com/"
|
||||||
export AWS_S3_BUCKET="treadl"
|
export AWS_S3_BUCKET="treadl"
|
||||||
export AWS_ACCESS_KEY_ID=""
|
export AWS_ACCESS_KEY_ID=""
|
||||||
|
@ -5,8 +5,8 @@ from flask_limiter.util import get_remote_address
|
|||||||
from cryptography.hazmat.primitives import serialization
|
from cryptography.hazmat.primitives import serialization
|
||||||
from cryptography.hazmat.primitives.asymmetric import rsa
|
from cryptography.hazmat.primitives.asymmetric import rsa
|
||||||
from bson.objectid import ObjectId
|
from bson.objectid import ObjectId
|
||||||
from chalicelib.api import accounts
|
from api import accounts
|
||||||
from chalicelib.util import util
|
from util import util
|
||||||
|
|
||||||
errors = werkzeug.exceptions
|
errors = werkzeug.exceptions
|
||||||
|
|
18
web/bucket-policy.json
Normal file
18
web/bucket-policy.json
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"Statement": [
|
||||||
|
{
|
||||||
|
"Effect": "Allow",
|
||||||
|
"Principal": {
|
||||||
|
"AWS": [
|
||||||
|
"*"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"Action": [
|
||||||
|
"s3:GetObject"
|
||||||
|
],
|
||||||
|
"Resource": [
|
||||||
|
"arn:aws:s3::treadl.com/*"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user