-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Expand file tree
/
Copy pathIPlugin.cs
More file actions
144 lines (129 loc) · 4.67 KB
/
IPlugin.cs
File metadata and controls
144 lines (129 loc) · 4.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
using System;
using Microsoft.Extensions.DependencyInjection;
using ServiceStack.Web;
namespace ServiceStack;
public static class Plugins
{
public const string Grpc = "grpc";
public const string Cors = "cors";
public const string AutoQuery = "autoquery";
public const string AutoQueryData = "autoquerydata";
public const string AutoQueryMetadata = "autoquerymeta";
public const string NativeTypes = "ssref";
public const string Auth = "auth";
public const string Csv = "csv";
public const string Jsonl = "jsonl";
public const string Html = "html";
public const string HttpCache = "httpcache";
public const string LispTcpServer = "lisptcp";
public const string EncryptedMessaging = "cryptmsg";
public const string Metadata = "metadata";
public const string MsgPack = "msgpack";
public const string OpenApi = "openapi";
public const string Postman = "postman";
public const string PredefinedRoutes = "autoroutes";
public const string CleanUrls = "cleanurls";
public const string ProtoBuf = "protobuf";
public const string Razor = "razor";
public const string Register = "register";
public const string RequestInfo = "reqinfo";
public const string Proxy = "proxy";
public const string RequestLogs = "reqlogs";
public const string ServerEvents = "sse";
public const string Session = "session";
public const string SharpPages = "sharp";
public const string Sitemap = "sitemap";
public const string Soap = "soap";
public const string Svg = "svg";
public const string Validation = "validation";
public const string Desktop = "desktop";
public const string WebSudo = "websudo";
public const string CancelRequests = "reqcancel";
public const string Swagger = "swagger";
public const string MiniProfiler = "miniprofiler";
public const string HotReload = "hotreload";
public const string RedisErrorLogs = "redislogs";
public const string AdminUsers = "adminusers";
public const string AdminIdentityUsers = "identityusers";
public const string AdminRedis = "adminredis";
public const string AdminDatabase = "admindb";
public const string AdminCommands = "commands";
public const string ApiKeys = "apikeys";
public const string Ui = "ui";
public const string FileUpload = "filesupload";
public const string Profiling = "profiling";
public const string RunAsAdmin = "runasadmin";
public const string BackgroundJobs = "backgroundjobs";
public const string AiChat = "aichat";
public static void AddToAppMetadata(this IAppHost appHost, Action<AppMetadata> fn)
{
var feature = appHost.GetPlugin<MetadataFeature>();
if (feature == null)
return;
if (fn != null)
feature.AppMetadataFilters.Add(fn);
}
public static void ModifyAppMetadata(this IAppHost appHost, Action<IRequest,AppMetadata> fn)
{
var feature = appHost.GetPlugin<MetadataFeature>();
if (feature == null)
return;
if (fn != null)
feature.AfterAppMetadataFilters.Add(fn);
}
}
/// <summary>
/// Callback for Plugins to register necessary handlers with ServiceStack
/// </summary>
public interface IPlugin
{
void Register(IAppHost appHost);
}
/// <summary>
/// Callback to pre-configure any logic before IPlugin.Register() is fired
/// </summary>
public interface IPreInitPlugin
{
void BeforePluginsLoaded(IAppHost appHost);
}
/// <summary>
/// Callback to post-configure any logic after IPlugin.Register() is fired
/// </summary>
public interface IPostInitPlugin
{
void AfterPluginsLoaded(IAppHost appHost);
}
public interface IRequireRegistration
{
void Register(IAppHost appHost);
}
#if NET8_0_OR_GREATER
public interface IRequireLoadAsync
{
public System.Threading.Tasks.Task LoadAsync(System.Threading.CancellationToken token);
}
#endif
/// <summary>
/// Callback for AuthProviders to register callbacks with AuthFeature
/// </summary>
public interface IAuthPlugin
{
void Configure(IServiceCollection services, AuthFeature feature);
void Register(IAppHost appHost, AuthFeature feature);
}
/// <summary>
/// Allow Auth Providers to initialize the AuthFeature plugin
/// </summary>
public interface IAuthInit
{
void Init(AuthFeature feature);
}
public interface IMsgPackPlugin { } //Marker for MsgPack plugin
public interface IWirePlugin { } //Marker for Wire plugin
public interface INetSerializerPlugin { } //Marker for NetSerialize plugin
public interface IRazorPlugin { } //Marker for MVC Razor plugin
//Marker for ProtoBuf plugin
public interface IProtoBufPlugin
{
string GetProto(Type type);
}