Update middleware and deps

This commit is contained in:
Darren Clarke 2023-09-06 16:42:52 +02:00
parent 0b5e242ed0
commit a3d6b786e1
28 changed files with 2246 additions and 2272 deletions

View file

@ -8,9 +8,7 @@ const globalIndex = ".kibana_1";
const dataIndexName = "sample_tagged_tickets";
const userMetadataIndexName = "user_metadata";
// const baseURL = `https://${process.env.OPENSEARCH_USERNAME}:${process.env.OPENSEARCH_PASSWORD}@${process.env.OPENSEARCH_URL}`;
const baseURL = `https://localhost:9200`;
const baseURL = `https://${process.env.OPENSEARCH_USERNAME}:${process.env.OPENSEARCH_PASSWORD}@${process.env.OPENSEARCH_URL}`;
const createClient = () => new Client({
node: baseURL,

View file

@ -17,50 +17,50 @@
"@emotion/react": "^11.11.1",
"@emotion/server": "^11.11.0",
"@emotion/styled": "^11.11.0",
"@fontsource/playfair-display": "^5.0.8",
"@fontsource/playfair-display": "^5.0.11",
"@fontsource/poppins": "^5.0.8",
"@fontsource/roboto": "^5.0.8",
"@mui/icons-material": "^5",
"@mui/lab": "^5.0.0-alpha.140",
"@mui/lab": "^5.0.0-alpha.143",
"@mui/material": "^5",
"@mui/x-data-grid-pro": "^6.11.1",
"@mui/x-date-pickers-pro": "^6.11.1",
"@mui/x-data-grid-pro": "^6.12.1",
"@mui/x-date-pickers-pro": "^6.12.1",
"@opensearch-project/opensearch": "^2.3.1",
"cryptr": "^6.2.0",
"cryptr": "^6.3.0",
"date-fns": "^2.30.0",
"http-proxy-middleware": "^2.0.6",
"leafcutter-common": "*",
"material-ui-popup-state": "^5.0.9",
"next": "13.4.7",
"next": "13.4.19",
"next-auth": "^4.23.1",
"next-http-proxy-middleware": "^1.2.5",
"nodemailer": "^6.9.4",
"nodemailer": "^6.9.5",
"react": "18.2.0",
"react-cookie": "^5.0.0",
"react-cookie": "^6.1.0",
"react-cookie-consent": "^8.0.1",
"react-dom": "18.2.0",
"react-iframe": "^1.8.5",
"react-markdown": "^8.0.7",
"react-polyglot": "^0.7.2",
"sharp": "^0.32.5",
"swr": "^2.2.1",
"tss-react": "^4.8.8",
"swr": "^2.2.2",
"tss-react": "^4.9.0",
"uuid": "^9.0.0"
},
"devDependencies": {
"@babel/core": "^7.22.10",
"@types/node": "^20.5.0",
"@types/react": "18.2.20",
"@types/uuid": "^9.0.2",
"@babel/core": "^7.22.15",
"@types/node": "^20.5.9",
"@types/react": "18.2.21",
"@types/uuid": "^9.0.3",
"babel-loader": "^9.1.3",
"eslint": "^8.47.0",
"eslint": "^8.48.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-next": "^13.4.16",
"eslint-config-next": "^13.4.19",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-import": "^2.28.0",
"eslint-plugin-import": "^2.28.1",
"eslint-plugin-jsx-a11y": "^6.7.1",
"eslint-plugin-prettier": "^5.0.0",
"eslint-plugin-react": "^7.33.2",
"typescript": "5.1.6"
"typescript": "5.2.2"
}
}

View file

@ -18,6 +18,7 @@ const fetchRoles = async () => {
const fetchUser = async (email: string) => {
const url = `${process.env.ZAMMAD_URL}/api/v1/users/search?query=email:${email}&limit=1`;
console.log({ url });
const res = await fetch(url, { headers });
const users = await res.json();
const user = users?.[0];
@ -40,8 +41,8 @@ const getUserRoles = async (email: string) => {
};
const login = async (email: string, password: string) => {
console.log({ email, password });
const url = `${process.env.ZAMMAD_URL}/api/v1/users/me`;
console.log({ url });
const authorization = 'Basic ' + Buffer.from(email + ":" + password).toString('base64');
const res = await fetch(url, {
headers: {
@ -93,6 +94,7 @@ const handler = NextAuth({
callbacks: {
signIn: async ({ user, account, profile }) => {
console.log("SIGN IN");
const roles = await getUserRoles(user.email) ?? [];
return roles.includes("admin") || roles.includes("agent") || process.env.SETUP_MODE === "true";
},

View file

@ -53,7 +53,7 @@ export default withAuth(
url,
} = req;
const noAuthPaths = ["/login", "/zammad/api/v1"];
const noAuthPaths = ["/login", "/api/v1"];
const parsedURL = new URL(url);
const path = parsedURL.pathname;
console.log({ p: parsedURL.pathname });

View file

@ -15,55 +15,55 @@
"@emotion/react": "^11.11.1",
"@emotion/server": "^11.11.0",
"@emotion/styled": "^11.11.0",
"@fontsource/playfair-display": "^5.0.8",
"@fontsource/playfair-display": "^5.0.11",
"@fontsource/poppins": "^5.0.8",
"@fontsource/roboto": "^5.0.8",
"@mui/icons-material": "^5",
"@mui/lab": "^5.0.0-alpha.140",
"@mui/lab": "^5.0.0-alpha.143",
"@mui/material": "^5",
"@mui/x-data-grid-pro": "^6.11.1",
"@mui/x-date-pickers-pro": "^6.11.1",
"cryptr": "^6.2.0",
"@mui/x-data-grid-pro": "^6.12.1",
"@mui/x-date-pickers-pro": "^6.12.1",
"cryptr": "^6.3.0",
"date-fns": "^2.30.0",
"graphql-request": "^6.1.0",
"leafcutter-common": "*",
"material-ui-popup-state": "^5.0.9",
"mui-chips-input": "^2.1.3",
"next": "13.4.16",
"next": "13.4.19",
"next-auth": "^4.23.1",
"ra-data-graphql": "^4.12.2",
"ra-i18n-polyglot": "^4.12.2",
"ra-input-rich-text": "^4.12.3",
"ra-language-english": "^4.12.2",
"ra-data-graphql": "^4.13.0",
"ra-i18n-polyglot": "^4.13.3",
"ra-input-rich-text": "^4.13.3",
"ra-language-english": "^4.13.3",
"ra-postgraphile": "^6.1.1",
"react": "18.2.0",
"react-admin": "^4.12.3",
"react-cookie": "^5.0.0",
"react-admin": "^4.13.3",
"react-cookie": "^6.1.0",
"react-digit-input": "^2.1.0",
"react-dom": "18.2.0",
"react-iframe": "^1.8.5",
"react-polyglot": "^0.7.2",
"react-qr-code": "^2.0.11",
"react-qr-code": "^2.0.12",
"react-timer-hook": "^3.0.7",
"sharp": "^0.32.5",
"swr": "^2.2.1",
"tss-react": "^4.8.8",
"swr": "^2.2.2",
"tss-react": "^4.9.0",
"twilio-client": "^1.15.0"
},
"devDependencies": {
"@babel/core": "^7.22.10",
"@types/node": "^20.5.0",
"@types/react": "18.2.20",
"@types/uuid": "^9.0.2",
"@babel/core": "^7.22.15",
"@types/node": "^20.5.9",
"@types/react": "18.2.21",
"@types/uuid": "^9.0.3",
"babel-loader": "^9.1.3",
"eslint": "^8.47.0",
"eslint": "^8.48.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-next": "^13.4.16",
"eslint-config-next": "^13.4.19",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-import": "^2.28.0",
"eslint-plugin-import": "^2.28.1",
"eslint-plugin-jsx-a11y": "^6.7.1",
"eslint-plugin-prettier": "^5.0.0",
"eslint-plugin-react": "^7.33.2",
"typescript": "5.1.6"
"typescript": "5.2.2"
}
}

View file

@ -30,20 +30,20 @@
"hapi-auth-bearer-token": "^8.0.0",
"hapi-auth-jwt2": "^10.4.0",
"hapi-swagger": "^17.1.0",
"joi": "^17.9.2",
"jsonwebtoken": "^9.0.1",
"joi": "^17.10.1",
"jsonwebtoken": "^9.0.2",
"jwks-rsa": "^3.0.1",
"long": "^5.2.3",
"p-memoize": "^7.1.1",
"pg": "^8.11.2",
"pg": "^8.11.3",
"pg-monitor": "^2.0.0",
"pg-promise": "^11.5.3",
"pg-promise": "^11.5.4",
"postgraphile": "4.12.3",
"postgraphile-plugin-connection-filter": "^2.3.0",
"remeda": "^1.24.1",
"twilio": "^4.15.0",
"remeda": "^1.26.0",
"twilio": "^4.16.0",
"typeorm": "^0.3.17",
"@whiskeysockets/baileys": "^6.4.0"
"@whiskeysockets/baileys": "^6.4.1"
},
"devDependencies": {
"@types/long": "^4.0.2",
@ -58,8 +58,8 @@
"ts-node": "^10.9.1",
"tsc-watch": "^6.0.4",
"tsconfig-link": "*",
"typedoc": "^0.24.8",
"typescript": "^5.1.6"
"typedoc": "^0.25.1",
"typescript": "^5.2.2"
},
"nodemonConfig": {
"ignore": [

View file

@ -23,14 +23,14 @@
"graphql": "15.8.0"
},
"devDependencies": {
"@types/jest": "^29.5.3",
"@types/jest": "^29.5.4",
"pino-pretty": "^10.2.0",
"nodemon": "^3.0.1",
"tsconfig-link": "*",
"eslint-config-link": "*",
"jest-config-link": "*",
"babel-preset-link": "*",
"typescript": "^5.1.6"
"typescript": "^5.2.2"
},
"scripts": {
"migrate": "NODE_ENV=development node --unhandled-rejections=strict build/main/index.js db -- migrate",

View file

@ -13,26 +13,26 @@
"graphile-worker": "^0.13.0",
"html-to-text": "^9.0.5",
"node-fetch": "^3",
"pg-promise": "^11.5.3",
"remeda": "^1.24.1",
"twilio": "^4.15.0"
"pg-promise": "^11.5.4",
"remeda": "^1.26.0",
"twilio": "^4.16.0"
},
"devDependencies": {
"@babel/core": "7.22.10",
"@babel/preset-env": "7.22.10",
"@babel/preset-typescript": "7.22.5",
"@babel/core": "7.22.15",
"@babel/preset-env": "7.22.15",
"@babel/preset-typescript": "7.22.15",
"@types/fluent-ffmpeg": "^2.1.21",
"@types/jest": "^29.5.3",
"eslint": "^8.47.0",
"jest": "^29.6.2",
"jest-circus": "^29.6.2",
"@types/jest": "^29.5.4",
"eslint": "^8.48.0",
"jest": "^29.6.4",
"jest-circus": "^29.6.4",
"jest-junit": "^16.0.0",
"nodemon": "^3.0.1",
"pino-pretty": "^10.2.0",
"prettier": "^3.0.2",
"prettier": "^3.0.3",
"ts-node": "^10.9.1",
"typedoc": "^0.24.8",
"typescript": "^5.1.6"
"typedoc": "^0.25.1",
"typescript": "^5.2.2"
},
"nodemonConfig": {
"ignore": [