Compare commits

..

No commits in common. "be97df633156a82d829fbd5359f6d385a8ca44da" and "d1a6a834671710d0242493c3f44a2d6d6329a248" have entirely different histories.

25 changed files with 26 additions and 90 deletions

View File

@ -1,44 +0,0 @@
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

3
api/.gitignore vendored
View File

@ -6,5 +6,4 @@ __pycache__/
.chalice/venv/
config-prod.yml
envfile
firebase.json
.DS_Store
firebase.json

View File

@ -13,7 +13,6 @@ RUN poetry export --without-hashes -f requirements.txt | pip install -r /dev/std
# Add remaining files
COPY app.py .
COPY api/ .
COPY util/ .
COPY chalicelib/ ./chalicelib
CMD ["gunicorn" , "-b", "0.0.0.0:8000", "app:app"]

View File

@ -5,8 +5,8 @@ from flask_cors import CORS
import werkzeug
import sentry_sdk
from sentry_sdk.integrations.flask import FlaskIntegration
from util import util
from api import accounts, users, projects, objects, uploads, groups, search, invitations, root, activitypub
from chalicelib.util import util
from chalicelib.api import accounts, users, projects, objects, uploads, groups, search, invitations, root, activitypub
app = Flask(__name__)
CORS(app)

View File

@ -1,7 +1,7 @@
import datetime, jwt, bcrypt, re, os
from bson.objectid import ObjectId
from util import database, mail, util
from api import uploads
from chalicelib.util import database, mail, util
from chalicelib.api import uploads
jwt_secret = os.environ['JWT_SECRET']
MIN_PASSWORD_LENGTH = 8

View File

@ -1,6 +1,6 @@
import os, re
from util import database, util
from api import uploads
from chalicelib.util import database, util
from chalicelib.api import uploads
DOMAIN = os.environ.get('APP_DOMAIN')

View File

@ -1,8 +1,8 @@
import datetime, re, os
import pymongo
from bson.objectid import ObjectId
from util import database, util, mail, push
from api import uploads
from chalicelib.util import database, util, mail, push
from chalicelib.api import uploads
APP_NAME = os.environ.get('APP_NAME')
APP_URL = os.environ.get('APP_URL')

View File

@ -1,8 +1,8 @@
import re, datetime, os
import pymongo
from bson.objectid import ObjectId
from util import database, util, mail
from api import uploads, groups
from chalicelib.util import database, util, mail
from chalicelib.api import uploads, groups
APP_NAME = os.environ.get('APP_NAME')
APP_URL = os.environ.get('APP_URL')

View File

@ -1,8 +1,8 @@
import datetime, base64, os
from bson.objectid import ObjectId
import requests
from util import database, wif, util, mail
from api import uploads
from chalicelib.util import database, wif, util, mail
from chalicelib.api import uploads
APP_NAME = os.environ.get('APP_NAME')

View File

@ -1,7 +1,7 @@
import datetime, re
from bson.objectid import ObjectId
from util import database, wif, util
from api import uploads
from chalicelib.util import database, wif, util
from chalicelib.api import uploads
default_pattern = {
'warp': {

View File

@ -1,8 +1,8 @@
import re, datetime
import pymongo
from bson.objectid import ObjectId
from util import database, util, mail
from api import uploads, groups
from chalicelib.util import database, util, mail
from chalicelib.api import uploads, groups
def get_users(user):
db = database.get_db()

View File

@ -1,7 +1,7 @@
import re, random
import pymongo
from util import database, util
from api import uploads
from chalicelib.util import database, util
from chalicelib.api import uploads
def all(user, params):
if not params or 'query' not in params: raise util.errors.BadRequest('Username parameter needed')

View File

@ -4,7 +4,7 @@ from bson.objectid import ObjectId
import boto3
from botocore.client import Config
import blurhash
from util import database
from chalicelib.util import database
def sanitise_filename(s):
bad_chars = re.compile('[^a-zA-Z0-9_.]')

View File

@ -1,7 +1,7 @@
import datetime
from bson.objectid import ObjectId
from util import database, util
from api import uploads
from chalicelib.util import database, util
from chalicelib.api import uploads
def me(user):
return {

View File

View File

@ -5,8 +5,8 @@ from flask_limiter.util import get_remote_address
from cryptography.hazmat.primitives import serialization
from cryptography.hazmat.primitives.asymmetric import rsa
from bson.objectid import ObjectId
from api import accounts
from util import util
from chalicelib.api import accounts
from chalicelib.util import util
errors = werkzeug.exceptions

View File

@ -6,7 +6,7 @@ export MAILGUN_KEY=""
export MONGO_URL="mongodb://localhost"
export MONGO_DATABASE="treadl"
export JWT_SECRET="devsecret"
export GOOGLE_APPLICATION_CREDENTIALS="firebase.json"
export GOOGLE_APPLICATION_CREDENTIALS="chalicelib/firebase.json"
export AWS_S3_ENDPOINT="https://eu-central-1.linodeobjects.com/"
export AWS_S3_BUCKET="treadl"
export AWS_ACCESS_KEY_ID=""

View File

@ -1,18 +0,0 @@
{
"Statement": [
{
"Effect": "Allow",
"Principal": {
"AWS": [
"*"
]
},
"Action": [
"s3:GetObject"
],
"Resource": [
"arn:aws:s3::treadl.com/*"
]
}
]
}