Skip to content
Permalink
Browse files

redirect per #17

  • Loading branch information...
paulgb committed Jun 23, 2019
1 parent c67e535 commit 741399d0f64b58a45e05f9045c5be49525342832
Showing with 9 additions and 4 deletions.
  1. +8 −3 server/notify_run_server/app.py
  2. +1 −1 site/src/api.ts
@@ -1,6 +1,6 @@
from io import BytesIO

from flask import Flask, Response, jsonify, request
from flask import Flask, Response, jsonify, request, redirect
from flask_cors import CORS
from pyqrcode import QRCode

@@ -43,11 +43,11 @@ def to_python(self, value):


def channel_page_url(channel_id):
return (WEB_SERVER or request.host) + '/c/' + channel_id
return (WEB_SERVER or request.url_root[:-1]) + '/c/' + channel_id


def channel_endpoint(channel_id):
return (API_SERVER or request.host) + '/' + channel_id
return (API_SERVER or request.url_root[:-1]) + '/' + channel_id


def qr_for_channel(channel_id):
@@ -98,6 +98,11 @@ def info(channel_id):


@app.route('/<chid:channel_id>', methods=['GET'])
def redirect_channel(channel_id):
return redirect(channel_page_url(channel_id))


@app.route('/<chid:channel_id>/json', methods=['GET'])
def get_channel(channel_id):
try:
channel = model.get_channel(channel_id)
@@ -33,7 +33,7 @@ export namespace NotifyAPI {
}

export function fetchChannel(channelId: string): Promise<ChannelResponse> {
return request(`/${channelId}`);
return request(`/${channelId}/json`);
}

export function getURLOfQR(channelId: string): string {

0 comments on commit 741399d

Please sign in to comment.
You can’t perform that action at this time.