@meith/runtime 0.24.0 → 0.25.0

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meith/runtime",
3
- "version": "0.24.0",
3
+ "version": "0.25.0",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -19,24 +19,24 @@
19
19
  "access": "public"
20
20
  },
21
21
  "dependencies": {
22
- "@meith/accounts": "0.24.0",
23
- "@meith/api": "0.24.0",
24
- "@meith/attachments": "0.24.0",
25
- "@meith/avatars": "0.24.0",
26
- "@meith/core": "0.24.0",
27
- "@meith/db": "0.24.0",
28
- "@meith/drivers": "0.24.0",
29
- "@meith/events": "0.24.0",
30
- "@meith/groups": "0.24.0",
31
- "@meith/i18n": "0.24.0",
32
- "@meith/mail": "0.24.0",
33
- "@meith/markdown": "0.24.0",
34
- "@meith/marketplace": "0.24.0",
35
- "@meith/moderation": "0.24.0",
36
- "@meith/notifications": "0.24.0",
37
- "@meith/plugin-kit": "0.24.0",
38
- "@meith/settings": "0.24.0",
39
- "@meith/tasks": "0.24.0",
40
- "@meith/theme-default": "0.24.0"
22
+ "@meith/accounts": "0.25.0",
23
+ "@meith/api": "0.25.0",
24
+ "@meith/attachments": "0.25.0",
25
+ "@meith/avatars": "0.25.0",
26
+ "@meith/core": "0.25.0",
27
+ "@meith/db": "0.25.0",
28
+ "@meith/drivers": "0.25.0",
29
+ "@meith/events": "0.25.0",
30
+ "@meith/groups": "0.25.0",
31
+ "@meith/i18n": "0.25.0",
32
+ "@meith/mail": "0.25.0",
33
+ "@meith/markdown": "0.25.0",
34
+ "@meith/marketplace": "0.25.0",
35
+ "@meith/moderation": "0.25.0",
36
+ "@meith/notifications": "0.25.0",
37
+ "@meith/plugin-kit": "0.25.0",
38
+ "@meith/settings": "0.25.0",
39
+ "@meith/tasks": "0.25.0",
40
+ "@meith/theme-default": "0.25.0"
41
41
  }
42
42
  }
@@ -55,7 +55,7 @@ import { SEED_GROUP } from './groups'
55
55
  import { resolveMailBrand, type ThemeTokenRegistry } from './mail-brand'
56
56
  import { pluginMarkdownPipeline, sendAudited } from './plugin-rendering'
57
57
  import { pluginTasks } from './plugin-tasks'
58
- import { defaultPromotionGuards, taskWorkers } from './task-workers'
58
+ import { defaultPromotionGuards, type InstalledThemeVersion, taskWorkers } from './task-workers'
59
59
  import { visibleForumSource } from './visible-forums'
60
60
 
61
61
  export interface SchedulerBundle {
@@ -73,6 +73,7 @@ export function buildSchedulerBundle(deps: {
73
73
  readonly files?: FileStore
74
74
  readonly images?: ImageProcessor
75
75
  readonly plugins?: readonly PluginDefinition[]
76
+ readonly themeVersions?: readonly InstalledThemeVersion[]
76
77
  readonly translatorForLocale?: NotificationTranslatorResolver
77
78
  }): SchedulerBundle {
78
79
  const db = deps.db ?? getDb()
@@ -291,6 +292,7 @@ export function buildSchedulerBundle(deps: {
291
292
  marketplace: {
292
293
  repository: new PostgresMarketplaceCacheRepository(db),
293
294
  plugins,
295
+ themes: deps.themeVersions ?? [],
294
296
  feedUrl: () => marketplaceFeedUrl(db),
295
297
  async notifyUpdate(listing) {
296
298
  await new NotificationService({ notifications }).raiseForAdministrators({
@@ -301,7 +303,7 @@ export function buildSchedulerBundle(deps: {
301
303
  package: listing.package,
302
304
  version: listing.version,
303
305
  },
304
- href: '/admin/plugins/browse',
306
+ href: listing.kind === 'plugin' ? '/admin/plugins' : '/admin/themes',
305
307
  dedupeKey: `marketplace.update_available:${listing.key}:${listing.version}`,
306
308
  })
307
309
  },
@@ -68,11 +68,17 @@ export interface TaskWorkerDeps {
68
68
  readonly marketplace?: {
69
69
  readonly repository: MarketplaceCacheRepository
70
70
  readonly plugins: readonly PluginDefinition[]
71
+ readonly themes: readonly InstalledThemeVersion[]
71
72
  readonly feedUrl: () => Promise<string>
72
73
  readonly notifyUpdate: (listing: MarketplaceListing) => Promise<void>
73
74
  }
74
75
  }
75
76
 
77
+ export interface InstalledThemeVersion {
78
+ readonly key: string
79
+ readonly version: string | null
80
+ }
81
+
76
82
  export function defaultPromotionGuards(): PromotionGuards {
77
83
  return {
78
84
  protectedGroupIds: [SEED_GROUP.banned, SEED_GROUP.administrators, SEED_GROUP.superModerators],
@@ -236,6 +242,12 @@ export function taskWorkers(deps: TaskWorkerDeps): Partial<TaskWorkers> {
236
242
  themeApiMajor: THEME_API_MAJOR,
237
243
  },
238
244
  resolveInstalled: (listing) => {
245
+ if (listing.kind === 'theme') {
246
+ const theme = marketplace.themes.find((entry) => entry.key === listing.key)
247
+ return theme === undefined || theme.version === null
248
+ ? null
249
+ : { enabled: true, version: theme.version }
250
+ }
239
251
  const definition = marketplace.plugins.find((plugin) => plugin.key === listing.key)
240
252
  return definition === undefined ? null : { enabled: true, version: definition.version }
241
253
  },