Skip to content

Commit

Permalink
Restore client/ to what was there before changes
Browse files Browse the repository at this point in the history
  • Loading branch information
emwalker committed Oct 19, 2024
1 parent 793ec18 commit 8654e0f
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 101 deletions.
2 changes: 1 addition & 1 deletion client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"found-relay": "^0.9.1",
"graphql": "^16.8.1",
"http": "^0.0.1-security",
"http-proxy-middleware": "^3.0.3",
"http-proxy-middleware": "^2.0.6",
"immutability-helper": "~3.1.1",
"isomorphic-fetch": "^3.0.0",
"jest-diff": "^29.6.4",
Expand Down
1 change: 1 addition & 0 deletions client/src/server/auth/withGithub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ type Config = Omit<MutationConfig<createGithubSessionMutation>, 'mutation'>

function createSession(environment: Environment, config: Config) {
return commitMutation<createGithubSessionMutation>(
// @ts-expect-error
environment, { ...config, mutation: createGithubSessionQuery },
)
}
Expand Down
34 changes: 15 additions & 19 deletions client/src/server/configureApiProxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,34 +18,30 @@ export default (app: Express) => {
app.post(
'/graphql',
createProxyMiddleware({
target: `${graphqlApiBaseUrl}/graphql`,
target: graphqlApiBaseUrl,
changeOrigin: true,
pathFilter: '/graphql',
secure: false,
on: {
proxyReq(proxyReq, req: IGetUserAuthInfoRequest) {
const { user } = req
console.log('proxyReq config', user)
onProxyReq(proxyReq, req: IGetUserAuthInfoRequest) {
const { user } = req

if (user && user.id && user.sessionId) {
const { id, sessionId } = user
const secret = basicAuthSecret(id, sessionId)
proxyReq.setHeader('Authorization', `Basic ${secret}`)
} else {
console.log('no user found with the request, omitting basic auth header')
}
},
error(err) {
console.log('problem proxying request to api server:', err)
},
}
if (user && user.id && user.sessionId) {
const { id, sessionId } = user
const secret = basicAuthSecret(id, sessionId)
proxyReq.setHeader('Authorization', `Basic ${secret}`)
} else {
console.log('no user found with the request, omitting basic auth header')
}
},
onError(err) {
console.log('problem proxying request to api server:', err)
},
}),
)

app.get(
'/_ah/health',
createProxyMiddleware({
target: `${graphqlApiBaseUrl}/_ah/health`,
target: graphqlApiBaseUrl,
changeOrigin: true,
secure: false,
}),
Expand Down
15 changes: 7 additions & 8 deletions client/src/server/configurePassport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { FetcherBase } from '../FetcherBase'
import { commitMutation } from 'react-relay'
import { Environment, MutationConfig } from 'relay-runtime'

// @ts-expect-error
const RedisStore = store(session)
const redisClient = createClient({
url: process.env.DIGRAPH_NODE_REDIS_URL || 'redis://localhost:6379',
Expand All @@ -31,19 +32,17 @@ export default (app: Express, fetcher: FetcherBase): Express => {
const environment = createEnvironment(fetcher)

app.use(session({
// @ts-expect-error
store: new RedisStore({
client: redisClient,
logErrors: true,
}),
secret: process.env.DIGRAPH_COOKIE_SECRET || 'keyboard cat',
resave: true,
saveUninitialized: true,
cookie: {
// Expire in one month
maxAge: 1000 * 3600 * 24 * 30,
// Only send the cookie over an HTTPS connection
secure: process.env.NODE_ENV == 'production',
},
secure: process.env.NODE_ENV == 'production',
// Expire in one month
cookie: { maxAge: 1000 * 3600 * 24 * 30 },
}))

app
Expand All @@ -66,15 +65,15 @@ export default (app: Express, fetcher: FetcherBase): Express => {

const onCompleted = () => {
console.log('Deleted session for user', req.user?.id)
req.logout(() => { })
req.logout()
res.redirect('/')
}

const onError = (error: Error) => {
const userId = req.user?.id
// eslint-disable-next-line no-console
console.log(`Failed to delete session for user ${userId}`, error)
req.logout(() => { })
req.logout()
}

deleteSession(environment, { variables, onCompleted, onError })
Expand Down
5 changes: 2 additions & 3 deletions client/src/server/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ app
.disable('x-powered-by')
.use(compression())
.use('/static/images', express.static(imagesDir, { maxAge: oneMonth }))
.use('/static', express.static(publicDir, { maxAge: oneMonth }))
.use('/static', express.static(publicDir, { maxAge: oneMonth }))
.use('/robots.txt', (req, res) => {
res.type('text/plain')
res.send('User-agent: *\nAllow: /\n')
Expand All @@ -55,7 +55,6 @@ app.get('*', async (req, res): Promise<void> => {

try {
const preloadedState = { viewer: req.user }
console.log('preloadedState', preloadedState)

if (req.user) {
const { id, sessionId } = req.user
Expand Down Expand Up @@ -83,7 +82,7 @@ app.get('*', async (req, res): Promise<void> => {

const wrapped = (
<Provider store={store}>
{element}
{ element }
</Provider>
)

Expand Down
83 changes: 16 additions & 67 deletions client/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2559,10 +2559,10 @@
resolved "https://registry.yarnpkg.com/@types/html-minifier-terser/-/html-minifier-terser-6.1.0.tgz#4fc33a00c1d0c16987b1a20cf92d20614c55ac35"
integrity sha512-oh/6byDPnL1zeNXFrDXFLyZjkr1MsBG667IM792caf1L2UPOOMf65NFzjUH/ltyfwjAGfs1rsX1eftK0jC/KIg==

"@types/http-proxy@^1.17.15", "@types/http-proxy@^1.17.8":
version "1.17.15"
resolved "https://registry.yarnpkg.com/@types/http-proxy/-/http-proxy-1.17.15.tgz#12118141ce9775a6499ecb4c01d02f90fc839d36"
integrity sha512-25g5atgiVNTIv0LBDTg1H74Hvayx0ajtJPLLcYE3whFv75J0pWNtOBzaXJQgDTmrX1bx5U9YC2w/n65BN1HwRQ==
"@types/http-proxy@^1.17.8":
version "1.17.9"
resolved "https://registry.yarnpkg.com/@types/http-proxy/-/http-proxy-1.17.9.tgz#7f0e7931343761efde1e2bf48c40f02f3f75705a"
integrity sha512-QsbSjA/fSk7xB+UXlCT3wHBy5ai9wOcNDWwZAtud+jXhwOM3l+EYZh8Lng4+/6n8uar0J7xILzqftJdJ/Wdfkw==
dependencies:
"@types/node" "*"

Expand Down Expand Up @@ -2643,14 +2643,7 @@
resolved "https://registry.yarnpkg.com/@types/mime/-/mime-3.0.1.tgz#5f8f2bca0a5863cb69bc0b0acd88c96cb1d4ae10"
integrity sha512-Y4XFY5VJAuw0FgAqPNd6NNoV44jbq9Bz2L7Rh/J6jLTiHBSBJa9fxqQIvkIld4GsoDOcCbvzOUAbLPsSKKg+uA==

"@types/node@*":
version "22.7.7"
resolved "https://registry.yarnpkg.com/@types/node/-/node-22.7.7.tgz#6cd9541c3dccb4f7e8b141b491443f4a1570e307"
integrity sha512-SRxCrrg9CL/y54aiMCG3edPKdprgMVGDXjA3gB8UmmBW5TcXzRUYAh8EWzTnSJFAd1rgImPELza+A3bJ+qxz8Q==
dependencies:
undici-types "~6.19.2"

"@types/node@^20.8.10":
"@types/node@*", "@types/node@^20.8.10":
version "20.8.10"
resolved "https://registry.yarnpkg.com/@types/node/-/node-20.8.10.tgz#a5448b895c753ae929c26ce85cab557c6d4a365e"
integrity sha512-TlgT8JntpcbmKUFzjhsyhGfP2fsiz1Mv56im6enJ905xG1DAYesxJaeSbGqQmAw8OWPdhyJGhGSQGKRNJ45u9w==
Expand Down Expand Up @@ -4009,14 +4002,7 @@ braces@^2.3.1:
split-string "^3.0.2"
to-regex "^3.0.1"

braces@^3.0.2, braces@^3.0.3:
version "3.0.3"
resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.3.tgz#490332f40919452272d55a8480adc0c441358789"
integrity sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==
dependencies:
fill-range "^7.1.1"

braces@~3.0.2:
braces@^3.0.2, braces@~3.0.2:
version "3.0.2"
resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.2.tgz#3454e1a462ee8d599e236df336cd9ea4f8afe107"
integrity sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==
Expand Down Expand Up @@ -5320,13 +5306,6 @@ debug@^3.2.5, debug@^3.2.6, debug@^3.2.7:
dependencies:
ms "^2.1.1"

debug@^4.3.6:
version "4.3.7"
resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.7.tgz#87945b4151a011d76d95a198d7111c865c360a52"
integrity sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==
dependencies:
ms "^2.1.3"

decamelize@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290"
Expand Down Expand Up @@ -6710,10 +6689,10 @@ fill-range@^4.0.0:
repeat-string "^1.6.1"
to-regex-range "^2.1.0"

fill-range@^7.0.1, fill-range@^7.1.1:
version "7.1.1"
resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.1.1.tgz#44265d3cac07e3ea7dc247516380643754a05292"
integrity sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==
fill-range@^7.0.1:
version "7.0.1"
resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.0.1.tgz#1919a6a7c75fe38b2c7c77e5198535da9acdda40"
integrity sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==
dependencies:
to-regex-range "^5.0.1"

Expand Down Expand Up @@ -6807,9 +6786,9 @@ flatten@^1.0.2:
integrity sha512-dVsPA/UwQ8+2uoFe5GHtiBMu48dWLTdsuEd7CKGlZlD78r1TTWBvDuFaFGKCo/ZfEr95Uk56vZoX86OsHkUeIg==

follow-redirects@^1.0.0:
version "1.15.9"
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.9.tgz#a604fa10e443bf98ca94228d9eebcc2e8a2c8ee1"
integrity sha512-gew4GsXizNgdoRyqmyfMHyAmXsZDk6mHkSxZFCzW9gwlbtOW44CDtYavM+y+72qD/Vq2l550kMF52DT8fOLJqQ==
version "1.15.2"
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.2.tgz#b460864144ba63f2681096f274c4e57026da2c13"
integrity sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==

for-each@^0.3.3:
version "0.3.3"
Expand Down Expand Up @@ -7500,7 +7479,7 @@ http-proxy-agent@^5.0.0:
agent-base "6"
debug "4"

http-proxy-middleware@^2.0.3:
http-proxy-middleware@^2.0.3, http-proxy-middleware@^2.0.6:
version "2.0.6"
resolved "https://registry.yarnpkg.com/http-proxy-middleware/-/http-proxy-middleware-2.0.6.tgz#e1a4dd6979572c7ab5a4e4b55095d1f32a74963f"
integrity sha512-ya/UeJ6HVBYxrgYotAZo1KvPWlgB48kUJLDePFeneHsVujFaW5WNj2NgWCAE//B1Dl02BIfYlpNgBy8Kf8Rjmw==
Expand All @@ -7511,18 +7490,6 @@ http-proxy-middleware@^2.0.3:
is-plain-obj "^3.0.0"
micromatch "^4.0.2"

http-proxy-middleware@^3.0.3:
version "3.0.3"
resolved "https://registry.yarnpkg.com/http-proxy-middleware/-/http-proxy-middleware-3.0.3.tgz#dc1313c75bd00d81e103823802551ee30130ebd1"
integrity sha512-usY0HG5nyDUwtqpiZdETNbmKtw3QQ1jwYFZ9wi5iHzX2BcILwQKtYDJPo7XHTsu5Z0B2Hj3W9NNnbd+AjFWjqg==
dependencies:
"@types/http-proxy" "^1.17.15"
debug "^4.3.6"
http-proxy "^1.18.1"
is-glob "^4.0.3"
is-plain-object "^5.0.0"
micromatch "^4.0.8"

http-proxy@^1.18.1:
version "1.18.1"
resolved "https://registry.yarnpkg.com/http-proxy/-/http-proxy-1.18.1.tgz#401541f0534884bbf95260334e72f88ee3976549"
Expand Down Expand Up @@ -8117,11 +8084,6 @@ is-plain-object@^2.0.3, is-plain-object@^2.0.4:
dependencies:
isobject "^3.0.1"

is-plain-object@^5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/is-plain-object/-/is-plain-object-5.0.0.tgz#4427f50ab3429e9025ea7d52e9043a9ef4159344"
integrity sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q==

is-potential-custom-element-name@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.1.tgz#171ed6f19e3ac554394edf78caa05784a45bebb5"
Expand Down Expand Up @@ -9771,15 +9733,7 @@ micromatch@^3.1.10, micromatch@^3.1.4:
snapdragon "^0.8.1"
to-regex "^3.0.2"

micromatch@^4.0.2, micromatch@^4.0.8:
version "4.0.8"
resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.8.tgz#d66fa18f3a47076789320b9b1af32bd86d9fa202"
integrity sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==
dependencies:
braces "^3.0.3"
picomatch "^2.3.1"

micromatch@^4.0.4:
micromatch@^4.0.2, micromatch@^4.0.4:
version "4.0.5"
resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.5.tgz#bc8999a7cbbf77cdc89f132f6e467051b49090c6"
integrity sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==
Expand Down Expand Up @@ -9968,7 +9922,7 @@ [email protected]:
resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009"
integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==

[email protected], ms@^2.1.1, ms@^2.1.3:
[email protected], ms@^2.1.1:
version "2.1.3"
resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2"
integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==
Expand Down Expand Up @@ -14054,11 +14008,6 @@ undici-types@~5.26.4:
resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-5.26.5.tgz#bcd539893d00b56e964fd2657a4866b221a65617"
integrity sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==

undici-types@~6.19.2:
version "6.19.8"
resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-6.19.8.tgz#35111c9d1437ab83a7cdc0abae2f26d88eda0a02"
integrity sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==

unicode-canonical-property-names-ecmascript@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-2.0.0.tgz#301acdc525631670d39f6146e0e77ff6bbdebddc"
Expand Down
4 changes: 2 additions & 2 deletions k8s/overlays/prod/digraph/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ secretGenerator:

images:
- name: emwalker/digraph-api:latest
newTag: v1.1.14
newTag: v1.1.15
- name: emwalker/digraph-node:latest
newTag: v1.1.14
newTag: v1.1.15
- name: emwalker/digraph-node:next
newTag: v1.2.25
2 changes: 1 addition & 1 deletion k8s/prod-release
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v1.1.14
v1.1.15

0 comments on commit 8654e0f

Please sign in to comment.