mirror of
https://github.com/outline/outline.git
synced 2026-11-21 05:24:03 +03:00
* chore: Move plugin-specific integration code into plugins Core no longer imports from or names the settings of individual plugins. Plugins now register mention providers, issue status icons, instance URLs, settings keys, settings and import schemas, and OAuth clients through hooks. * fix: Recompute embed instance URLs after plugins load and match legacy issue icons by URL * fix: Skip logo upload jobs queued without a settings path * chore: Choose issue status icons from the unfurl state
45 lines
1.4 KiB
TypeScript
45 lines
1.4 KiB
TypeScript
import type { IntegrationSettings, IntegrationType } from "@shared/types";
|
|
import { IntegrationService } from "@shared/types";
|
|
import { createLazyComponent } from "~/components/LazyLoad";
|
|
import { Hook, PluginManager } from "~/utils/PluginManager";
|
|
import config from "../plugin.json";
|
|
import { GitLabUtils } from "../shared/GitLabUtils";
|
|
import Icon from "./components/Icon";
|
|
|
|
PluginManager.add([
|
|
{
|
|
...config,
|
|
type: Hook.Settings,
|
|
value: {
|
|
group: "Integrations",
|
|
icon: Icon,
|
|
description:
|
|
"Connect your GitLab account to Outline to enable rich, real-time issue, merge request, and project previews inside documents.",
|
|
component: createLazyComponent(() => import("./Settings")),
|
|
},
|
|
},
|
|
{
|
|
...config,
|
|
type: Hook.MentionProvider,
|
|
value: {
|
|
service: IntegrationService.GitLab,
|
|
isMentionable: (url, integration) => {
|
|
const settings =
|
|
integration.settings as IntegrationSettings<IntegrationType.Embed>;
|
|
let hostname: string | undefined;
|
|
try {
|
|
hostname = settings.gitlab?.url
|
|
? new URL(settings.gitlab.url).hostname
|
|
: undefined;
|
|
} catch {
|
|
return false;
|
|
}
|
|
|
|
return url.hostname === "gitlab.com" || url.hostname === hostname;
|
|
},
|
|
// The host is already checked by isMentionable.
|
|
mentionType: (url) => GitLabUtils.mentionType(url, url.origin),
|
|
},
|
|
},
|
|
]);
|