pluginserver 0.7.0__tar.gz → 0.8.1__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pluginserver
3
- Version: 0.7.0
3
+ Version: 0.8.1
4
4
  Summary: Plugin-driven API server
5
5
  Home-page: https://github.com/nicciniamh/pluginserver
6
6
  Author: Nicole Stevens
@@ -102,6 +102,28 @@ def main():
102
102
 
103
103
  app.add_routes(routes)
104
104
  app.on_shutdown.append(on_shutdown)
105
+ if 'documents' in globalCfg.paths:
106
+ """
107
+ if configured set up static page service
108
+ """
109
+ if ':' in globalCfg.paths.documents:
110
+ dname, dpath = globalCfg.paths.documents.split(':')
111
+ else:
112
+ dname, dpath = 'docs', globalCfg.paths.documents
113
+
114
+ if 'indexfile' in globalCfg.paths:
115
+ indexfile = globalCfg.paths.indexfile
116
+ print(f"indexfile for static service is {indexfile}")
117
+ # Route to handle /docs/ (with or without trailing slash)
118
+ async def default_doc_handler(request):
119
+ return web.FileResponse(os.path.join(dpath, indexfile))
120
+
121
+ app.router.add_get(f'/{dname}', default_doc_handler)
122
+ app.router.add_get(f'/{dname}/', default_doc_handler)
123
+
124
+ print(f"Setting up static page delivery for {dname} from {dpath}")
125
+ app.router.add_static(f"/{dname}/", path=dpath, name=dname)
126
+
105
127
  try:
106
128
  web.run_app(app, host=globalCfg.network.bindto, port=globalCfg.network.port, ssl_context=ssl_ctx)
107
129
  except KeyboardInterrupt:
@@ -154,7 +176,7 @@ def register_plugin_route(plugin_id, instance, config):
154
176
  @routes.route('*', f'/{plugin_id}')
155
177
  @routes.route('*', f'/{plugin_id}/{{tail:.*}}')
156
178
  async def handle(request, inst=instance, pid=plugin_id, cfg=config):
157
- print(request.remote, '- request -', pid)
179
+ #print(request.remote, '- request -', pid)
158
180
  plugin = manager.get_plugin(pid)
159
181
  data = {}
160
182
  if request.method == 'POST' and request.can_read_body:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pluginserver
3
- Version: 0.7.0
3
+ Version: 0.8.1
4
4
  Summary: Plugin-driven API server
5
5
  Home-page: https://github.com/nicciniamh/pluginserver
6
6
  Author: Nicole Stevens
@@ -4,7 +4,7 @@ from setuptools import setup
4
4
 
5
5
  setup(
6
6
  name='pluginserver',
7
- version='0.7.0',
7
+ version='0.8.1',
8
8
  packages=['plugincore'],
9
9
  include_package_data=True,
10
10
  description='Plugin-driven API server',
File without changes
File without changes
File without changes
File without changes