summaryrefslogtreecommitdiff
path: root/lib/api
diff options
context:
space:
mode:
authorLex Neva <github.com@lexneva.name>2023-08-15 23:00:48 -0400
committerLex Neva <github.com@lexneva.name>2023-08-15 23:00:48 -0400
commit09812b1e9e064778868a5019bbdd9580562b86f6 (patch)
treebd7cbd2f70d33c0b4d743937c1bf46f3d027ebd2 /lib/api
parente35cacc5ccd4830c82def2f6f4797bf971191a95 (diff)
remove electron Preferences
Diffstat (limited to 'lib/api')
-rw-r--r--lib/api/preferences.py41
-rw-r--r--lib/api/server.py2
2 files changed, 0 insertions, 43 deletions
diff --git a/lib/api/preferences.py b/lib/api/preferences.py
deleted file mode 100644
index bc8328b8..00000000
--- a/lib/api/preferences.py
+++ /dev/null
@@ -1,41 +0,0 @@
-# Authors: see git history
-#
-# Copyright (c) 2010 Authors
-# Licensed under the GNU GPL version 3.0 or later. See the file LICENSE for details.
-
-from flask import Blueprint, g, jsonify, request
-
-from ..utils.cache import get_stitch_plan_cache
-from ..utils.settings import global_settings
-
-preferences = Blueprint('preferences', __name__)
-
-
-@preferences.route('/', methods=["POST"])
-def update_preferences():
- metadata = g.extension.get_inkstitch_metadata()
- metadata.update(request.json['this_svg_settings'])
- global_settings.update(request.json['global_settings'])
-
- # cache size may have changed
- stitch_plan_cache = get_stitch_plan_cache()
- stitch_plan_cache.size_limit = global_settings['cache_size'] * 1024 * 1024
- stitch_plan_cache.cull()
-
- return jsonify({"status": "success"})
-
-
-@preferences.route('/', methods=["GET"])
-def get_preferences():
- metadata = g.extension.get_inkstitch_metadata()
- return jsonify({"status": "success",
- "this_svg_settings": metadata,
- "global_settings": global_settings
- })
-
-
-@preferences.route('/clear_cache', methods=["POST"])
-def clear_cache():
- stitch_plan_cache = get_stitch_plan_cache()
- stitch_plan_cache.clear(retry=True)
- return jsonify({"status": "success"})
diff --git a/lib/api/server.py b/lib/api/server.py
index 26efa521..5625d77d 100644
--- a/lib/api/server.py
+++ b/lib/api/server.py
@@ -18,7 +18,6 @@ from werkzeug.serving import make_server
from ..utils.json import InkStitchJSONProvider
from .simulator import simulator
from .stitch_plan import stitch_plan
-from .preferences import preferences
from .page_specs import page_specs
from .lang import languages
# this for electron axios
@@ -50,7 +49,6 @@ class APIServer(Thread):
self.app.register_blueprint(simulator, url_prefix="/simulator")
self.app.register_blueprint(stitch_plan, url_prefix="/stitch_plan")
- self.app.register_blueprint(preferences, url_prefix="/preferences")
self.app.register_blueprint(page_specs, url_prefix="/page_specs")
self.app.register_blueprint(languages, url_prefix="/languages")