예제 #1
0
파일: publish.py 프로젝트: bear/palala
def webmention():
    if request.method == 'POST':
        source = request.form.get('source')
        target = request.form.get('target')
        # vouch  = request.form.get('vouch')

        current_app.logger.info('webmention [{source}] [{target}]'.format(source=source, target=target))

        if '/publish' in target:
            return process(source, target)
        else:
            return mention(source, target)
예제 #2
0
파일: publish.py 프로젝트: bear/palala
def publish():
    if request.method == 'POST':
        source = request.form.get('source')
        target = request.form.get('target')
        # vouch  = request.form.get('vouch')

        current_app.logger.info('publish [%s] [%s]' % (source, target))

        r = process(source, target)
        if r is None:
            response             = jsonify({ "error": "publish URL cound not be found within target URL"})
            response.status_code = 400
        else:
            response                     = jsonify(r)
            response.status_code         = 201
            response.headers['location'] = 'http://indieweb.news/posts/{domain}/{postid}'.format(**r)
        return response
    else:
        return render_template('publish.jinja')