diff options
| author | Lex Neva <github.com@lexneva.name> | 2020-08-19 21:16:13 -0400 |
|---|---|---|
| committer | Lex Neva <github.com@lexneva.name> | 2020-08-19 21:16:13 -0400 |
| commit | e1fdc254d6b362440d5e2895b33a2d4865e73e50 (patch) | |
| tree | 57f565114ad441e9abf1ad74c97724e6c28245ef /lib/api | |
| parent | 69f931f0330c448911221752a226f612acb08713 (diff) | |
implement install extension in electron/vuetify
Diffstat (limited to 'lib/api')
| -rw-r--r-- | lib/api/install.py | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/lib/api/install.py b/lib/api/install.py index f379f142..20138973 100644 --- a/lib/api/install.py +++ b/lib/api/install.py @@ -2,19 +2,24 @@ import os import sys from glob import glob -from flask import Blueprint, request +from flask import Blueprint, jsonify, request from ..utils import get_bundled_dir, guess_inkscape_config_path install = Blueprint('install', __name__) -@install.route('/palettes') +@install.route('/palettes', methods=["POST"]) def palettes(): - base_path = request.json.get('path') or guess_inkscape_config_path() - path = os.path.join(base_path, 'palettes') - src_dir = get_bundled_dir('palettes') - copy_files(glob(os.path.join(src_dir, "*")), path) + try: + base_path = request.json.get('path') or guess_inkscape_config_path() + path = os.path.join(base_path, 'palettes') + src_dir = get_bundled_dir('palettes') + copy_files(glob(os.path.join(src_dir, "*")), path) + except Exception, exc: + return jsonify({"error": str(exc)}), 500 + + return jsonify({"status": "success"}) if sys.platform == "win32": |
