Merge branch 'fix-html' into 'master'

Fix html

See merge request pleroma/relay!8
This commit is contained in:
kaniini 2019-01-17 23:02:53 +00:00
commit 10744d9191
8 changed files with 61 additions and 3 deletions

3
.gitignore vendored
View file

@ -96,3 +96,6 @@ ENV/
viera.yaml
viera.jsonld
relay.jsonld
relay.yaml

1
Procfile Normal file
View file

@ -0,0 +1 @@
web: python -m relay

16
app.json Normal file
View file

@ -0,0 +1,16 @@
{
"dokku": {
"volumes": [
{
"host": "/var/lib/dokku/data/storage/$APP/files",
"app": "/app/files",
"phases": "deploy,run"
}
]
},
"scripts": {
"dokku": {
"predeploy": "./bin/pre-deploy"
}
}
}

6
bin/pre-deploy Executable file
View file

@ -0,0 +1,6 @@
#!/bin/bash
sed \
-e "s/__PORT__/${PORT:-5000}/g" \
-e "s/__HOSTNAME__/$HOSTNAME/g" \
relay_template.yaml > relay.yaml

View file

@ -35,7 +35,11 @@ from . import app, CONFIG
from .remote_actor import fetch_actor
AP_CONFIG = CONFIG.get('ap', {'host': 'localhost','blocked_instances':[]})
AP_CONFIG = CONFIG.get('ap', {
'host': 'localhost',
'blocked_instances': [],
'allowed_instances': [],
})
CACHE_SIZE = CONFIG.get('cache-size', 16384)
@ -218,6 +222,10 @@ async def handle_follow(actor, data, request):
if urlsplit(inbox).hostname in AP_CONFIG['blocked_instances']:
return
if AP_CONFIG['allowed_instances'] and\
urlsplit(inbox).hostname not in AP_CONFIG['allowed_instances']:
return
if inbox not in following:
following += [inbox]
DATABASE['relay-list'] = following

View file

@ -14,7 +14,7 @@ async def default(request):
status=200,
content_type="text/html",
charset="utf-8",
text="""
text="""<!doctype html>
<html><head>
<title>ActivityPub Relay at {host}</title>
<style>

View file

@ -1,3 +1,4 @@
import os
import subprocess
import urllib.parse
@ -10,7 +11,7 @@ from .database import DATABASE
try:
commit_label = subprocess.check_output(["git", "rev-parse", "HEAD"]).strip().decode('ascii')
except:
commit_label = '???'
commit_label = os.environ.get('GIT_REV')
nodeinfo_template = {

23
relay_template.yaml Normal file
View file

@ -0,0 +1,23 @@
# this is the path that the object graph will get dumped to (in JSON-LD format),
# you probably shouldn't change it, but you can if you want.
db: files/relay.jsonld
# Listener
listen: 0.0.0.0
port: __PORT__
# Note
note: "Make a note about your instance here."
# this section is for ActivityPub
ap:
# this is used for generating activitypub messages, as well as instructions for
# linking AP identities. it should be an SSL-enabled domain reachable by https.
host: '__HOSTNAME__'
blocked_instances: []
allowed_instances:
- edge.twingyeo.kr
- planet.moe
- qdon.space
- twingyeo.kr
- uri.life