Closed fazelukario closed 1 year ago
Also, remove ASF-ui change from this PR, looks like a mistake on your part.
Also, remove ASF-ui change from this PR, looks like a mistake on your part.
Yes, seems visual studio git module f*cked up.
I still don't like how we hardcode
/plugins
into a path and make assumption on it based on the name of the parent directory. I can haveplugins/MyPlugin/static/www2
and want to host it under/admin
for example.If we can't make it work generically, then we need new plugin interface that exposes to us under what path it wants its
www
served.Plugin interface should be probably named
IWebInterface
, inherit fromIPlugin
and require implementation of two properties, both optional:
string PhysicalPath
which defaults towww
.string WebPath
which defaults to/
.Then we should change existing code to firstly, evaluate only
IWebInterface
plugins (rather than all), evaluate ifPath.Combine()
for assembly location andPhysicalPath
exists, if yes, add default and static files underWebPath
.
Okay, I'll try to do that today.
Plugin interface should be probably named
IWebInterface
, inherit fromIPlugin
and require implementation of two properties, both optional:
If we are adding new interface, maybe we should add some indication for ASF-ui after all, like fazelukario suggested before? Maybe add some field to /Api/Plugins
endpoint, like implements
with array of implemented interfaces? Or just a bool "haswebui" for IWebInterface only.
Plugin interface should be probably named
IWebInterface
, inherit fromIPlugin
and require implementation of two properties, both optional:If we are adding new interface, maybe we should add some indication for ASF-ui after all, like fazelukario suggested before? Maybe add some field to
/Api/Plugins
endpoint, likeimplements
with array of implemented interfaces? Or just a bool "haswebui" for IWebInterface only.
In standalone PR, one thing at a time, we don't need to do 1000 things at a time, that'll be standalone follow-up enhancement (if we determine it wanted).
But yes, it's good idea to expose plugins and their WebPaths to ASF-ui.
Plugin interface should be probably named
IWebInterface
, inherit fromIPlugin
and require implementation of two properties, both optional:If we are adding new interface, maybe we should add some indication for ASF-ui after all, like fazelukario suggested before? Maybe add some field to
/Api/Plugins
endpoint, likeimplements
with array of implemented interfaces? Or just a bool "haswebui" for IWebInterface only.
We don't need this, since /API/Plugins
already fills this need with the ability to serialize additional properties, so ASF-ui can simply check if the WebPath
property exists and use it.
Plugin interface should be probably named
IWebInterface
, inherit fromIPlugin
and require implementation of two properties, both optional:
string PhysicalPath
which defaults towww
.string WebPath
which defaults to/
.
@JustArchi Didn't quite understand how I can make an interface with optional values with defaults, maybe you mean abstract class
like OfficialPlugin
?
Plugin interface should be probably named
IWebInterface
, inherit fromIPlugin
and require implementation of two properties, both optional:
string PhysicalPath
which defaults towww
.string WebPath
which defaults to/
.@JustArchi Didn't quite understand how I can make an interface with optional values with defaults, maybe you mean
abstract class
likeOfficialPlugin
?
https://devblogs.microsoft.com/dotnet/default-implementations-in-interfaces/ https://learn.microsoft.com/dotnet/csharp/advanced-topics/interface-implementation/default-interface-methods-versions
@Abrynos @Ryzhehvost feel free to review.
@JustArchi @Abrynos @Ryzhehvost Done with feedback, feel free to review.
LGTM. IWebInterface
should probably have self-documentation comments for properties, but that's not a show-stopper.
LGTM.
IWebInterface
should probably have self-documentation comments for properties, but that's not a show-stopper.
Yes, I forgot about this, but I think it would be better if @JustArchi documented this as I'm not very good at writing user friendly documentation.
Enough of chit-chat, time to merge that in!
Thanks again :trophy:
Checklist
Changes
New functionality
Added native web GUI support for custom plugins inside the ASF IPC
Changed functionality
None
Removed functionality
None
Additional info
ref #2876