mindroot 9.2.0__py3-none-any.whl → 9.5.0__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.
- mindroot/coreplugins/admin/__init__.py +3 -1
- mindroot/coreplugins/admin/agent_router.py +250 -7
- mindroot/coreplugins/admin/asset_manager.py +164 -0
- mindroot/coreplugins/admin/command_router.py +236 -1
- mindroot/coreplugins/admin/mcp_catalog_routes.py +156 -0
- mindroot/coreplugins/admin/mcp_publish_routes.py +450 -0
- mindroot/coreplugins/admin/mcp_registry_routes.py +495 -0
- mindroot/coreplugins/admin/mcp_routes.py +216 -0
- mindroot/coreplugins/admin/mod.py +62 -0
- mindroot/coreplugins/admin/oauth_callback_router.py +84 -0
- mindroot/coreplugins/admin/persona_handler.py +15 -6
- mindroot/coreplugins/admin/persona_router.py +158 -2
- mindroot/coreplugins/admin/plugin_manager.py +63 -0
- mindroot/coreplugins/admin/plugin_router.py +1 -1
- mindroot/coreplugins/admin/plugin_router_fixed.py +23 -0
- mindroot/coreplugins/admin/plugin_router_new_not_working.py +145 -0
- mindroot/coreplugins/admin/plugin_routes.py +114 -0
- mindroot/coreplugins/admin/registry_settings_routes.py +140 -0
- mindroot/coreplugins/admin/router.py +116 -15
- mindroot/coreplugins/admin/service_models.py +1 -1
- mindroot/coreplugins/admin/settings_router.py +1 -0
- mindroot/coreplugins/admin/static/css/admin-custom.css +357 -2
- mindroot/coreplugins/admin/static/css/dark.css +1 -0
- mindroot/coreplugins/admin/static/css/default.css +4 -0
- mindroot/coreplugins/admin/static/js/about-info.js +367 -0
- mindroot/coreplugins/admin/static/js/agent-form.js +83 -3
- mindroot/coreplugins/admin/static/js/api-key-script.js +307 -0
- mindroot/coreplugins/admin/static/js/mcp-manager.js +348 -0
- mindroot/coreplugins/admin/static/js/mcp-publisher.js +780 -0
- mindroot/coreplugins/admin/static/js/persona-editor.js +34 -5
- mindroot/coreplugins/admin/static/js/plugin-toggle.js +1 -1
- mindroot/coreplugins/admin/static/js/recommended-plugin-install.js +63 -0
- mindroot/coreplugins/admin/static/js/registry-auth-section.js +132 -0
- mindroot/coreplugins/admin/static/js/registry-manager-base.js +613 -0
- mindroot/coreplugins/admin/static/js/registry-manager-old.js +385 -0
- mindroot/coreplugins/admin/static/js/registry-manager-publish-old-delete.js +166 -0
- mindroot/coreplugins/admin/static/js/registry-manager.js +351 -0
- mindroot/coreplugins/admin/static/js/registry-publish-section.js +377 -0
- mindroot/coreplugins/admin/static/js/registry-search-section.js +400 -0
- mindroot/coreplugins/admin/static/js/registry-search-section.js.bak +3 -0
- mindroot/coreplugins/admin/static/js/registry-settings.js +69 -0
- mindroot/coreplugins/admin/static/js/registry-shared-services.js +857 -0
- mindroot/coreplugins/admin/static/js/registry-simple-sections.js +85 -0
- mindroot/coreplugins/admin/static/js/secure-widget-manager.js +438 -0
- mindroot/coreplugins/admin/static/logo.png +0 -0
- mindroot/coreplugins/admin/templates/admin.jinja2 +275 -110
- mindroot/coreplugins/agent/Assistant/agent.json +27 -11
- mindroot/coreplugins/agent/agent.py +2 -2
- mindroot/coreplugins/agent/command_parser.py +25 -10
- mindroot/coreplugins/agent/templates/system.jinja2 +0 -12
- mindroot/coreplugins/chat/__init__.py +4 -1
- mindroot/coreplugins/chat/router.py +132 -20
- mindroot/coreplugins/chat/router_dedup_patch.py +20 -0
- mindroot/coreplugins/chat/services.py +31 -1
- mindroot/coreplugins/chat/static/css/action-fix.css +32 -0
- mindroot/coreplugins/chat/static/css/admin-custom.css +5 -3
- mindroot/coreplugins/chat/static/css/dark.css +24 -3
- mindroot/coreplugins/chat/static/css/default.css +24 -3
- mindroot/coreplugins/chat/static/css/main.css +1 -0
- mindroot/coreplugins/chat/static/js/action.js +137 -60
- mindroot/coreplugins/chat/static/js/chat-history.js +3 -0
- mindroot/coreplugins/chat/static/js/chat.js +59 -16
- mindroot/coreplugins/chat/static/js/chat.js.diff +221 -0
- mindroot/coreplugins/chat/static/js/chatform.js +2 -2
- mindroot/coreplugins/chat/static/site.webmanifest +1 -1
- mindroot/coreplugins/chat/templates/chat.jinja2 +3 -3
- mindroot/coreplugins/chat/widget_manager.py +139 -0
- mindroot/coreplugins/chat/widget_routes.py +287 -0
- mindroot/coreplugins/check_list/inject/admin.jinja2 +1 -1
- mindroot/coreplugins/email/__init__.py +2 -0
- mindroot/coreplugins/email/email_provider.py +2 -2
- mindroot/coreplugins/email/mod.py +100 -0
- mindroot/coreplugins/email/services.py +5 -3
- mindroot/coreplugins/email/smtp_handler.py +9 -3
- mindroot/coreplugins/email/test_email_service.py +75 -0
- mindroot/coreplugins/env_manager/mod.py +61 -25
- mindroot/coreplugins/home/router.py +37 -2
- mindroot/coreplugins/home/static/imgs/logo.png +0 -0
- mindroot/coreplugins/home/static/imgs/logo.png.bak +0 -0
- mindroot/coreplugins/home/static/imgs/logo_teal.png +0 -0
- mindroot/coreplugins/home/static/imgs/logo_teal2.png +0 -0
- mindroot/coreplugins/home/static/imgs/logo_teal_detailed.png +0 -0
- mindroot/coreplugins/home/static/imgs/logo_teal_python.png +0 -0
- mindroot/coreplugins/home/templates/home.jinja2 +15 -6
- mindroot/coreplugins/index/handlers/plugin_ops.py +1 -1
- mindroot/coreplugins/index/indices/default/index.json +6 -6
- mindroot/coreplugins/jwt_auth/middleware.py +47 -1
- mindroot/coreplugins/jwt_auth/mod.py +40 -17
- mindroot/coreplugins/l8n/__init__.py +6 -0
- mindroot/coreplugins/l8n/debug_loader.py +85 -0
- mindroot/coreplugins/l8n/debug_middleware.py +74 -0
- mindroot/coreplugins/l8n/l8n_constants.py +19 -0
- mindroot/coreplugins/l8n/language_detection.py +183 -0
- mindroot/coreplugins/l8n/middleware.py +151 -0
- mindroot/coreplugins/l8n/mod.py +277 -0
- mindroot/coreplugins/l8n/monkey_patch_to_delete.py +186 -0
- mindroot/coreplugins/l8n/test_enhanced.py +298 -0
- mindroot/coreplugins/l8n/test_l8n.py +95 -0
- mindroot/coreplugins/l8n/test_l8n_standalone.py +251 -0
- mindroot/coreplugins/l8n/test_middleware.py +272 -0
- mindroot/coreplugins/l8n/utils.py +232 -0
- mindroot/coreplugins/mcp_/__init__.py +14 -0
- mindroot/coreplugins/mcp_/catalog_commands.py +328 -0
- mindroot/coreplugins/mcp_/catalog_manager.py +263 -0
- mindroot/coreplugins/mcp_/dynamic_commands.py +154 -0
- mindroot/coreplugins/mcp_/mcp_manager.py +1031 -0
- mindroot/coreplugins/mcp_/mod.py +367 -0
- mindroot/coreplugins/mcp_/oauth_storage.py +144 -0
- mindroot/coreplugins/mcp_/server_installer.py +79 -0
- mindroot/coreplugins/mcp_/setup.py +26 -0
- mindroot/coreplugins/mcp_/test_dynamic_commands.py +134 -0
- mindroot/coreplugins/mcp_/testmcpclient.py +92 -0
- mindroot/coreplugins/persona/mod.py +12 -7
- mindroot/coreplugins/signup/templates/signup.jinja2 +1 -1
- mindroot/coreplugins/subscriptions/__init__.py +1 -0
- mindroot/coreplugins/subscriptions/mod.py +14 -3
- mindroot/coreplugins/subscriptions/router.py +3 -0
- mindroot/coreplugins/user_service/__init__.py +1 -2
- mindroot/coreplugins/user_service/admin_init.py +1 -0
- mindroot/coreplugins/user_service/email_service.py +72 -17
- mindroot/coreplugins/user_service/mod.py +10 -2
- mindroot/coreplugins/user_service/password_reset_service.py +180 -27
- mindroot/coreplugins/user_service/router.py +84 -22
- mindroot/lib/auth/api_key.py +28 -0
- mindroot/lib/cli/plugins.py +94 -0
- mindroot/lib/plugins/default_plugin_manifest.json +20 -0
- mindroot/lib/plugins/installation.py +5 -5
- mindroot/lib/plugins/l8n_static_handler.py +225 -0
- mindroot/lib/plugins/loader.py +33 -3
- mindroot/lib/plugins/loader_with_l8n.py +281 -0
- mindroot/lib/plugins/manifest.py +238 -17
- mindroot/lib/providers/commands.py +3 -1
- mindroot/lib/route_decorators.py +5 -5
- mindroot/lib/templates.py +183 -11
- mindroot/lib/utils/merge_arrays.py +1 -1
- mindroot/migrate.py +49 -0
- mindroot/registry/data_access.py +1 -1
- mindroot/server.py +47 -13
- mindroot/server_missing_normal_args.py +197 -0
- mindroot/server_prev.py +173 -0
- {mindroot-9.2.0.dist-info → mindroot-9.5.0.dist-info}/METADATA +7 -2
- {mindroot-9.2.0.dist-info → mindroot-9.5.0.dist-info}/RECORD +147 -114
- mindroot/coreplugins/admin/static/favicon/about.txt +0 -6
- mindroot/coreplugins/admin/static/favicon/android-chrome-512x512.png +0 -0
- mindroot/coreplugins/admin/static/favicon/apple-touch-icon.png +0 -0
- mindroot/coreplugins/admin/static/favicon/favicon-16x16.png +0 -0
- mindroot/coreplugins/admin/static/favicon/favicon-32x32.png +0 -0
- mindroot/coreplugins/admin/static/favicon/favicon.ico +0 -0
- mindroot/coreplugins/admin/static/favicon/favicon_io (1)/about.txt +0 -6
- mindroot/coreplugins/admin/static/favicon/favicon_io (1)/android-chrome-192x192.png +0 -0
- mindroot/coreplugins/admin/static/favicon/favicon_io (1)/android-chrome-512x512.png +0 -0
- mindroot/coreplugins/admin/static/favicon/favicon_io (1)/apple-touch-icon.png +0 -0
- mindroot/coreplugins/admin/static/favicon/favicon_io (1)/favicon-16x16.png +0 -0
- mindroot/coreplugins/admin/static/favicon/favicon_io (1)/favicon-32x32.png +0 -0
- mindroot/coreplugins/admin/static/favicon/favicon_io (1)/favicon.ico +0 -0
- mindroot/coreplugins/admin/static/favicon/favicon_io (1)/site.webmanifest +0 -1
- mindroot/coreplugins/admin/static/favicon/logo.png +0 -0
- mindroot/coreplugins/admin/static/favicon/site.webmanifest +0 -1
- mindroot/coreplugins/admin/static/js/backup/agent-editor.js +0 -186
- mindroot/coreplugins/admin/static/js/backup/agent-form.js +0 -1133
- mindroot/coreplugins/admin/static/js/backup/agent-list.js +0 -94
- mindroot/coreplugins/chat/static/favicon/about.txt +0 -6
- mindroot/coreplugins/chat/static/favicon/android-chrome-192x192.png +0 -0
- mindroot/coreplugins/chat/static/favicon/android-chrome-512x512.png +0 -0
- mindroot/coreplugins/chat/static/favicon/apple-touch-icon.png +0 -0
- mindroot/coreplugins/chat/static/favicon/favicon-16x16.png +0 -0
- mindroot/coreplugins/chat/static/favicon/favicon-32x32.png +0 -0
- mindroot/coreplugins/chat/static/favicon/favicon.ico +0 -0
- mindroot/coreplugins/chat/static/favicon/favicon_io (1)/about.txt +0 -6
- mindroot/coreplugins/chat/static/favicon/favicon_io (1)/android-chrome-192x192.png +0 -0
- mindroot/coreplugins/chat/static/favicon/favicon_io (1)/android-chrome-512x512.png +0 -0
- mindroot/coreplugins/chat/static/favicon/favicon_io (1)/apple-touch-icon.png +0 -0
- mindroot/coreplugins/chat/static/favicon/favicon_io (1)/favicon-16x16.png +0 -0
- mindroot/coreplugins/chat/static/favicon/favicon_io (1)/favicon-32x32.png +0 -0
- mindroot/coreplugins/chat/static/favicon/favicon_io (1)/favicon.ico +0 -0
- mindroot/coreplugins/chat/static/favicon/favicon_io (1)/site.webmanifest +0 -1
- mindroot/coreplugins/chat/static/favicon/logo.png +0 -0
- mindroot/coreplugins/chat/static/favicon/site.webmanifest +0 -1
- mindroot/coreplugins/index/default.json +0 -76
- mindroot/coreplugins/user_service/file_trigger_service.py +0 -72
- mindroot/coreplugins/user_service/hooks.py +0 -23
- /mindroot/coreplugins/{admin/static/favicon/android-chrome-192x192.png → home/static/imgs/backuplogo.png} +0 -0
- {mindroot-9.2.0.dist-info → mindroot-9.5.0.dist-info}/WHEEL +0 -0
- {mindroot-9.2.0.dist-info → mindroot-9.5.0.dist-info}/entry_points.txt +0 -0
- {mindroot-9.2.0.dist-info → mindroot-9.5.0.dist-info}/licenses/LICENSE +0 -0
- {mindroot-9.2.0.dist-info → mindroot-9.5.0.dist-info}/top_level.txt +0 -0
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import { LitElement, html, css } from './lit-core.min.js';
|
|
2
|
-
import { BaseEl } from './base.js';
|
|
3
|
-
|
|
4
|
-
class AgentList extends BaseEl {
|
|
5
|
-
static properties = {
|
|
6
|
-
agents: { type: Array },
|
|
7
|
-
selectedAgent: { type: Object }
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
static styles = css`
|
|
11
|
-
:host {
|
|
12
|
-
display: block;
|
|
13
|
-
margin-bottom: 20px;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
.agent-selector {
|
|
17
|
-
display: flex;
|
|
18
|
-
gap: 10px;
|
|
19
|
-
align-items: center;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
select {
|
|
23
|
-
flex: 1;
|
|
24
|
-
padding: 8px;
|
|
25
|
-
background: rgba(255, 255, 255, 0.05);
|
|
26
|
-
border: 1px solid rgba(255, 255, 255, 0.1);
|
|
27
|
-
border-radius: 4px;
|
|
28
|
-
color: #f0f0f0;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
.btn {
|
|
32
|
-
padding: 8px 16px;
|
|
33
|
-
border: 1px solid rgba(255, 255, 255, 0.2);
|
|
34
|
-
border-radius: 4px;
|
|
35
|
-
background: rgba(255, 255, 255, 0.05);
|
|
36
|
-
color: #f0f0f0;
|
|
37
|
-
cursor: pointer;
|
|
38
|
-
transition: all 0.2s;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
.btn:hover {
|
|
42
|
-
background: rgba(255, 255, 255, 0.1);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
.btn-secondary {
|
|
46
|
-
border-color: #2196F3;
|
|
47
|
-
color: #2196F3;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
.btn-secondary:hover {
|
|
51
|
-
background: rgba(33, 150, 243, 0.1);
|
|
52
|
-
}
|
|
53
|
-
`;
|
|
54
|
-
|
|
55
|
-
async handleAgentChange(event) {
|
|
56
|
-
if (event.target.value) {
|
|
57
|
-
try {
|
|
58
|
-
const response = await fetch(`/agents/local/${event.target.value}`);
|
|
59
|
-
if (!response.ok) throw new Error('Failed to fetch agent');
|
|
60
|
-
const agent = await response.json();
|
|
61
|
-
this.dispatchEvent(new CustomEvent('agent-selected', {
|
|
62
|
-
detail: agent
|
|
63
|
-
}));
|
|
64
|
-
} catch (error) {
|
|
65
|
-
this.dispatchEvent(new CustomEvent('error', {
|
|
66
|
-
detail: `Error loading agent: ${error.message}`
|
|
67
|
-
}));
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
handleNewAgent() {
|
|
73
|
-
this.dispatchEvent(new CustomEvent('new-agent'));
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
_render() {
|
|
77
|
-
return html`
|
|
78
|
-
<div class="agent-selector">
|
|
79
|
-
<select @change=${this.handleAgentChange}
|
|
80
|
-
.value=${this.selectedAgent?.name || ''}>
|
|
81
|
-
<option value="">Select an agent</option>
|
|
82
|
-
${this.agents.map(agent => html`
|
|
83
|
-
<option value=${agent.name}>${agent.name}</option>
|
|
84
|
-
`)}
|
|
85
|
-
</select>
|
|
86
|
-
<button class="btn btn-secondary" @click=${this.handleNewAgent}>
|
|
87
|
-
New Agent
|
|
88
|
-
</button>
|
|
89
|
-
</div>
|
|
90
|
-
`;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
customElements.define('agent-list', AgentList);
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
This favicon was generated using the following font:
|
|
2
|
-
|
|
3
|
-
- Font Title: Major Mono Display
|
|
4
|
-
- Font Author: Copyright 2018 The Major Mono Project Authors (https://github.com/googlefonts/majormono)
|
|
5
|
-
- Font Source: https://fonts.gstatic.com/s/majormonodisplay/v16/RWmVoLyb5fEqtsfBX9PDZIGr2tFubRhLCn2QIndPww.ttf
|
|
6
|
-
- Font License: SIL Open Font License, 1.1 (http://scripts.sil.org/OFL))
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
This favicon was generated using the following font:
|
|
2
|
-
|
|
3
|
-
- Font Title: Major Mono Display
|
|
4
|
-
- Font Author: Copyright 2018 The Major Mono Project Authors (https://github.com/googlefonts/majormono)
|
|
5
|
-
- Font Source: https://fonts.gstatic.com/s/majormonodisplay/v16/RWmVoLyb5fEqtsfBX9PDZIGr2tFubRhLCn2QIndPww.ttf
|
|
6
|
-
- Font License: SIL Open Font License, 1.1 (http://scripts.sil.org/OFL))
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"name":"","short_name":"","icons":[{"src":"/android-chrome-192x192.png","sizes":"192x192","type":"image/png"},{"src":"/android-chrome-512x512.png","sizes":"512x512","type":"image/png"}],"theme_color":"#ffffff","background_color":"#ffffff","display":"standalone"}
|
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"name":"","short_name":"","icons":[{"src":"/android-chrome-192x192.png","sizes":"192x192","type":"image/png"},{"src":"/android-chrome-512x512.png","sizes":"512x512","type":"image/png"}],"theme_color":"#ffffff","background_color":"#ffffff","display":"standalone"}
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "default",
|
|
3
|
-
"description": "Default collection of commonly used plugins and agents",
|
|
4
|
-
"version": "1.0.0",
|
|
5
|
-
"url": "https://github.com/runvnc/xingen-index-default",
|
|
6
|
-
"trusted": true,
|
|
7
|
-
"created_at": "2024-02-23T10:00:00Z",
|
|
8
|
-
"plugins": [
|
|
9
|
-
{
|
|
10
|
-
"name": "Simple Google search",
|
|
11
|
-
"version": "1.0.0",
|
|
12
|
-
"description": "Simple Google search functionality",
|
|
13
|
-
"source": "github",
|
|
14
|
-
"github_url": "https://github.com/runvnc/ah_google",
|
|
15
|
-
"commands": ["google", "fetch_webpage"],
|
|
16
|
-
"services": [],
|
|
17
|
-
"dependencies": []
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
"name": "ah_think",
|
|
21
|
-
"version": "0.0.1",
|
|
22
|
-
"description": "Chain of thought reasoning capability",
|
|
23
|
-
"source": "github",
|
|
24
|
-
"github_url": "https://github.com/runvnc/ah_think",
|
|
25
|
-
"commands": ["think"],
|
|
26
|
-
"services": [],
|
|
27
|
-
"dependencies": []
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
"name": "ah_look_at",
|
|
31
|
-
"version": "0.0.1",
|
|
32
|
-
"description": "PDF and image examination tools",
|
|
33
|
-
"source": "github",
|
|
34
|
-
"github_url": "https://github.com/runvnc/ah_look_at",
|
|
35
|
-
"commands": ["examine_pdf", "examine_image"],
|
|
36
|
-
"services": [],
|
|
37
|
-
"dependencies": []
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
"name": "ah_anthropic",
|
|
41
|
-
"version": "0.0.1",
|
|
42
|
-
"description": "Anthropic Claude AI integration",
|
|
43
|
-
"source": "github",
|
|
44
|
-
"github_url": "https://github.com/runvnc/ah_anthropic",
|
|
45
|
-
"commands": [],
|
|
46
|
-
"services": [],
|
|
47
|
-
"dependencies": []
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
"name": "ah_shell",
|
|
51
|
-
"version": "0.0.1",
|
|
52
|
-
"description": "Shell command execution",
|
|
53
|
-
"source": "github",
|
|
54
|
-
"github_url": "https://github.com/runvnc/ah_shell",
|
|
55
|
-
"commands": ["execute_command"],
|
|
56
|
-
"services": [],
|
|
57
|
-
"dependencies": []
|
|
58
|
-
}
|
|
59
|
-
],
|
|
60
|
-
"agents": [
|
|
61
|
-
{
|
|
62
|
-
"name": "ResearchAssistant",
|
|
63
|
-
"version": "1.0.0",
|
|
64
|
-
"description": "Research assistant with web search and document analysis capabilities",
|
|
65
|
-
"required_commands": ["google", "fetch_webpage", "think", "examine_pdf", "examine_image"],
|
|
66
|
-
"required_services": []
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
"name": "DocumentAnalyst",
|
|
70
|
-
"version": "1.0.0",
|
|
71
|
-
"description": "Specialized in analyzing documents and images",
|
|
72
|
-
"required_commands": ["think", "examine_pdf", "examine_image"],
|
|
73
|
-
"required_services": []
|
|
74
|
-
}
|
|
75
|
-
]
|
|
76
|
-
}
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import asyncio
|
|
2
|
-
import json
|
|
3
|
-
import os
|
|
4
|
-
import logging
|
|
5
|
-
from datetime import datetime
|
|
6
|
-
from lib.providers.services import service, ServiceProvider
|
|
7
|
-
|
|
8
|
-
logger = logging.getLogger(__name__)
|
|
9
|
-
|
|
10
|
-
# Use paths relative to the process working directory
|
|
11
|
-
REQUEST_DIR = "data/password_resets/requests"
|
|
12
|
-
GENERATED_DIR = "data/password_resets/generated"
|
|
13
|
-
CHECK_INTERVAL_SECONDS = 30
|
|
14
|
-
|
|
15
|
-
@service()
|
|
16
|
-
async def process_password_reset_requests(context=None):
|
|
17
|
-
"""Processes password reset request files from a directory."""
|
|
18
|
-
# Ensure directories exist
|
|
19
|
-
os.makedirs(REQUEST_DIR, exist_ok=True)
|
|
20
|
-
os.makedirs(GENERATED_DIR, exist_ok=True)
|
|
21
|
-
|
|
22
|
-
sp = ServiceProvider()
|
|
23
|
-
initiate_reset = sp.get('user_service.initiate_password_reset')
|
|
24
|
-
|
|
25
|
-
if not (initiate_reset and callable(initiate_reset)):
|
|
26
|
-
logger.error("Could not get 'user_service.initiate_password_reset' service.")
|
|
27
|
-
return
|
|
28
|
-
|
|
29
|
-
for filename in os.listdir(REQUEST_DIR):
|
|
30
|
-
request_file_path = os.path.join(REQUEST_DIR, filename)
|
|
31
|
-
if not os.path.isfile(request_file_path):
|
|
32
|
-
continue
|
|
33
|
-
|
|
34
|
-
try:
|
|
35
|
-
with open(request_file_path, 'r') as f:
|
|
36
|
-
data = json.load(f)
|
|
37
|
-
|
|
38
|
-
username = data.get("username")
|
|
39
|
-
is_admin_reset = data.get("is_admin_reset", False)
|
|
40
|
-
|
|
41
|
-
if not username:
|
|
42
|
-
raise ValueError("Username is missing from request file.")
|
|
43
|
-
|
|
44
|
-
logger.info(f"Processing password reset request for user: {username}")
|
|
45
|
-
token = await initiate_reset(username=username, is_admin_reset=is_admin_reset)
|
|
46
|
-
|
|
47
|
-
reset_link = f"/user_service/reset-password/{token}"
|
|
48
|
-
generated_file_path = os.path.join(GENERATED_DIR, f"{username}_{datetime.utcnow().strftime('%Y%m%d%H%M%S')}.json")
|
|
49
|
-
with open(generated_file_path, 'w') as f:
|
|
50
|
-
json.dump({"username": username, "reset_link": reset_link, "token": token}, f, indent=2)
|
|
51
|
-
|
|
52
|
-
logger.info(f"Successfully generated password reset link for {username}.")
|
|
53
|
-
os.remove(request_file_path)
|
|
54
|
-
|
|
55
|
-
except Exception as e:
|
|
56
|
-
logger.error(f"Failed to process reset request file {filename}: {e}")
|
|
57
|
-
error_file_path = os.path.join(REQUEST_DIR, f"{filename}.error")
|
|
58
|
-
os.rename(request_file_path, error_file_path)
|
|
59
|
-
|
|
60
|
-
@service()
|
|
61
|
-
async def start_file_watcher_service(context=None):
|
|
62
|
-
"""Starts a background task to watch for password reset request files."""
|
|
63
|
-
logger.info("Starting password reset file watcher service.")
|
|
64
|
-
async def watcher_loop():
|
|
65
|
-
while True:
|
|
66
|
-
try:
|
|
67
|
-
await process_password_reset_requests()
|
|
68
|
-
except Exception as e:
|
|
69
|
-
logger.error(f"Error in password reset watcher loop: {e}")
|
|
70
|
-
await asyncio.sleep(CHECK_INTERVAL_SECONDS)
|
|
71
|
-
|
|
72
|
-
asyncio.create_task(watcher_loop())
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import asyncio
|
|
2
|
-
import logging
|
|
3
|
-
from lib.providers.hooks import hook
|
|
4
|
-
from lib.providers.services import ServiceProvider
|
|
5
|
-
|
|
6
|
-
logger = logging.getLogger(__name__)
|
|
7
|
-
|
|
8
|
-
@hook('startup')
|
|
9
|
-
async def on_user_service_startup(app, context=None):
|
|
10
|
-
"""
|
|
11
|
-
Startup hook for the user_service plugin.
|
|
12
|
-
"""
|
|
13
|
-
logger.info("User service startup hook triggered.")
|
|
14
|
-
try:
|
|
15
|
-
sp = ServiceProvider()
|
|
16
|
-
start_watcher = sp.get('user_service.start_file_watcher_service')
|
|
17
|
-
if start_watcher and callable(start_watcher):
|
|
18
|
-
logger.info("Starting the password reset file watcher service via startup hook.")
|
|
19
|
-
asyncio.create_task(start_watcher())
|
|
20
|
-
else:
|
|
21
|
-
logger.error("Could not find 'user_service.start_file_watcher_service' during startup.")
|
|
22
|
-
except Exception as e:
|
|
23
|
-
logger.error(f"Error starting file watcher service from hook: {e}")
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|