From 405600abb1bc82cd1d3e27588ed273e31e591067 Mon Sep 17 00:00:00 2001 From: orhtej2 <2871798+orhtej2@users.noreply.github.com> Date: Mon, 9 Oct 2023 12:12:27 +0200 Subject: [PATCH 01/41] Run migrations in production mode --- scripts/upgrade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index 68f0290..dce33db 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -172,7 +172,7 @@ ynh_script_progression --message="Running DB initial migration..." pushd "$final_path" ynh_use_nodejs - ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH yarn db:migrate + ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH NODE_ENV=production yarn db:migrate popd #================================================= From 20076bbd50fec64de5df741bff1515c0432f9b9e Mon Sep 17 00:00:00 2001 From: Limezy Date: Fri, 13 Oct 2023 00:06:18 +0700 Subject: [PATCH 02/41] Revert "Update for public version" This reverts commit f7a36b2d1e4c1d01f5010abbf3285aad5be73121. --- sources/patches/app-02-visitor.patch | 141 ++++++++++ sources/patches/app-03-login.patch | 59 +++++ sources/patches/app-04-bible.patch | 151 +++++++++++ sources/patches/diff.txt | 380 +++++++++++++++++++++++++++ 4 files changed, 731 insertions(+) create mode 100644 sources/patches/app-02-visitor.patch create mode 100644 sources/patches/app-03-login.patch create mode 100644 sources/patches/app-04-bible.patch create mode 100644 sources/patches/diff.txt diff --git a/sources/patches/app-02-visitor.patch b/sources/patches/app-02-visitor.patch new file mode 100644 index 0000000..6b88247 --- /dev/null +++ b/sources/patches/app-02-visitor.patch @@ -0,0 +1,141 @@ +diff --git a/package.json b/package.json +index fa43b3532..32a658cee 100644 +--- a/package.json ++++ b/package.json +@@ -157,6 +157,7 @@ + "patch-package": "^7.0.2", + "pg": "^8.11.1", + "pg-tsquery": "^8.4.1", ++ "passport-req": "^0.1.1", + "polished": "^4.2.2", + "prosemirror-codemark": "^0.4.2", + "prosemirror-commands": "^1.5.2", +diff --git a/plugins/req/plugin.json b/plugins/req/plugin.json +new file mode 100644 +index 000000000..ae7c40333 +--- /dev/null ++++ b/plugins/req/plugin.json +@@ -0,0 +1,4 @@ ++{ ++ "name": "visiteur", ++ "description": "Adds an req compatible authentication provider." ++} +diff --git a/plugins/req/server/.babelrc b/plugins/req/server/.babelrc +new file mode 100644 +index 000000000..c87001bc4 +--- /dev/null ++++ b/plugins/req/server/.babelrc +@@ -0,0 +1,3 @@ ++{ ++ "extends": "../../../server/.babelrc" ++} +diff --git a/plugins/req/server/auth/req.ts b/plugins/req/server/auth/req.ts +new file mode 100644 +index 000000000..bc03fc6d3 +--- /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 env from "@server/env"; ++import passportMiddleware from "@server/middlewares/passport"; ++import { User } from "@server/models"; ++import { AuthenticationResult } from "@server/types"; ++import { ++ StateStore, ++ getTeamFromContext, ++ getClientFromContext, ++} from "@server/utils/passport"; ++ ++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 = "domain.tld"; ++ 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; +diff --git a/yarn.lock b/yarn.lock +index 0413a0132..a35fe073c 100644 +--- a/yarn.lock ++++ b/yarn.lock +@@ -10340,6 +10340,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" +@@ -10361,6 +10369,14 @@ passport@^0.6.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" diff --git a/sources/patches/app-03-login.patch b/sources/patches/app-03-login.patch new file mode 100644 index 0000000..4ed113a --- /dev/null +++ b/sources/patches/app-03-login.patch @@ -0,0 +1,59 @@ +diff --git a/app/scenes/Login/components/AuthenticationProvider.tsx b/app/scenes/Login/components/AuthenticationProvider.tsx +index af218c06c..b2d93d994 100644 +--- a/app/scenes/Login/components/AuthenticationProvider.tsx ++++ b/app/scenes/Login/components/AuthenticationProvider.tsx +@@ -91,7 +91,7 @@ function AuthenticationProvider(props: Props) { + + +- {t("Sign In")} → ++ {t("S'identifier")} → + + + ) : ( + } fullwidth> +- {t("Continue with Email")} ++ {t("Accès membre (email)")} + + )} + +@@ -120,7 +120,7 @@ function AuthenticationProvider(props: Props) { + icon={} + fullwidth + > +- {t("Continue with {{ authProviderName }}", { ++ {t("Accès {{ authProviderName }}", { + authProviderName: name, + })} + +diff --git a/app/scenes/Login/index.tsx b/app/scenes/Login/index.tsx +index de4245890..c751e3299 100644 +--- a/app/scenes/Login/index.tsx ++++ b/app/scenes/Login/index.tsx +@@ -255,7 +255,7 @@ function Login({ children }: Props) { + ) : ( + <> + +- {t("Login to {{ authProviderName }}", { ++ {t("Bienvenue sur Anthropologie Biblique", { + authProviderName: config.name || env.APP_NAME, + })} + +@@ -273,7 +273,7 @@ function Login({ children }: Props) { + {hasMultipleProviders && ( + <> + +- {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, + })} + diff --git a/sources/patches/app-04-bible.patch b/sources/patches/app-04-bible.patch new file mode 100644 index 0000000..e78078d --- /dev/null +++ b/sources/patches/app-04-bible.patch @@ -0,0 +1,151 @@ +diff --git a/app/editor/menus/block.tsx b/app/editor/menus/block.tsx +index f795fc56d..a4dc4e17a 100644 +--- a/app/editor/menus/block.tsx ++++ b/app/editor/menus/block.tsx +@@ -21,6 +21,7 @@ import { + MathIcon, + DoneIcon, + EmbedIcon, ++ BookmarkedIcon, + } from "outline-icons"; + import * as React from "react"; + import styled from "styled-components"; +@@ -203,6 +204,13 @@ export default function blockMenuItems(dictionary: Dictionary): MenuItem[] { + keywords: "notice card suggestion", + attrs: { style: "tip" }, + }, ++ { ++ name: "container_notice", ++ title: dictionary.bibleNotice, ++ icon: , ++ keywords: "notice card bible", ++ attrs: { style: "bible" }, ++ }, + { + name: "separator", + }, +diff --git a/app/hooks/useDictionary.ts b/app/hooks/useDictionary.ts +index 6472c88cc..8bedb092d 100644 +--- a/app/hooks/useDictionary.ts ++++ b/app/hooks/useDictionary.ts +@@ -78,6 +78,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 8e3542d40..8a7c461af 100644 +--- a/app/scenes/Document/components/Document.tsx ++++ b/app/scenes/Document/components/Document.tsx +@@ -552,11 +552,6 @@ class DocumentScene extends React.Component { + + + +- {isShare && +- !parseDomain(window.location.origin).custom && +- !auth.user && ( +- +- )} + + {!isShare && ( +