@raketa-cloud/admin 0.0.12 → 0.0.14
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.
package/package.json
CHANGED
package/src/Adapter.js
CHANGED
package/src/HonoAdapter.js
CHANGED
|
@@ -84,113 +84,120 @@ export default class HonoAdapter extends Adapter {
|
|
|
84
84
|
]) {
|
|
85
85
|
const method = this.getMethod(verb);
|
|
86
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
|
-
if (json) {
|
|
136
|
-
return routerCtx.json(json);
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
assigns.beforeFilterAssigns = beforeFilterAssigns;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
// Process action
|
|
87
|
+
Object.keys(this.globalConfig.i18n.locales).forEach((currentLocale) => {
|
|
88
|
+
const completePath = `/${currentLocale}${path}`;
|
|
89
|
+
|
|
90
|
+
// A terrible, terrible hack...
|
|
91
|
+
// So how do we override for the entire handler.. do we need to completely override it, or just partially? Fun stuff?
|
|
92
|
+
this.router.router.routes = this.router.router.routes.filter((route) => {
|
|
93
|
+
return route[0] !== verb || route[1] !== completePath;
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
method(completePath, async (routerCtx, next) => {
|
|
97
|
+
const ctx = await this.createContext(
|
|
98
|
+
routerCtx,
|
|
99
|
+
next,
|
|
100
|
+
verb,
|
|
101
|
+
resource,
|
|
102
|
+
action
|
|
103
|
+
);
|
|
104
|
+
|
|
105
|
+
ctx.locales = this.globalConfig.i18n.locales;
|
|
106
|
+
ctx.defaultLocale = this.globalConfig.i18n.defaultLocale;
|
|
107
|
+
ctx.locale = currentLocale;
|
|
108
|
+
|
|
109
|
+
const _context = {
|
|
110
|
+
locales: ctx.locales,
|
|
111
|
+
locale: ctx.locale,
|
|
112
|
+
defaultLocale: ctx.defaultLocale,
|
|
113
|
+
path: ctx.req.path,
|
|
114
|
+
query: ctx.query || {},
|
|
115
|
+
layout: {
|
|
116
|
+
...this.globalConfig.layout,
|
|
117
|
+
},
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
console.info(
|
|
121
|
+
`\x1b[35m[${ctx.method}] ${ctx.rawPath}\x1b[0m -> ${resource}/${action} | ${JSON.stringify(ctx.params)}`
|
|
122
|
+
);
|
|
123
|
+
|
|
124
|
+
const assigns = {
|
|
125
|
+
beforeFilterAssigns: {},
|
|
126
|
+
actionAssigns: {},
|
|
127
|
+
afterFilterAssigns: {},
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
// Initialize global context
|
|
131
|
+
ctx.initGlobalContext();
|
|
132
|
+
|
|
133
|
+
// Process before filters
|
|
134
|
+
if (before_filter) {
|
|
143
135
|
const {
|
|
144
|
-
headers,
|
|
145
136
|
redirect,
|
|
146
137
|
json,
|
|
147
|
-
assigns:
|
|
148
|
-
} = (
|
|
149
|
-
assigns.actionAssigns = actionAssigns;
|
|
150
|
-
|
|
151
|
-
this.applyHeaders(headers, routerCtx);
|
|
138
|
+
assigns: beforeFilterAssigns = {},
|
|
139
|
+
} = before_filter(ctx) || {};
|
|
152
140
|
|
|
153
141
|
if (redirect) return routerCtx.redirect(redirect);
|
|
154
142
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
redirect,
|
|
159
|
-
json,
|
|
160
|
-
assigns: afterFilterAssigns = {},
|
|
161
|
-
} = after_filter(ctx) || {};
|
|
143
|
+
if (json) {
|
|
144
|
+
return routerCtx.json(json);
|
|
145
|
+
}
|
|
162
146
|
|
|
163
|
-
|
|
147
|
+
assigns.beforeFilterAssigns = beforeFilterAssigns;
|
|
148
|
+
}
|
|
164
149
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
150
|
+
// Process action
|
|
151
|
+
const {
|
|
152
|
+
headers,
|
|
153
|
+
redirect,
|
|
154
|
+
json,
|
|
155
|
+
assigns: actionAssigns = {},
|
|
156
|
+
} = (await handler(ctx)) || {};
|
|
157
|
+
assigns.actionAssigns = actionAssigns;
|
|
168
158
|
|
|
169
|
-
|
|
170
|
-
|
|
159
|
+
this.applyHeaders(headers, routerCtx);
|
|
160
|
+
|
|
161
|
+
if (redirect) return routerCtx.redirect(redirect);
|
|
162
|
+
|
|
163
|
+
// Process after filters
|
|
164
|
+
if (after_filter) {
|
|
165
|
+
const {
|
|
166
|
+
redirect,
|
|
167
|
+
json,
|
|
168
|
+
assigns: afterFilterAssigns = {},
|
|
169
|
+
} = after_filter(ctx) || {};
|
|
171
170
|
|
|
172
|
-
|
|
173
|
-
...ctx.assigns,
|
|
174
|
-
...assigns.beforeFilterAssigns,
|
|
175
|
-
...assigns.actionAssigns,
|
|
176
|
-
...assigns.afterFilterAssigns,
|
|
177
|
-
_context: _context,
|
|
178
|
-
};
|
|
171
|
+
if (redirect) return routerCtx.redirect(redirect);
|
|
179
172
|
|
|
180
173
|
if (json) {
|
|
181
174
|
return routerCtx.json(json);
|
|
182
175
|
}
|
|
183
176
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
177
|
+
assigns.afterFilterAssigns = afterFilterAssigns;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
const fullAssigns = {
|
|
181
|
+
...ctx.assigns,
|
|
182
|
+
...assigns.beforeFilterAssigns,
|
|
183
|
+
...assigns.actionAssigns,
|
|
184
|
+
...assigns.afterFilterAssigns,
|
|
185
|
+
_context: _context,
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
if (json) {
|
|
189
|
+
return routerCtx.json(json);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
const rendered = this.renderAction({
|
|
193
|
+
views,
|
|
194
|
+
action,
|
|
195
|
+
assigns: fullAssigns,
|
|
191
196
|
});
|
|
192
|
-
|
|
193
|
-
|
|
197
|
+
|
|
198
|
+
return routerCtx.html(rendered);
|
|
199
|
+
});
|
|
200
|
+
});
|
|
194
201
|
}
|
|
195
202
|
|
|
196
203
|
routeCollection(mapping) {
|
|
@@ -28,84 +28,47 @@
|
|
|
28
28
|
</button>
|
|
29
29
|
|
|
30
30
|
<div class="my-4">
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
<a href="<%= `/${_context.locale}/events` %>" class="relative flex items-center gap-3 px-5 py-4 text-raketa-primary hover:bg-raketa-primary hover:text-white group-[.is-active]/item:bg-raketa-primary group-[.is-active]/item:text-white">
|
|
55
|
-
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-6 opacity-100 group-[.expanded]:opacity-50">
|
|
56
|
-
<path stroke-linecap="round" stroke-linejoin="round" d="M6.75 3v2.25M17.25 3v2.25M3 18.75V7.5a2.25 2.25 0 0 1 2.25-2.25h13.5A2.25 2.25 0 0 1 21 7.5v11.25m-18 0A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75m-18 0v-7.5A2.25 2.25 0 0 1 5.25 9h13.5A2.25 2.25 0 0 1 21 11.25v7.5" />
|
|
57
|
-
</svg>
|
|
58
|
-
|
|
59
|
-
<span class="group-[.expanded]:block hidden">Events</span>
|
|
60
|
-
<div class="absolute group-hover/item:opacity-100 group-[.is-active]/item:opacity-100 opacity-0 top-0 z-10 -right-[10px] w-0 h-0 border-t-[28px] border-t-transparent border-b-[28px] border-b-transparent border-l-[10px] border-l-raketa-primary"></div>
|
|
61
|
-
</a>
|
|
62
|
-
</div>
|
|
63
|
-
|
|
64
|
-
<div class="group/item">
|
|
65
|
-
<a href="<%= `/${_context.locale}/redirects` %>" class="relative flex items-center gap-3 px-5 py-4 text-raketa-primary hover:bg-raketa-primary hover:text-white group-[.is-active]/item:bg-raketa-primary group-[.is-active]/item:text-white">
|
|
66
|
-
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-6 opacity-100 group-[.expanded]:opacity-50">
|
|
67
|
-
<path stroke-linecap="round" stroke-linejoin="round" d="M7.5 21 3 16.5m0 0L7.5 12M3 16.5h13.5m0-13.5L21 7.5m0 0L16.5 12M21 7.5H7.5" />
|
|
68
|
-
</svg>
|
|
69
|
-
|
|
70
|
-
<span class="group-[.expanded]:block hidden">Redirects</span>
|
|
71
|
-
<div class="absolute group-hover/item:opacity-100 group-[.is-active]/item:opacity-100 opacity-0 top-0 z-10 -right-[10px] w-0 h-0 border-t-[28px] border-t-transparent border-b-[28px] border-b-transparent border-l-[10px] border-l-raketa-primary"></div>
|
|
72
|
-
</a>
|
|
73
|
-
</div>
|
|
74
|
-
|
|
75
|
-
<div class="group/item">
|
|
76
|
-
<a href="<%= `/${_context.locale}/tags` %>" class="relative flex items-center gap-3 px-5 py-4 text-raketa-primary hover:bg-raketa-primary hover:text-white group-[.is-active]/item:bg-raketa-primary group-[.is-active]/item:text-white">
|
|
77
|
-
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-6 opacity-100 group-[.expanded]:opacity-50">
|
|
78
|
-
<path stroke-linecap="round" stroke-linejoin="round" d="M9.568 3H5.25A2.25 2.25 0 0 0 3 5.25v4.318c0 .597.237 1.17.659 1.591l9.581 9.581c.699.699 1.78.872 2.607.33a18.095 18.095 0 0 0 5.223-5.223c.542-.827.369-1.908-.33-2.607L11.16 3.66A2.25 2.25 0 0 0 9.568 3Z" />
|
|
79
|
-
<path stroke-linecap="round" stroke-linejoin="round" d="M6 6h.008v.008H6V6Z" />
|
|
80
|
-
</svg>
|
|
81
|
-
|
|
82
|
-
<span class="group-[.expanded]:block hidden">Tags</span>
|
|
83
|
-
<div class="absolute group-hover/item:opacity-100 group-[.is-active]/item:opacity-100 opacity-0 top-0 z-10 -right-[10px] w-0 h-0 border-t-[28px] border-t-transparent border-b-[28px] border-b-transparent border-l-[10px] border-l-raketa-primary"></div>
|
|
84
|
-
</a>
|
|
85
|
-
</div>
|
|
86
|
-
|
|
87
|
-
<div class="group/item">
|
|
88
|
-
<details class="unstyled-details">
|
|
89
|
-
<summary class="relative flex items-center gap-3 px-5 py-4 text-raketa-primary cursor-pointer transition-all duration-300 ease-in-out">
|
|
90
|
-
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-6 opacity-100 group-[.expanded]:opacity-50">
|
|
91
|
-
<path stroke-linecap="round" stroke-linejoin="round" d="M9.594 3.94c.09-.542.56-.94 1.11-.94h2.593c.55 0 1.02.398 1.11.94l.213 1.281c.063.374.313.686.645.87.074.04.147.083.22.127.325.196.72.257 1.075.124l1.217-.456a1.125 1.125 0 0 1 1.37.49l1.296 2.247a1.125 1.125 0 0 1-.26 1.431l-1.003.827c-.293.241-.438.613-.43.992a7.723 7.723 0 0 1 0 .255c-.008.378.137.75.43.991l1.004.827c.424.35.534.955.26 1.43l-1.298 2.247a1.125 1.125 0 0 1-1.369.491l-1.217-.456c-.355-.133-.75-.072-1.076.124a6.47 6.47 0 0 1-.22.128c-.331.183-.581.495-.644.869l-.213 1.281c-.09.543-.56.94-1.11.94h-2.594c-.55 0-1.019-.398-1.11-.94l-.213-1.281c-.062-.374-.312-.686-.644-.87a6.52 6.52 0 0 1-.22-.127c-.325-.196-.72-.257-1.076-.124l-1.217.456a1.125 1.125 0 0 1-1.369-.49l-1.297-2.247a1.125 1.125 0 0 1 .26-1.431l1.004-.827c.292-.24.437-.613.43-.991a6.932 6.932 0 0 1 0-.255c.007-.38-.138-.751-.43-.992l-1.004-.827a1.125 1.125 0 0 1-.26-1.43l1.297-2.247a1.125 1.125 0 0 1 1.37-.491l1.216.456c.356.133.751.072 1.076-.124.072-.044.146-.086.22-.128.332-.183.582-.495.644-.869l.214-1.28Z" />
|
|
92
|
-
<path stroke-linecap="round" stroke-linejoin="round" d="M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z" />
|
|
93
|
-
</svg>
|
|
94
|
-
|
|
95
|
-
<span class="group-[.expanded]:block hidden">Settings</span>
|
|
96
|
-
|
|
97
|
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="icon-toggle absolute right-4 size-4 group-[.expanded]:block hidden">
|
|
98
|
-
<path fill-rule="evenodd" d="M5.22 8.22a.75.75 0 0 1 1.06 0L10 11.94l3.72-3.72a.75.75 0 1 1 1.06 1.06l-4.25 4.25a.75.75 0 0 1-1.06 0L5.22 9.28a.75.75 0 0 1 0-1.06Z" clip-rule="evenodd" />
|
|
99
|
-
</svg>
|
|
100
|
-
</summary>
|
|
101
|
-
|
|
102
|
-
<div class="pl-12 py-4 bg-raketa-background/50 group-[.expanded]:block hidden">
|
|
103
|
-
<a href="<%= `/${_context.locale}/settings/general/edit` %>" class="block py-2 body-2 text-raketa-foreground/50 hover:text-raketa-foreground transition-all ease-in-out duration-300">General</a>
|
|
104
|
-
<a href="<%= `/${_context.locale}/settings/meta/edit` %>" class="block py-2 body-2 text-raketa-foreground/50 hover:text-raketa-foreground transition-all ease-in-out duration-300">Meta and OpenGraph</a>
|
|
105
|
-
<a href="<%= `/${_context.locale}/settings/layout/edit` %>" class="block py-2 body-2 text-raketa-foreground/50 hover:text-raketa-foreground transition-all ease-in-out duration-300">Layout and Navigation</a>
|
|
31
|
+
<% _context.layout.sidebar.forEach((menu, idx) => { %>
|
|
32
|
+
<% if (menu.submenus) { %>
|
|
33
|
+
|
|
34
|
+
<div class="group/item">
|
|
35
|
+
<details class="unstyled-details">
|
|
36
|
+
<summary class="relative flex items-center gap-3 px-5 py-4 text-raketa-primary cursor-pointer transition-all duration-300 ease-in-out">
|
|
37
|
+
<div class="size-6 opacity-100 group-[.expanded]:opacity-50">
|
|
38
|
+
<%- atob(menu.icon) %>
|
|
39
|
+
</div>
|
|
40
|
+
|
|
41
|
+
<span class="group-[.expanded]:block hidden"><%= menu.label %></span>
|
|
42
|
+
|
|
43
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="icon-toggle absolute right-4 size-4 group-[.expanded]:block hidden">
|
|
44
|
+
<path fill-rule="evenodd" d="M5.22 8.22a.75.75 0 0 1 1.06 0L10 11.94l3.72-3.72a.75.75 0 1 1 1.06 1.06l-4.25 4.25a.75.75 0 0 1-1.06 0L5.22 9.28a.75.75 0 0 1 0-1.06Z" clip-rule="evenodd" />
|
|
45
|
+
</svg>
|
|
46
|
+
</summary>
|
|
47
|
+
|
|
48
|
+
<div class="pl-12 py-4 bg-raketa-background/50 group-[.expanded]:block hidden">
|
|
49
|
+
<% menu.submenus.forEach(submenu => { %>
|
|
50
|
+
<a href="<%= `/${_context.locale}/${submenu.link}` %>" class="block py-2 body-2 text-raketa-foreground/50 hover:text-raketa-foreground transition-all ease-in-out duration-300"><%= submenu.label %></a>
|
|
51
|
+
<% }) %>
|
|
52
|
+
</div>
|
|
53
|
+
</details>
|
|
106
54
|
</div>
|
|
107
|
-
|
|
108
|
-
|
|
55
|
+
|
|
56
|
+
<% } else { %>
|
|
57
|
+
|
|
58
|
+
<div class="group/item">
|
|
59
|
+
<a href="<%= `/${_context.locale}${menu.link}` %>" class="relative flex items-center gap-3 px-5 py-4 text-raketa-primary hover:bg-raketa-primary hover:text-white group-[.is-active]/item:bg-raketa-primary group-[.is-active]/item:text-white">
|
|
60
|
+
<div class="size-6 opacity-100 group-[.expanded]:opacity-50">
|
|
61
|
+
<%- atob(menu.icon) %>
|
|
62
|
+
</div>
|
|
63
|
+
|
|
64
|
+
<span class="group-[.expanded]:block hidden"><%= menu.label %></span>
|
|
65
|
+
<div class="absolute group-hover/item:opacity-100 group-[.is-active]/item:opacity-100 opacity-0 top-0 z-10 -right-[10px] w-0 h-0 border-t-[28px] border-t-transparent border-b-[28px] border-b-transparent border-l-[10px] border-l-raketa-primary"></div>
|
|
66
|
+
</a>
|
|
67
|
+
</div>
|
|
68
|
+
|
|
69
|
+
<% } %>
|
|
70
|
+
<% }) %>
|
|
71
|
+
|
|
109
72
|
</div>
|
|
110
73
|
|
|
111
74
|
<div class="group/item">
|
|
@@ -143,4 +106,4 @@
|
|
|
143
106
|
</script>
|
|
144
107
|
</body>
|
|
145
108
|
|
|
146
|
-
</html>
|
|
109
|
+
</html>
|