Saber.Vendor
1.0.6.2
dotnet add package Saber.Vendor --version 1.0.6.2
NuGet\Install-Package Saber.Vendor -Version 1.0.6.2
<PackageReference Include="Saber.Vendor" Version="1.0.6.2" />
paket add Saber.Vendor --version 1.0.6.2
#r "nuget: Saber.Vendor, 1.0.6.2"
// Install Saber.Vendor as a Cake Addin
#addin nuget:?package=Saber.Vendor&version=1.0.6.2
// Install Saber.Vendor as a Cake Tool
#tool nuget:?package=Saber.Vendor&version=1.0.6.2
Saber Vendor
Build vendor plugins for Saber
Instructions
- Create a new ASP.NET Core Class Library project
- Include the Nuget Package
Saber.Vendor
in your project - Build & test your vendor plugin:
- Move your vendor project into the
App/Vendors
folder within Saber's Visual Studio project - Run Saber in debug mode
- Move your vendor project into the
Installed vendor plugins can be found by navigating to File > App Settings within the Saber Editor. Some vendor plugins may not be visible from the App Settings tab and would be considered "pass-through", meaning that the plugin "just works".
Vendor plugins cannot be disabled through the Saber Editor and so you must physically remove the vendor files from the project to disable their functionality.
Vendor-Specific Functionality
IVendorStartup
Interface used to execute vendor-specific code when the Saber application starts up. All Vendor classes that inherit IVendorStartup
will be evaluated via
Saber's ConfigureServices
method and Configure
method located in the /App/Startup.cs
class.
public class Startup : IVendorStartup
{
public void ConfigureServices(IServiceCollection services)
{
//do stuff
}
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IConfigurationRoot config)
{
//do stuff
}
}
IVendorViewRenderer
Interface used to execute vendor-specific code when Saber renders a View. Attribute [ViewPath("/Views/Path/To/myfile.html")]
is required on the class that inherits IVendorViewRenderer
, which will determine when the Render
method is being called to load the associated html
file. Use this interface to add HTML to a View that contains the {{vendor}}
element.
[ViewPath("/Views/AppSettings/appsettings.html")]
public class MyPlugin : IVendorViewRenderer
{
public void Render(Core.IRequest request, View view)
{
var myview = new View("/Vendor/MyPlugin/settings.html");
view["vendor"] += myview.Render();
}
}
In the example above, we append the rendered HTML of our settings.html
view to the vendor
element whenever Saber renders the /Views/AppSettings/appsettings.html
View.
NOTE: It is important that you append the rendered HTML to the contents of the
vendor
element instead of replacing the contents because other vendors might have appended content to the same element beforehand.
Saber supports the IVendorViewRenderer
for all views within the application, and the following views include a {{vendor}}
HTML variable so that vendors can extend the Editor UI.
/Views/AppSettings/appsettings.html
, used to add vendor-speicific Application Settings to Saber/Views/PageSettings/pagesettings.html
, used to add vendor-speicific Page Settings to Saber
IVendorController
Interface used to route page requests to vendor-specific controllers. Your class must inherit Controller
as well as IVendorController
in order to work properly.
NOTE: Make sure your controller names do not conflict with potential web pages that users will want to create for their website, such as:
About
,Contact
,Blog
,Wiki
,Projects
,Team
,Terms
,PrivacyPolicy
,Members
,Landing
,Store
,History
, etc.
public class RSSReader : Controller, IVendorController
{
public override string Render(string body = "")
{
if (!CheckSecurity("view-rss")) { return base.Render("Access Denied"); }
var view = new View("/Vendors/RSS/reader.html");
view["feeds"] = RSS.RenderFeeds();
return view.Render();
}
}
IVendorKeys
Interface used to define a list of security keys that can be assigned to users in order to gain access to restricted features.
public class SecurityKeys : IVendorKeys
{
public string Vendor { get; set; } = "RSS Feed Reader";
public SecurityKey[] Keys { get; set; } = new SecurityKey[]
{
new SecurityKey(){Value = "manage-rss", Label = "Manage RSS Feeds", Description = "Add & Remove RSS feeds to read"},
new SecurityKey(){Value = "view-rss", Label = "View RSS Feeds", Description = "Read articles from your feed reader"}
};
}
NOTE: The website administrator (UserId:1) will automatically have access to all security keys, and all other users will have to be given permission to have access to specific security keys.
IViewDataBinder
An interface used to define a list of View Data Binders that define custom mustache variables used in HTML files. For example, check out the Page List plugin which utilizes the IViewDataBinder
interface to read mustache code such as {{page-list path:"blog", length:"4"}}
to render a list of pages that exist in the user's website.
Currently supported plugins
CORS
Adds CORS-related headers to the controller or service response for trusted cross-origin domains.
Import Export
A vendor plugin for Saber that allows webmasters to backup & restore all web content for their Saber website using a simple zip file. This is useful for creating nightly backups and can also be used to publish pending changes from your local workstation to your live website.
Page List
Display a list of webpages associated with your website, such as blog posts or wiki pages.
Reset Cache
A vendor plugin for Saber that allows users to manually reset the stored cache of objects related to pages within their website. This could be useful if your website isn't loading correctly.
Replace Template
A vendor plugin for Saber that allows users to replace the template website that is included with Saber with the currently published website. This is useful if you plan on distributing a copy of Saber with a custom template website preinstalled.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 is compatible. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net5.0
- Saber.Core (>= 1.0.6.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|
Added key to the ViewDataBinderModel.Callback delegate