diff --git a/changelog.txt b/changelog.txt index 6267d2e..66069be 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,8 @@ +Version 0.1.5 (2017-02-nn) +- UI improvements +- Added git init +- Added check_config API for HASS + Version 0.1.4 (2017-02-20) - UI improvements - Switch and create git branches diff --git a/configurator.py b/configurator.py index 2393f52..966daf3 100755 --- a/configurator.py +++ b/configurator.py @@ -21,7 +21,7 @@ from urllib.parse import urlparse, parse_qs, unquote ### Some options for you to change LISTENIP = "0.0.0.0" LISTENPORT = 3218 -# Set BASEPATH to something like "/home/hass/.homeasssitant" if you're not running the configurator from that path +# Set BASEPATH to something like "/home/hass/.homeassistant/" if you're not running the configurator from that path BASEPATH = None # Set the paths to a certificate and the key if you're using SSL, e.g "/etc/ssl/certs/mycert.pem" SSL_CERTIFICATE = None @@ -2541,6 +2541,26 @@ class RequestHandler(BaseHTTPRequestHandler): res['restart'] = str(err) self.wfile.write(bytes(json.dumps(res), "utf8")) return + elif req.path == '/api/check_config': + print("/api/check_config") + self.send_header('Content-type', 'text/json') + self.end_headers() + res = {"check_config": False} + try: + headers = { + "Content-Type": "application/json" + } + if HASS_API_PASSWORD: + headers["x-ha-access"] = HASS_API_PASSWORD + req = urllib.request.Request("%sservices/homeassistant/check_config" % HASS_API, headers=headers, method='POST') + with urllib.request.urlopen(req) as response: + res = json.loads(response.read().decode('utf-8')) + print(res) + except Exception as err: + print(err) + res['restart'] = str(err) + self.wfile.write(bytes(json.dumps(res), "utf8")) + return elif req.path == '/': self.send_header('Content-type', 'text/html') self.end_headers() @@ -2815,6 +2835,37 @@ class RequestHandler(BaseHTTPRequestHandler): print("Exception (no repo): %s" % str(err)) else: response['message'] = "Missing path or branch" + elif req.path == '/api/init': + try: + postvars = parse_qs(self.rfile.read(length).decode('utf-8'), keep_blank_values=1) + except Exception as err: + print(err) + response['message'] = "%s" % (str(err)) + postvars = {} + if 'path' in postvars.keys(): + if postvars['path']: + try: + repopath = unquote(postvars['path'][0]) + response['path'] = repopath + try: + repo = REPO.init(repopath) + response['error'] = False + response['message'] = "Initialized repository in %s" % repopath + self.send_response(200) + self.send_header('Content-type', 'text/json') + self.end_headers() + self.wfile.write(bytes(json.dumps(response), "utf8")) + return + except Exception as err: + response['error'] = True + response['message'] = str(err) + print(response) + + except Exception as err: + response['message'] = "Not a git repository: %s" % (str(err)) + print("Exception (no repo): %s" % str(err)) + else: + response['message'] = "Missing path or branch" elif req.path == '/api/newfolder': try: postvars = parse_qs(self.rfile.read(length).decode('utf-8'), keep_blank_values=1) diff --git a/dev.html b/dev.html index dd535b1..d37217e 100644 --- a/dev.html +++ b/dev.html @@ -25,12 +25,15 @@ top: 135px; right: 0; bottom: 0; - } + } @media only screen and (max-width: 600px) { #editor { top: 125px; } + .toolbar_mobile { + margin-bottom: 0; + } } .leftellipsis { @@ -52,14 +55,27 @@ display: block; cursor: initial; pointer-events: none; - color: #616161 !important; + color: #424242 !important; font-weight: 400; font-size: .9em; + min-height: 64px; + padding-top: 8px; + margin-left: -5px; + max-width: 250px; } #fbheaderbranch { - padding: 5px 18px !important; + padding: 5px 10px !important; display: none; + color: #757575 !important; + } + + #branchselector { + font-weight: 400; + } + + a.branch_select.active { + color: white !important; } #fbelements { @@ -85,15 +101,6 @@ padding-left: 20px !important; } - #newbranchbutton { - color: #616161 !important; - display: none; - float: right; - min-height: 48px; - padding-top: 0 !important; - padding-left: 15px !important; - } - .filename { color: #616161 !important; font-weight: 400; @@ -132,17 +139,18 @@ } input.currentfile_input { - margin-bottom: -1px; - margin-top: 0; - padding-left: 5px; + margin-bottom: 0; + margin-top: 0; + padding-left: 5px; + border-bottom: 0; } .side_tools { - vertical-align: middle; + vertical-align: middle; } .fbtoolbarbutton_icon { - margin-top: 20px; + margin-top: 20px; } .collection { @@ -177,7 +185,7 @@ } #dropdown_menu, #dropdown_menu_mobile { - min-width: 180px; + min-width: 235px; } #dropdown_gitmenu { @@ -252,7 +260,10 @@ } .shadow { - height: 36px; + height: 25px; + margin: -26px; + min-width: 320px; + background-color: transparent; } .ace_optionsMenuEntry input { @@ -375,14 +386,47 @@ .fbmenuicon_pad { min-height: 64px; margin-top: 8px !important; + margin-right: 18px !important; + color: #616161 !important; } .no-padding { - padding:0 !important; + padding: 0 !important; } .branch_select { - min-width: 320px !important; + min-width: 300px !important; + font-size: 14px !important; + font-weight: 400 !important; + } + + a.branch_hover:hover { + background-color: #e0e0e0 !important; + } + + .hidesave { + opacity: 0; + -webkit-transition: all 0.5s ease-in-out; + -moz-transition: all 0.5s ease-in-out; + -ms-transition: all 0.5s ease-in-out; + -o-transition: all 0.5s ease-in-out; + transition: all 0.5s ease-in-out; + } + + .pathtip_color { + -webkit-animation: fadeinout 1.75s linear 1 forwards; + animation: fadeinout 1.75s linear 1 forwards; + } + + @-webkit-keyframes fadeinout { + 0% { background-color: #f5f5f5; } + 50% { background-color: #ff8a80; } + 100% { background-color: #f5f5f5; } + } + @keyframes fadeinout { + 0% { background-color: #f5f5f5; } + 50% { background-color: #ff8a80; } + 100% { background-color: #f5f5f5; } } @@ -444,15 +488,15 @@