Rehabilitate CLI and API after nonce changes
This commit is contained in:
@@ -21,10 +21,10 @@ from confini import Config
|
||||
logging.basicConfig(level=logging.WARNING)
|
||||
logg = logging.getLogger()
|
||||
|
||||
config_dir = os.path.join(xdg_config_home, 'cli-ussd')
|
||||
default_config_dir = os.environ.get('CONFINI_DIR', '/usr/local/etc/cic')
|
||||
|
||||
argparser = argparse.ArgumentParser(description='CLI tool to interface a Sempo USSD session')
|
||||
argparser.add_argument('-c', type=str, default=config_dir, help='config root to use')
|
||||
argparser.add_argument('-c', type=str, default=default_config_dir, help='config root to use')
|
||||
#argparser.add_argument('-d', type=str, default='local', help='deployment name to interface (config root subdirectory)')
|
||||
argparser.add_argument('--host', type=str, default='localhost')
|
||||
argparser.add_argument('--port', type=int, default=9000)
|
||||
@@ -64,7 +64,7 @@ else:
|
||||
ssl = True
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
def main():
|
||||
|
||||
# TODO: improve url building
|
||||
url = 'http'
|
||||
@@ -101,3 +101,7 @@ if __name__ == "__main__":
|
||||
state = response_data[:3]
|
||||
out = response_data[4:]
|
||||
print(out)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -1,7 +1,7 @@
|
||||
# standard imports
|
||||
import semver
|
||||
|
||||
version = (0, 3, 0, 'alpha.1')
|
||||
version = (0, 3, 0, 'alpha.5')
|
||||
|
||||
version_object = semver.VersionInfo(
|
||||
major=version[0],
|
||||
|
||||
@@ -16,9 +16,16 @@ div#session {
|
||||
<textarea id="monitor" disabled="1"></textarea>
|
||||
<div id="login">
|
||||
<label for="user">API username</label>
|
||||
<input type="text" id="user" name="user" type="text" /><br/>
|
||||
<input type="text" id="user" name="user" />
|
||||
<label for="user">API password</label>
|
||||
<input type="text" id="pass" name="pass" type="text" /><br/>
|
||||
<input type="text" id="pass" name="pass" /> <br/>
|
||||
|
||||
<label for="host">API host</label>
|
||||
<input type="text" id="host" name="host" />
|
||||
<label for="host">API port</label>
|
||||
<input type="text" id="port" name="port" />
|
||||
<label for="host">SSL</label>
|
||||
<input type="checkbox" id="ssl" name="ssl" checked="1"/> <br/>
|
||||
<hr/>
|
||||
<input type="text" id="phone" /> <button onclick="setPhone(document.getElementById('phone').value);" id="send_phone">set phone number</button>
|
||||
</div>
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
//var proto = 'http';
|
||||
//var host = 'localhost:9000';
|
||||
var ssl = false;
|
||||
var host = 'localhost';
|
||||
var port = 9000;
|
||||
var proto = 'https';
|
||||
var host = 'staging.sarafu.network';
|
||||
var user = 'admin_bert_token_inc.';
|
||||
var pass = '197781ed60bf16d5dc12d84e3df37e35';
|
||||
var serviceCode = '*483*061#';
|
||||
var user = 'foo';
|
||||
var pass = 'bar';
|
||||
var path = '/';
|
||||
var serviceCode = '*483*46#';
|
||||
|
||||
// cheekily stolen from https://www.tutorialspoint.com/how-to-create-guid-uuid-in-javascript
|
||||
function createUUID() {
|
||||
@@ -23,9 +25,17 @@ function send(s) {
|
||||
document.getElementById('send_input').disabled = true;
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.responseType = 'text';
|
||||
current_user = document.getElementById('user').value;
|
||||
current_pass = document.getElementById('pass').value;
|
||||
xhr.open('POST', proto + '://' + host + '/api/v1/ussd/kenya?username=' + current_user + '&password=' + current_pass, true);
|
||||
const current_user = document.getElementById('user').value;
|
||||
const current_pass = document.getElementById('pass').value;
|
||||
const current_host = document.getElementById('host').value;
|
||||
const current_port = document.getElementById('port').value;
|
||||
let current_scheme = 'http';
|
||||
if (document.getElementById('ssl').checked) {
|
||||
current_scheme += 's';
|
||||
}
|
||||
const url = current_scheme + '://' + current_host + ':' + current_port + '?username=' + current_user + '&password=' + current_pass
|
||||
console.debug('connecting to', url);
|
||||
xhr.open('POST', url, true);
|
||||
xhr.setRequestHeader('Content-Type', 'application/json');
|
||||
data = {
|
||||
sessionId: uuid,
|
||||
@@ -106,6 +116,8 @@ function abort() {
|
||||
window.addEventListener('load', () => {
|
||||
document.getElementById('user').value = user;
|
||||
document.getElementById('pass').value = pass;
|
||||
document.getElementById('host').value = host;
|
||||
document.getElementById('port').value = port;
|
||||
document.getElementById('phone').addEventListener('keyup', (e) => {
|
||||
if (e.keyCode == '13') {
|
||||
document.getElementById('input').value = '';
|
||||
|
||||
@@ -1,49 +1,21 @@
|
||||
cic_base[full-graph]~=0.1.1a17
|
||||
alembic==1.4.2
|
||||
amqp==2.6.1
|
||||
attrs==20.2.0
|
||||
bcrypt==3.2.0
|
||||
betterpath==0.2.2
|
||||
billiard==3.6.3.0
|
||||
celery==4.4.7
|
||||
cffi==1.14.3
|
||||
chainlib~=0.0.1a15
|
||||
cic-eth==0.10.0a39
|
||||
cic-notify==0.3.1
|
||||
chainlib~=0.0.1a20
|
||||
cic-eth~=0.10.0a40
|
||||
cic-notify~=0.4.0a2
|
||||
cic-types==0.1.0a8
|
||||
click==7.1.2
|
||||
confini==0.3.5
|
||||
confini~=0.3.6rc3
|
||||
cryptography==3.2.1
|
||||
faker==4.17.1
|
||||
iniconfig==1.1.1
|
||||
kombu==4.6.11
|
||||
Mako==1.1.3
|
||||
MarkupSafe==1.1.1
|
||||
mirakuru==2.3.0
|
||||
more-itertools==8.5.0
|
||||
packaging==20.4
|
||||
phonenumbers==8.12.12
|
||||
pluggy==0.13.1
|
||||
port-for==0.4
|
||||
psutil==5.7.3
|
||||
psycopg2==2.8.6
|
||||
py==1.9.0
|
||||
pycparser==2.20
|
||||
pyparsing==2.4.7
|
||||
python-dateutil==2.8.1
|
||||
python-editor==1.0.4
|
||||
python-gnupg==0.4.6
|
||||
python-i18n==0.3.9
|
||||
pytz==2020.1
|
||||
PyYAML==5.3.1
|
||||
redis==3.5.3
|
||||
requests==2.24.0
|
||||
semver==2.13.0
|
||||
six==1.15.0
|
||||
SQLAlchemy==1.3.20
|
||||
tinydb==4.2.0
|
||||
toml==0.10.1
|
||||
transitions==0.8.4
|
||||
uWSGI==2.0.19.1
|
||||
vcversioner==2.16.0.0
|
||||
vine==1.3.0
|
||||
zope.interface==5.1.2
|
||||
|
||||
@@ -44,4 +44,5 @@ scripts =
|
||||
|
||||
[options.entry_points]
|
||||
console_scripts =
|
||||
cic-ussd-tasker = cic_ussd.runnable.tasker:main
|
||||
cic-ussd-tasker = cic_ussd.runnable.tasker:main
|
||||
cic-ussd-client = cic_ussd.runnable.client:main
|
||||
|
||||
Reference in New Issue
Block a user