Exemplo n.º 1
0
async def dashboard():
    if request.method == "POST":
        form = request.form
        if WEBCONFIG.PASSWORD != form["password"]:
            return (url_for("login"))
        else:
            return render_template("dashboard.html")
Exemplo n.º 2
0
def index():
    setup = True if prover else False
    have_data = True if received_data else False
    responded = True if 'connection_response' in prover else False
    '''
    The onboardee depends on the anchor to finish establishing the secure channel.
    However the request-reponse messaging means the onboardee cannot proceed until it is:
    the functions made available by the channel_established variable wait until the
    relevant response from the anchor is returned, which is only possible if the channel
    is set up on the anchor end.
    '''
    channel_established = True if anchor_ip else False
    have_verinym = True if 'did_info' in prover else False
    unique_schema_name = prover[
        'unique_schema_name'] if 'unique_schema_name' in prover else False
    have_proof_request = True if 'authcrypted_proof_request' in prover else False
    stored_credentials_string = ', '.join(credential
                                          for credential in stored_credentials)
    # If stored credentials == credential offer, hide credential request
    return render_template('prover.html',
                           actor='PROVER',
                           setup=setup,
                           have_data=have_data,
                           request_ip=request_ip,
                           responded=responded,
                           channel_established=channel_established,
                           have_verinym=have_verinym,
                           stored_credentials=stored_credentials_string,
                           unique_schema_name=unique_schema_name,
                           have_proof_request=have_proof_request,
                           multiple_onboard=multiple_onboard,
                           service_published=service_published)
Exemplo n.º 3
0
def index():
    setup = True if verifier else False
    have_data = True if received_data else False
    responded = True if 'connection_response' in verifier else False
    '''
    The onboardee depends on the anchor to finish establishing the secure channel.
    However the request-reponse messaging means the onboardee cannot proceed until it is:
    the functions made available by the channel_established variable wait until the
    relevant response from the anchor is returned, which is only possible if the channel
    is set up on the anchor end.
    '''
    channel_established = True if anchor_ip else False
    prover_registered = True if 'prover_ip' in verifier else False
    have_verinym = True if 'did_info' in verifier else False
    credential_requested = True if 'authcrypted_cred_request' in verifier else False
    have_proof = True if 'authcrypted_proof' in verifier else False
    search_results = verifier['search_results'].strip('"[]\'').replace(
        ',', ', ') if 'search_results' in verifier else False
    return render_template('verifier.html',
                           actor='VERIFIER',
                           setup=setup,
                           have_data=have_data,
                           request_ip=request_ip,
                           responded=responded,
                           channel_established=channel_established,
                           have_verinym=have_verinym,
                           prover_registered=prover_registered,
                           credential_requested=credential_requested,
                           have_proof=have_proof,
                           search_results=search_results)
Exemplo n.º 4
0
def dashboard():
    local = remote = None
    hosts_preload = load_config(config=CONFIG_FILE, section='apple_tvs')
    atvs = LOOP.run_until_complete(discover(LOOP, hosts=hosts_preload))
    atvs = sorted(atvs, key=lambda i: i['name'])

    plex = plex_connect(plex_load_config())
    local_plex_sessions, remote_plex_sessions = plex_streams(plex)

    remote = remote_plex_sessions
    local = atvs + local_plex_sessions

    unique_devices = set()
    local = [
        x for x in local if x['address'] not in unique_devices
        and not unique_devices.add(x['address'])
    ]

    context = {'local': local, 'remote': remote}

    # print(str(context))

    return render_template('dashboard.html',
                           title='Mdashboard',
                           context=context,
                           console=json.dumps(context))
Exemplo n.º 5
0
def index():
    setup = True if issuer else False
    have_data = True if received_data else False
    responded = True if 'connection_response' in issuer else False
    '''
    The onboardee depends on the anchor to finish establishing the secure channel.
    However the request-reponse messaging means the onboardee cannot proceed until it is:
    the functions made available by the channel_established variable wait until the
    relevant response from the anchor is returned, which is only possible if the channel
    is set up on the anchor end.
    '''
    channel_established = True if anchor_ip else False
    prover_registered = True if 'prover_ip' in issuer else False
    have_verinym = True if 'did_info' in issuer else False
    credential_requested = True if 'authcrypted_cred_request' in issuer else False
    created_schema_string = ', '.join(schema for schema in created_schema)
    return render_template('issuer.html',
                           actor='ISSUER',
                           setup=setup,
                           have_data=have_data,
                           request_ip=request_ip,
                           responded=responded,
                           channel_established=channel_established,
                           have_verinym=have_verinym,
                           created_schema=created_schema_string,
                           prover_registered=prover_registered,
                           credential_requested=credential_requested)
Exemplo n.º 6
0
def check_valid_login():
    login_valid = 'user_id' in session and session.get('user_id') is not None

    if (request.endpoint and 'static' not in request.endpoint
            and not login_valid and not getattr(
                app.view_functions[request.endpoint], 'is_public', False)):
        return render_template('login.html', next=request.endpoint)
Exemplo n.º 7
0
 def _openapi_swagger_ui(self):
     """Expose OpenAPI spec with Swagger UI"""
     return quart.render_template(
         'swagger_ui.html',
         title=self._app.name,
         swagger_ui_url=self._swagger_ui_url,
         swagger_ui_supported_submit_methods=(
             self._swagger_ui_supported_submit_methods))
Exemplo n.º 8
0
def index():
    global steward
    setup = True if steward else False
    channel_established = True if 'connection_response' in steward else False
    return render_template('steward.html',
                           actor='STEWARD',
                           setup=setup,
                           channel_established=channel_established)
Exemplo n.º 9
0
def add_servers():
    if request.method == 'POST':
        ips = request.form['ips']
        user = request.form['user']
        password = request.form['password']
        nodes = ips.split(',')
        try:
            add_nodes(nodes, user, password)
        except Exception as e:
            print(e)
    return render_template('index.html', title='Home')
Exemplo n.º 10
0
def static_page():
    args = []
    global users
    for i in users:
        args.append((str(i.id), i.first_name, nullToStr(i.last_name), i.phone))

    if request.method == 'POST':
        values = request.form
        if (values['desc'] == "Desconectar"):
            users = []
            loop = asyncio.new_event_loop()
            loop.run_until_complete(disconn(request.remote_addr))
            loop.close()
        else:
            loop = asyncio.new_event_loop()
            loop.run_until_complete(formatChat(values))
            loop.close()
        return render_template('contacts.html', lenUsers=len(users), user=args)
    else:

        return render_template('contacts.html', lenUsers=len(users), user=args)
Exemplo n.º 11
0
def conn():
    ip = request.remote_addr
    if os.path.exists(ip + ".session"):
        redirect(url_for('welcome'))
    if request.method == 'GET':
        return render_template('login.html')
    else:
        values = request.form
        if values['part'] == "2":
            telf = values['telf']
            loop = asyncio.new_event_loop()
            loop.run_until_complete(startTele(ip, telf, loop))
            return render_template(
                'login.html',
                part="2",
            )
        else:
            codigo = values['codigo']
            global sessions
            loop = sessions[ip][2]
            loop.run_until_complete(sign_in_tele(ip, codigo))
            return redirect(url_for('welcome'))
Exemplo n.º 12
0
def craigslist():
    myDict = {
        'For+Sale': 'sss',
        'Housing': 'hhh',
        'Community': 'ccc',
        'Jobs': 'jjj',
        'Services': 'bbb'
    }
    print(request.url)

    class CraigListScraper:
        def __init__(self):
            self.session = requests.Session()
            self.base_url = "https://" + request.url.split('city=')[1].split(
                '&')[0].replace(' ', '') + ".craigslist.com"
            self.start_url = "https://" + request.url.split('city=')[1].split(
                '&')[0].replace(
                    ' ', '') + ".craigslist.com/search/" + myDict.get(
                        request.url.split('Area=')[1]).replace(' ', '')
            self.title = []
            self.date = []
            self.link = []

        def begin(self):
            page = self.session.get(self.start_url).text
            tree_branch = html.fromstring(page)
            my_list = []
            titles = []
            for row in tree_branch.xpath('.//li[@class="result-row"]'):
                try:
                    if row.xpath(".//a")[1].text not in titles:
                        my_list.append([
                            row.xpath(
                                ".//a[contains(concat(' ', @class, ' '), ' hdrlnk ')]/@href"
                            )[0],
                            row.xpath(".//a")[1].text,
                            row.xpath(".//time/@title")
                        ])
                        titles.append(row.xpath(".//a")[1].text)
                except:
                    pass
            return my_list

    try:
        scraper = CraigListScraper()
        stupid_list = scraper.begin()
    except:
        pass
    return render_template('craigslist.html', **locals())
Exemplo n.º 13
0
async def BanchoSettings():
    if await HasPrivilege(session["AccountId"], 4):
        #no bypassing it.
        if request.method == "GET":
            return await render_template("banchosettings.html",
                                         preset=await FetchBSData(),
                                         title="Bancho Settings",
                                         data=await DashData(),
                                         bsdata=await FetchBSData(),
                                         session=session,
                                         config=UserConfig)
        if request.method == "POST":
            try:
                await BSPostHandler([
                    request.form["banchoman"], request.form["mainmemuicon"],
                    request.form["loginnotif"]
                ], session)  #handles all the changes
                return await render_template(
                    "banchosettings.html",
                    preset=await FetchBSData(),
                    title="Bancho Settings",
                    data=await DashData(),
                    bsdata=await FetchBSData(),
                    session=session,
                    config=UserConfig,
                    success="Bancho settings were successfully edited!")
            except Exception as e:
                print(e)
                ConsoleLog("Error while editing bancho settings!", f"{e}", 3)
                return render_template(
                    "banchosettings.html",
                    preset=await FetchBSData(),
                    title="Bancho Settings",
                    data=await DashData(),
                    bsdata=await FetchBSData(),
                    session=session,
                    config=UserConfig,
                    error=
                    "An internal error has occured while saving bancho settings! An error has been logged to the console."
                )

    else:
        return NoPerm(session)
Exemplo n.º 14
0
async def chatPage(chat):
    global tClient
    if chat == "null":
        return jsonify(
            {1: "Algo salió mal en la carga, reintentelo de nuevo."})
    entity = await tClient.get_entity(chat)
    msg = await tClient.get_messages(entity, 20)
    result = {}
    i = 0
    meu = await tClient.get_me()
    for m in msg:

        data = mClient.find_one({'idChat': str(entity.id)})
        color = transformColor(data['idToColor'][str(m.from_id)][1])
        nickname = data['idToNickname'][str(m.from_id)]
        photo = data['idToPhoto'][str(m.from_id)]
        itsme = 0
        if meu.id == m.from_id:
            itsme = 1
        if m.message is not None:
            i = i + 1
            result[i] = [photo, color, nickname, m.message, itsme]
            print(result[i])
    return render_template(result)
Exemplo n.º 15
0
async def admin():
    return render_template('index.htm')
Exemplo n.º 16
0
def index():
    """Index service"""
    img = get_index_img()
    return render_template("index.html", img=img, port=options.get('port', 5000))
Exemplo n.º 17
0
 def render_error(error):
     """Render error template."""
     # If a HTTPException, pull the `code` attribute; default to 500
     error_code = getattr(error, "code", 500)
     return render_template(f"error/{error_code}.html"), error_code
Exemplo n.º 18
0
def index():
    return render_template('index.html')
Exemplo n.º 19
0
def home():
    return render_template('index.html')
Exemplo n.º 20
0
async def stop_scrap():
    scraping.scraping().close()

    return render_template('index.html')
Exemplo n.º 21
0
 def small():
     return render_template("small.html")
Exemplo n.º 22
0
 def large():
     return render_template("large.html")
Exemplo n.º 23
0
def home(methods=['GET', 'POST']):
    return render_template('home.html')
Exemplo n.º 24
0
async def login():
    return render_template("login.html")
Exemplo n.º 25
0
async def not_found(e):
    return render_template("warning.html", error="404", message="Seems like you got somewhere you shouldn't be... maybe you should <span><a href='/'>Go Home</a></span>.")
Exemplo n.º 26
0
def checkout_invoice(invoice_id):
    invoice = Invoice.get_by_id(invoice_id)
    if invoice is None:
        abort(404)
    return render_template("checkout", invoice)
Exemplo n.º 27
0
def home():
    scraper = 'a'
    return render_template('craigslist.html', **locals())
Exemplo n.º 28
0
def graphcall():
    token = _get_token_from_cache(app_config.SCOPE)
    if not token:
        return redirect(url_for("login"))
    graph_data = get_graph_data("https://graph.microsoft.com/v1.0/me/").json()
    return render_template('display.html', result=graph_data)
Exemplo n.º 29
0
 def _openapi_redoc(self):
     """Expose OpenAPI spec with ReDoc"""
     return quart.render_template('redoc.html',
                                  title=self._app.name,
                                  redoc_url=self._redoc_url)