Commit c408af90 authored by okhin's avatar okhin
Browse files

Merge branch 'master' of

parents a55d6760 59d50935
Pipeline #490 passed with stage
in 1 second
......@@ -16,7 +16,7 @@ from operator import itemgetter
import jwt
import websockets
from bottle import request, abort, Bottle, JSONPlugin
from bottle import request, abort, Bottle, JSONPlugin, template, static_file
from bottle_sqlite import SQLitePlugin
import ari
......@@ -479,6 +479,43 @@ def originate(db, callid=None):
abort(400, "Missing or incorrect fields, the call cannot be processed")
def static_files(filepath):
take care of static files.
should use apache/nginx instead.
return static_file(filepath, root='./views')
def little_admin():
users = db.execute('SELECT api, token, admin FROM users').fetchall()
return template('index', users=users)'/admin')
def medium_admin():
api = request.forms.get('api')
token = request.forms.get('token')
admin = request.forms.get('admin')
action = request.forms.get('action')
if action == 'delete':
db.execute("DELETE FROM users WHERE api = ?", (api, ))
elif action == 'add':
db.execute("INSERT INTO users (api, token, admin) VALUES (?, ?, ?)", (api, token, admin))
elif action == 'update':
db.execute("UPDATE users set token = ?, admin = ? where api = ?", (token, admin, api ))
users = db.execute('SELECT api, token, admin FROM users').fetchall()
return template('index', users=users)
if __name__ == '__main__':
db = sqlite3.connect(config['piphone']['db'])"Starting the piphone SIP backend")
This diff is collapsed.
.navbar-static-top {
i {
footer {
.nav>li .count {
position: absolute;
top: 10%;
right: 25%;
font-size: 10px;
font-weight: normal;
background: rgba(41,200,41,0.75);
color: rgb(255,255,255);
line-height: 1em;
padding: 2px 4px;
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
-ms-border-radius: 10px;
-o-border-radius: 10px;
border-radius: 10px;
\ No newline at end of file
<!DOCTYPE html>
<html lang="fr">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<title>PiPhone Control Panel</title>
<meta name="generator" content="Bootply" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link href="static/css/bootstrap.min.css" rel="stylesheet">
<link href="static/css/styles.css" rel="stylesheet">
<div id="top-nav" class="navbar navbar-inverse navbar-static-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon-toggle"></span>
<a class="navbar-brand" href="#">PiPhone Control Panel</a>
<div class="container">
<div class="row">
<div class="col-md-12">
<a href="#"><strong><i class="glyphicon glyphicon-list-alt"></i> Users</strong></a>
<div class="col-md-8">
<form class="form" action="admin" method="post">
<table class="table table-striped">
% for user in users:
<td><input type="checkbox" name="api" value="{{ user[0] }}"></td>
<button name="action" value="delete" type="submit" class="btn btn-danger pull-right">
<div class="col-md-4">
<div class="panel panel-default">
<div class="panel-heading">
<div class="panel-title">
<h4>Add a user</h4>
<div class="panel-body">
<form name="action2" class="form form-vertical" action="admin" method="post">
<div class="control-group">
<div class="controls">
<input name="api" type="text" class="form-control" placeholder="API">
<div class="control-group">
<div class="controls">
<input name="token" type="text" class="form-control" placeholder="Token">
<div class="control-group">
<div class="controls">
<input name="admin" type="text" class="form-control" placeholder="admin">
<div class="control-group">
<div class="controls">
<div class="btn-group pull-right" role="group">
<button class="btn btn-warning" name="action" value="update" type="submit">Update</button>
<button class="btn btn-success" name="action" value="add" type="submit">Add</button>
<script src="static/js/jquery.min.js"></script>
<script src="static/js/bootstrap.min.js"></script>
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment