mirror of
https://github.com/YunoHost-Apps/outline_ynh.git
synced 2024-09-03 19:56:12 +02:00
389 lines
13 KiB
Text
389 lines
13 KiB
Text
diff --git a/app/editor/menus/block.tsx b/app/editor/menus/block.tsx
|
|
index 05e9acee6..aca761095 100644
|
|
--- a/app/editor/menus/block.tsx
|
|
+++ b/app/editor/menus/block.tsx
|
|
@@ -20,6 +20,7 @@ import {
|
|
MathIcon,
|
|
DoneIcon,
|
|
EmbedIcon,
|
|
+ BookmarkedIcon,
|
|
} from "outline-icons";
|
|
import * as React from "react";
|
|
import styled from "styled-components";
|
|
@@ -195,6 +196,13 @@ export default function blockMenuItems(dictionary: Dictionary): MenuItem[] {
|
|
keywords: "notice card suggestion",
|
|
attrs: { style: "tip" },
|
|
},
|
|
+ {
|
|
+ name: "container_notice",
|
|
+ title: dictionary.bibleNotice,
|
|
+ icon: <BookmarkedIcon />,
|
|
+ keywords: "notice card bible",
|
|
+ attrs: { style: "bible" },
|
|
+ },
|
|
{
|
|
name: "separator",
|
|
},
|
|
diff --git a/app/hooks/useDictionary.ts b/app/hooks/useDictionary.ts
|
|
index e8178b11d..9dac7edba 100644
|
|
--- a/app/hooks/useDictionary.ts
|
|
+++ b/app/hooks/useDictionary.ts
|
|
@@ -85,6 +85,8 @@ export default function useDictionary() {
|
|
warningNotice: t("Warning notice"),
|
|
success: t("Success"),
|
|
successNotice: t("Success notice"),
|
|
+ bible: t("Bible"),
|
|
+ bibleNotice: t("Bible quote"),
|
|
insertDate: t("Current date"),
|
|
insertTime: t("Current time"),
|
|
insertDateTime: t("Current date and time"),
|
|
diff --git a/app/scenes/Document/components/Document.tsx b/app/scenes/Document/components/Document.tsx
|
|
index 752915e89..5eefe890c 100644
|
|
--- a/app/scenes/Document/components/Document.tsx
|
|
+++ b/app/scenes/Document/components/Document.tsx
|
|
@@ -599,11 +599,6 @@ class DocumentScene extends React.Component<Props> {
|
|
)}
|
|
</React.Suspense>
|
|
</Main>
|
|
- {isShare &&
|
|
- !parseDomain(window.location.origin).custom &&
|
|
- !auth.user && (
|
|
- <Branding href="//www.getoutline.com?ref=sharelink" />
|
|
- )}
|
|
</Container>
|
|
{!isShare && (
|
|
<Footer>
|
|
diff --git a/app/scenes/Login/components/AuthenticationProvider.tsx b/app/scenes/Login/components/AuthenticationProvider.tsx
|
|
index d70f3dcb8..5efdfbd86 100644
|
|
--- a/app/scenes/Login/components/AuthenticationProvider.tsx
|
|
+++ b/app/scenes/Login/components/AuthenticationProvider.tsx
|
|
@@ -70,7 +70,7 @@ function AuthenticationProvider(props: Props) {
|
|
<InputLarge
|
|
type="email"
|
|
name="email"
|
|
- placeholder="me@domain.com"
|
|
+ placeholder="email@domaine.fr"
|
|
value={email}
|
|
onChange={handleChangeEmail}
|
|
disabled={isSubmitting}
|
|
@@ -79,12 +79,12 @@ function AuthenticationProvider(props: Props) {
|
|
short
|
|
/>
|
|
<ButtonLarge type="submit" disabled={isSubmitting} {...rest}>
|
|
- {t("Sign In")} →
|
|
+ {t("S'identifier")} →
|
|
</ButtonLarge>
|
|
</>
|
|
) : (
|
|
<ButtonLarge type="submit" icon={<EmailIcon />} fullwidth {...rest}>
|
|
- {t("Continue with Email")}
|
|
+ {t("Accès membre (email)")}
|
|
</ButtonLarge>
|
|
)}
|
|
</Form>
|
|
@@ -99,7 +99,7 @@ function AuthenticationProvider(props: Props) {
|
|
fullwidth
|
|
{...rest}
|
|
>
|
|
- {t("Continue with {{ authProviderName }}", {
|
|
+ {t("Accès {{ authProviderName }}", {
|
|
authProviderName: name,
|
|
})}
|
|
</ButtonLarge>
|
|
diff --git a/app/scenes/Login/index.tsx b/app/scenes/Login/index.tsx
|
|
index b2b8c3929..78590e823 100644
|
|
--- a/app/scenes/Login/index.tsx
|
|
+++ b/app/scenes/Login/index.tsx
|
|
@@ -267,7 +267,7 @@ function Login({ children }: Props) {
|
|
) : (
|
|
<>
|
|
<StyledHeading as="h2" centered>
|
|
- {t("Login to {{ authProviderName }}", {
|
|
+ {t("Bienvenue sur Anthropologie Biblique", {
|
|
authProviderName: config.name || env.APP_NAME,
|
|
})}
|
|
</StyledHeading>
|
|
@@ -285,7 +285,7 @@ function Login({ children }: Props) {
|
|
{hasMultipleProviders && (
|
|
<>
|
|
<Note>
|
|
- {t("You signed in with {{ authProviderName }} last time.", {
|
|
+ {t("Vous vous êtes authentifié avec l'accès {{ authProviderName }} la dernière fois.", {
|
|
authProviderName: defaultProvider.name,
|
|
})}
|
|
</Note>
|
|
diff --git a/app/typings/styled-components.d.ts b/app/typings/styled-components.d.ts
|
|
index 0a5da6e6f..bc64bb3bc 100644
|
|
--- a/app/typings/styled-components.d.ts
|
|
+++ b/app/typings/styled-components.d.ts
|
|
@@ -54,6 +54,8 @@ declare module "styled-components" {
|
|
noticeWarningText: string;
|
|
noticeSuccessBackground: string;
|
|
noticeSuccessText: string;
|
|
+ noticeBibleBackground: string;
|
|
+ noticeBibleText: string;
|
|
}
|
|
|
|
interface Colors {
|
|
diff --git a/package.json b/package.json
|
|
index fd6010972..800dd9882 100644
|
|
--- a/package.json
|
|
+++ b/package.json
|
|
@@ -169,6 +169,7 @@
|
|
"pg-tsquery": "^8.4.2",
|
|
"pluralize": "^8.0.0",
|
|
"png-chunks-extract": "^1.0.0",
|
|
+ "passport-req": "^0.1.1",
|
|
"polished": "^4.3.1",
|
|
"prosemirror-codemark": "^0.4.2",
|
|
"prosemirror-commands": "^1.6.0",
|
|
diff --git a/plugins/req/plugin.json b/plugins/req/plugin.json
|
|
new file mode 100644
|
|
index 000000000..88780ccd7
|
|
--- /dev/null
|
|
+++ b/plugins/req/plugin.json
|
|
@@ -0,0 +1,6 @@
|
|
+{
|
|
+ "id": "req",
|
|
+ "name": "visiteur",
|
|
+ "priority": 30,
|
|
+ "description": "Adds an req compatible authentication provider."
|
|
+}
|
|
diff --git a/plugins/req/server/auth/req.ts b/plugins/req/server/auth/req.ts
|
|
new file mode 100644
|
|
index 000000000..da37414e9
|
|
--- /dev/null
|
|
+++ b/plugins/req/server/auth/req.ts
|
|
@@ -0,0 +1,70 @@
|
|
+import passport from "@outlinewiki/koa-passport";
|
|
+import type { Context } from "koa";
|
|
+import Router from "koa-router";
|
|
+import { capitalize } from "lodash";
|
|
+import { Strategy as ReqStrategy } from "passport-req";
|
|
+import { slugifyDomain } from "@shared/utils/domains";
|
|
+import accountProvisioner from "@server/commands/accountProvisioner";
|
|
+import passportMiddleware from "@server/middlewares/passport";
|
|
+import { User } from "@server/models";
|
|
+import { AuthenticationResult } from "@server/types";
|
|
+import {
|
|
+ StateStore,
|
|
+ getTeamFromContext,
|
|
+ getClientFromContext,
|
|
+} from "@server/utils/passport";
|
|
+import env from "@server/env";
|
|
+
|
|
+const router = new Router();
|
|
+const providerName = "req";
|
|
+
|
|
+export const config = {
|
|
+ name: "visiteur",
|
|
+ enabled: true,
|
|
+};
|
|
+
|
|
+if (true) {
|
|
+ passport.use(
|
|
+ new ReqStrategy(
|
|
+ async function (req,done) {
|
|
+ try {
|
|
+ const domain = "anthropologiebiblique.fr";
|
|
+ const subdomain = domain.split(".")[0];
|
|
+ const teamName = capitalize(subdomain);
|
|
+ const name = "visiteur";
|
|
+ const email = "visiteur@anthropologiebiblique.fr";
|
|
+ const result = await accountProvisioner({
|
|
+ ip: req.ip,
|
|
+ team: {
|
|
+ name: teamName,
|
|
+ domain,
|
|
+ subdomain,
|
|
+ },
|
|
+ user: {
|
|
+ name: name,
|
|
+ email: email,
|
|
+ avatarUrl: null,
|
|
+ },
|
|
+ authenticationProvider: {
|
|
+ name: providerName,
|
|
+ providerId: domain,
|
|
+ },
|
|
+ authentication: {
|
|
+ providerId: "1234",
|
|
+ accessToken: null,
|
|
+ refreshToken: null,
|
|
+ scopes: [],
|
|
+ },
|
|
+ });
|
|
+ return done(null, result.user, result);
|
|
+ } catch (err) {
|
|
+ return done(err, null);
|
|
+ }
|
|
+ }
|
|
+ )
|
|
+ );
|
|
+
|
|
+ router.get("req", passportMiddleware(providerName));
|
|
+}
|
|
+
|
|
+export default router;
|
|
\ No newline at end of file
|
|
diff --git a/plugins/req/server/index.ts b/plugins/req/server/index.ts
|
|
new file mode 100644
|
|
index 000000000..68081fb65
|
|
--- /dev/null
|
|
+++ b/plugins/req/server/index.ts
|
|
@@ -0,0 +1,14 @@
|
|
+import { PluginManager, Hook } from "@server/utils/PluginManager";
|
|
+import config from "../plugin.json";
|
|
+import router from "./auth/req";
|
|
+
|
|
+const enabled = true;
|
|
+
|
|
+if (enabled) {
|
|
+ PluginManager.add({
|
|
+ ...config,
|
|
+ type: Hook.AuthProvider,
|
|
+ value: { router, id: config.id },
|
|
+ name: config.name,
|
|
+ });
|
|
+}
|
|
diff --git a/server/emails/mailer.tsx b/server/emails/mailer.tsx
|
|
index f53e44b6b..bcf56efca 100644
|
|
--- a/server/emails/mailer.tsx
|
|
+++ b/server/emails/mailer.tsx
|
|
@@ -207,6 +207,7 @@ export class Mailer {
|
|
: {
|
|
rejectUnauthorized: false,
|
|
},
|
|
+ ignoreTLS:true
|
|
};
|
|
}
|
|
|
|
diff --git a/shared/editor/components/Styles.ts b/shared/editor/components/Styles.ts
|
|
index 9567dab95..896a1ced4 100644
|
|
--- a/shared/editor/components/Styles.ts
|
|
+++ b/shared/editor/components/Styles.ts
|
|
@@ -949,6 +949,20 @@ h6 {
|
|
}
|
|
}
|
|
|
|
+.notice-block.bible {
|
|
+ background: ${transparentize(0.9, props.theme.noticeBibleBackground)};
|
|
+ border-left: 4px solid ${props.theme.noticeBibleBackground};
|
|
+ color: ${props.theme.noticeBibleText};
|
|
+
|
|
+ .icon {
|
|
+ color: ${props.theme.noticeBibleBackground};
|
|
+ }
|
|
+
|
|
+ a {
|
|
+ color: ${props.theme.noticeBibleText};
|
|
+ }
|
|
+}
|
|
+
|
|
blockquote {
|
|
margin: 0;
|
|
padding: 8px 10px 8px 1.5em;
|
|
diff --git a/shared/editor/nodes/Notice.tsx b/shared/editor/nodes/Notice.tsx
|
|
index bd976e69b..9ee40b8d5 100644
|
|
--- a/shared/editor/nodes/Notice.tsx
|
|
+++ b/shared/editor/nodes/Notice.tsx
|
|
@@ -1,5 +1,5 @@
|
|
import Token from "markdown-it/lib/token";
|
|
-import { WarningIcon, InfoIcon, StarredIcon, DoneIcon } from "outline-icons";
|
|
+import { WarningIcon, InfoIcon, StarredIcon, BookmarkedIcon, DoneIcon } from "outline-icons";
|
|
import { wrappingInputRule } from "prosemirror-inputrules";
|
|
import { NodeSpec, Node as ProsemirrorNode, NodeType } from "prosemirror-model";
|
|
import * as React from "react";
|
|
@@ -44,6 +44,8 @@ export default class Notice extends Node {
|
|
? "warning"
|
|
: dom.className.includes("success")
|
|
? "success"
|
|
+ : dom.className.includes("bible")
|
|
+ ? "bible"
|
|
: undefined,
|
|
}),
|
|
},
|
|
@@ -93,6 +95,8 @@ export default class Notice extends Node {
|
|
component = <WarningIcon />;
|
|
} else if (node.attrs.style === "success") {
|
|
component = <DoneIcon />;
|
|
+ } else if (node.attrs.style === "bible") {
|
|
+ component = <BookmarkedIcon />;
|
|
} else {
|
|
component = <InfoIcon />;
|
|
}
|
|
diff --git a/shared/styles/theme.ts b/shared/styles/theme.ts
|
|
index 35b410dde..daa0a3e3e 100644
|
|
--- a/shared/styles/theme.ts
|
|
+++ b/shared/styles/theme.ts
|
|
@@ -31,6 +31,7 @@ const defaultColors: Colors = {
|
|
warning: "#f08a24",
|
|
success: "#2f3336",
|
|
info: "#a0d3e8",
|
|
+ bible: "#996633",
|
|
brand: {
|
|
red: "#FF5C80",
|
|
pink: "#FF4DFA",
|
|
@@ -98,6 +99,8 @@ const buildBaseTheme = (input: Partial<Colors>) => {
|
|
noticeSuccessBackground: colors.brand.green,
|
|
noticeSuccessText: colors.almostBlack,
|
|
tableSelectedBackground: transparentize(0.9, colors.accent),
|
|
+ noticeBibleBackground: "#996633",
|
|
+ noticeBibleText: colors.almostBlack,
|
|
breakpoints,
|
|
...colors,
|
|
...spacing,
|
|
@@ -234,6 +237,7 @@ export const buildDarkTheme = (input: Partial<Colors>): DefaultTheme => {
|
|
noticeTipText: colors.white,
|
|
noticeWarningText: colors.white,
|
|
noticeSuccessText: colors.white,
|
|
+ noticeBibleText: colors.white,
|
|
progressBarBackground: colors.slate,
|
|
scrollbarBackground: colors.black,
|
|
scrollbarThumb: colors.lightBlack,
|
|
diff --git a/yarn.lock b/yarn.lock
|
|
index bb51a8f70..884861c76 100644
|
|
--- a/yarn.lock
|
|
+++ b/yarn.lock
|
|
@@ -12104,6 +12104,14 @@ passport-oauth@1.0.x:
|
|
passport-oauth1 "1.x.x"
|
|
passport-oauth2 "1.x.x"
|
|
|
|
+passport-req@^0.1.1:
|
|
+ version "0.1.1"
|
|
+ resolved "https://registry.yarnpkg.com/passport-req/-/passport-req-0.1.1.tgz#451bff1500b3d464a768d42f0762328a21236a18"
|
|
+ integrity sha512-9qmM0vD5v7jYLWxezNNCleOw+8IkVAuvOwQ6NJaUuJkdFJTR1KatXH1i5MxWgffx+libLWYLRUPtc6GHOmn+6w==
|
|
+ dependencies:
|
|
+ passport "~0.1.1"
|
|
+ pkginfo "0.2.x"
|
|
+
|
|
passport-slack-oauth2@^1.2.0:
|
|
version "1.2.0"
|
|
resolved "https://registry.yarnpkg.com/passport-slack-oauth2/-/passport-slack-oauth2-1.2.0.tgz#d214a698b55a137393636a26827747f6c436dab4"
|
|
@@ -12134,6 +12142,14 @@ passport@^0.7.0:
|
|
pause "0.0.1"
|
|
utils-merge "^1.0.1"
|
|
|
|
+passport@~0.1.1:
|
|
+ version "0.1.18"
|
|
+ resolved "https://registry.yarnpkg.com/passport/-/passport-0.1.18.tgz#c8264479dcb6414cadbb66752d12b37e0b6525a1"
|
|
+ integrity sha512-qteYojKG/qth7UBbbGU7aqhe5ndJs6YaUkH2B6+7FWQ0OeyYmWknzOATpMhdoSTDcLLliq9n4Fcy1mGs80iUMw==
|
|
+ dependencies:
|
|
+ pause "0.0.1"
|
|
+ pkginfo "0.2.x"
|
|
+
|
|
passthrough-counter@^1.0.0:
|
|
version "1.0.0"
|
|
resolved "https://registry.yarnpkg.com/passthrough-counter/-/passthrough-counter-1.0.0.tgz#1967d9e66da572b5c023c787db112a387ab166fa"
|
|
@@ -12341,6 +12357,11 @@ pkg-up@^3.1.0:
|
|
dependencies:
|
|
find-up "^3.0.0"
|
|
|
|
+pkginfo@0.2.x:
|
|
+ version "0.2.3"
|
|
+ resolved "https://registry.yarnpkg.com/pkginfo/-/pkginfo-0.2.3.tgz#7239c42a5ef6c30b8f328439d9b9ff71042490f8"
|
|
+ integrity sha512-7W7wTrE/NsY8xv/DTGjwNIyNah81EQH0MWcTzrHL6pOpMocOGZc0Mbdz9aXxSrp+U0mSmkU8jrNCDCfUs3sOBg==
|
|
+
|
|
pluralize@^8.0.0:
|
|
version "8.0.0"
|
|
resolved "https://registry.yarnpkg.com/pluralize/-/pluralize-8.0.0.tgz#1a6fa16a38d12a1901e0320fa017051c539ce3b1"
|