search-api-webui 0.1.0__py3-none-any.whl → 0.1.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- backend/app.py +31 -13
- {search_api_webui-0.1.0.dist-info → search_api_webui-0.1.1.dist-info}/METADATA +1 -1
- {search_api_webui-0.1.0.dist-info → search_api_webui-0.1.1.dist-info}/RECORD +6 -6
- {search_api_webui-0.1.0.dist-info → search_api_webui-0.1.1.dist-info}/WHEEL +0 -0
- {search_api_webui-0.1.0.dist-info → search_api_webui-0.1.1.dist-info}/entry_points.txt +0 -0
- {search_api_webui-0.1.0.dist-info → search_api_webui-0.1.1.dist-info}/licenses/LICENSE +0 -0
backend/app.py
CHANGED
|
@@ -4,27 +4,41 @@ from flask import Flask, request, jsonify, send_from_directory
|
|
|
4
4
|
from flask_cors import CORS
|
|
5
5
|
from backend.providers import load_providers
|
|
6
6
|
|
|
7
|
+
CURRENT_DIR = Path(__file__).resolve().parent
|
|
8
|
+
STATIC_FOLDER = CURRENT_DIR / 'static'
|
|
9
|
+
|
|
7
10
|
app = Flask(__name__, static_folder='static')
|
|
8
11
|
CORS(app)
|
|
9
12
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
USER_CONFIG_JSON =
|
|
13
|
+
PROVIDERS_YAML = CURRENT_DIR / 'providers.yaml'
|
|
14
|
+
USER_CONFIG_DIR = Path.home() / '.search-api-webui'
|
|
15
|
+
USER_CONFIG_JSON = USER_CONFIG_DIR / 'config.json'
|
|
16
|
+
|
|
17
|
+
if not USER_CONFIG_DIR.exists():
|
|
18
|
+
USER_CONFIG_DIR.mkdir(parents=True, exist_ok=True)
|
|
13
19
|
|
|
14
|
-
|
|
20
|
+
if PROVIDERS_YAML.exists():
|
|
21
|
+
provider_map = load_providers(str(PROVIDERS_YAML))
|
|
22
|
+
else:
|
|
23
|
+
print(f"Error: Configuration file not found at {PROVIDERS_YAML}")
|
|
24
|
+
provider_map = {}
|
|
15
25
|
|
|
16
26
|
def get_stored_config():
|
|
17
|
-
if not
|
|
27
|
+
if not USER_CONFIG_JSON.exists():
|
|
18
28
|
return {}
|
|
19
29
|
try:
|
|
20
|
-
with open(USER_CONFIG_JSON, 'r') as f:
|
|
30
|
+
with open(USER_CONFIG_JSON, 'r', encoding='utf-8') as f:
|
|
21
31
|
return json.load(f)
|
|
22
|
-
except:
|
|
32
|
+
except Exception as e:
|
|
33
|
+
print(f"Error reading config: {e}")
|
|
23
34
|
return {}
|
|
24
35
|
|
|
25
36
|
def save_stored_config(config_dict):
|
|
26
|
-
|
|
27
|
-
|
|
37
|
+
try:
|
|
38
|
+
with open(USER_CONFIG_JSON, 'w', encoding='utf-8') as f:
|
|
39
|
+
json.dump(config_dict, f, indent=2)
|
|
40
|
+
except Exception as e:
|
|
41
|
+
print(f"Error saving config: {e}")
|
|
28
42
|
|
|
29
43
|
@app.route('/api/providers', methods=['GET'])
|
|
30
44
|
def get_providers_list():
|
|
@@ -127,10 +141,10 @@ def search_api():
|
|
|
127
141
|
@app.route('/', defaults={'path': ''})
|
|
128
142
|
@app.route('/<path:path>')
|
|
129
143
|
def serve(path):
|
|
130
|
-
if path != "" and
|
|
131
|
-
return send_from_directory(
|
|
144
|
+
if path != "" and (STATIC_FOLDER / path).exists():
|
|
145
|
+
return send_from_directory(str(STATIC_FOLDER), path)
|
|
132
146
|
else:
|
|
133
|
-
return send_from_directory(
|
|
147
|
+
return send_from_directory(str(STATIC_FOLDER), 'index.html')
|
|
134
148
|
|
|
135
149
|
def main():
|
|
136
150
|
import argparse
|
|
@@ -138,7 +152,11 @@ def main():
|
|
|
138
152
|
parser.add_argument("--port", type=int, default=8889, help="Port to run the server on")
|
|
139
153
|
parser.add_argument("--host", type=str, default="0.0.0.0", help="Host to run the server on")
|
|
140
154
|
args = parser.parse_args()
|
|
141
|
-
|
|
155
|
+
|
|
156
|
+
print(f"Starting Search API WebUI...")
|
|
157
|
+
print(f" - Config Storage: {USER_CONFIG_JSON}")
|
|
158
|
+
print(f" - Serving on: http://{args.host}:{args.port}")
|
|
159
|
+
|
|
142
160
|
app.run(host=args.host, port=args.port)
|
|
143
161
|
|
|
144
162
|
if __name__ == "__main__":
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: search-api-webui
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.1
|
|
4
4
|
Summary: A Search API WebUI for Querit, You, and other search providers.
|
|
5
5
|
Project-URL: Homepage, https://github.com/querit-ai/search-api-webui
|
|
6
6
|
Project-URL: Repository, https://github.com/querit-ai/search-api-webui.git
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
backend/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
backend/app.py,sha256=
|
|
2
|
+
backend/app.py,sha256=6sKid3996ydT19Q04Eg0RY23PEJb0TIGWz_FRIxCDI8,5119
|
|
3
3
|
backend/providers/__init__.py,sha256=l9SCd9sEISWZB-E2Co8ds2hILaxBVoh2S6SSg7MXXIo,1072
|
|
4
4
|
backend/providers/base.py,sha256=_iYcxCxI7VCoxb02D71KqtojAU91D6rc3c5dwKNYJ2o,863
|
|
5
5
|
backend/providers/generic.py,sha256=3dyx3Hpbo4hlfUcwy1wYt5N5dc2X3fK1iFnOoT3m_Vc,4440
|
|
@@ -8,8 +8,8 @@ backend/providers.yaml,sha256=2aRmfT7NmeU9IfUqX7phRjOf_fUACRD5ondYJO2HH4I,400
|
|
|
8
8
|
backend/static/index.html,sha256=fhLWDY2W-bN-bBq2fmkch-e6gRZpoyqbKvNBzpWHiHk,401
|
|
9
9
|
backend/static/assets/index-CF13bI2g.js,sha256=91wc8meWvRXloy4vzmGN43DvrpHIjMVIdCihXCw9zBU,208926
|
|
10
10
|
backend/static/assets/index-DLyBd1PD.css,sha256=nevUEbN7Fw9cq3aXWV7v_tQpD00d7kr3I64dgZ-e7ys,17914
|
|
11
|
-
search_api_webui-0.1.
|
|
12
|
-
search_api_webui-0.1.
|
|
13
|
-
search_api_webui-0.1.
|
|
14
|
-
search_api_webui-0.1.
|
|
15
|
-
search_api_webui-0.1.
|
|
11
|
+
search_api_webui-0.1.1.dist-info/METADATA,sha256=b1YR8TsTbezT2uXKEYQFFcjA4aPqK9OFEBreHoIFiO8,2577
|
|
12
|
+
search_api_webui-0.1.1.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
13
|
+
search_api_webui-0.1.1.dist-info/entry_points.txt,sha256=D9R5N6s2Bt8rEKYSINTUB1f45nH-Xc5iIKNPfYYc8ec,54
|
|
14
|
+
search_api_webui-0.1.1.dist-info/licenses/LICENSE,sha256=jHhlLwtvhZRz1yU1G_3cjsPigCTXQGT1qshhyekdmTE,1061
|
|
15
|
+
search_api_webui-0.1.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|