Skip to content

Commit 792f3dc

Browse files
authored
Merge pull request #867 from SlideRuleEarth/OAuth2SupportGitHub
O auth2 support GitHub
2 parents ad8a054 + cb85d27 commit 792f3dc

38 files changed

+3793
-734
lines changed

.env.local

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
BASE_URL=http://localhost:5173
2+

.env.prod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
BASE_URL=https://client.slideruleearth.io
2+

.env.test

Lines changed: 0 additions & 1 deletion
This file was deleted.

.gitignore

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# compiled output
22
**/dist
3+
4+
# Python
5+
**/__pycache__/
6+
**/*.pyc
7+
**/*.pyo
38
**/global-s3-assets
49
**/regional-s3-assets
510
**/open-source
@@ -25,7 +30,7 @@ witch.zip
2530
# misc
2631
**/npm-debug.log
2732
**/testem.log
28-
**/.env
33+
**/.env*
2934
# package-lock.json
3035
**/.vscode/settings.json
3136
**/setenv.sh
@@ -68,6 +73,9 @@ override.tf.json
6873
# Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan
6974
# example: *tfplan*
7075

76+
# Infracost cache
77+
.infracost/
78+
7179
# Playwright
7280
node_modules/
7381
/test-results/

.infracost/pricing.gob

-174 Bytes
Binary file not shown.

Makefile

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,13 @@ verify-s3-assets-testsliderule:
7575

7676

7777
live-update-testsliderule: ## Update the web client at testsliderule.org with new build
78-
make live-update S3_BUCKET=testsliderule-webclient DOMAIN_APEX=testsliderule.org DOMAIN=testsliderule.org
78+
make live-update S3_BUCKET=testsliderule-webclient DOMAIN_APEX=testsliderule.org DOMAIN=testsliderule.org
7979

8080
# live-update-demo-dot-slideruleearth: ## Update the web client at demo.slideruleearth.io with new build
8181
# make live-update S3_BUCKET=slideruleearth-demo-dot DOMAIN_APEX=slideruleearth.io DOMAIN=demo.slideruleearth.io
8282

8383
live-update-client-dot-slideruleearth: ## Update the web client at client.slideruleearth.io with new build
84-
make live-update S3_BUCKET=slideruleearth-webclient-dot DOMAIN_APEX=slideruleearth.io DOMAIN=client.slideruleearth.io
84+
make live-update S3_BUCKET=slideruleearth-webclient-dot DOMAIN_APEX=slideruleearth.io DOMAIN=client.slideruleearth.io
8585

8686
convert-icons: ## Convert Maki SVG icons in src/assets/maki-svg to PNGs in public/icons
8787
@echo "🔄 Converting Maki SVG icons to PNGs..."
@@ -124,13 +124,13 @@ destroy: # Destroy the web client
124124

125125
deploy-client-to-testsliderule: ## Deploy the web client to the testsliderule.org cloudfront and update the s3 bucket
126126
make deploy DOMAIN=testsliderule.org S3_BUCKET=testsliderule-webclient && \
127-
make live-update DOMAIN=testsliderule.org S3_BUCKET=testsliderule-webclient DOMAIN_APEX=testsliderule.org
127+
make live-update DOMAIN=testsliderule.org S3_BUCKET=testsliderule-webclient DOMAIN_APEX=testsliderule.org
128128

129129
destroy-client-testsliderule: ## Destroy the web client from the testsliderule.org cloudfront and remove the S3 bucket
130130
make destroy DOMAIN=testsliderule.org S3_BUCKET=testsliderule-webclient DOMAIN_APEX=testsliderule.org
131131

132132
release-live-update-to-testsliderule: src-tag-and-push ## Release the web client to the live environment NEEDS VERSION
133-
make live-update DOMAIN=testsliderule.org S3_BUCKET=testsliderule-webclient DOMAIN_APEX=testsliderule.org
133+
make live-update DOMAIN=testsliderule.org S3_BUCKET=testsliderule-webclient DOMAIN_APEX=testsliderule.org
134134

135135
# deploy-client-to-demo-dot-slideruleearth: ## Deploy the web client to the demo.slideruleearth.io cloudfront and update the s3 bucket
136136
# make deploy DOMAIN=demo.slideruleearth.io S3_BUCKET=slideruleearth-demo-dot DOMAIN_APEX=slideruleearth.io && \
@@ -222,7 +222,8 @@ check-vars:
222222
@echo " DOMAIN_APEX = $(DOMAIN_APEX)"
223223
@echo " S3_BUCKET = $(S3_BUCKET)"
224224
@echo " DISTRIBUTION_ID = $(DISTRIBUTION_ID)"
225-
225+
226+
226227
help: ## That's me!
227228
@printf "\033[37m%-30s\033[0m %s\n" "#-----------------------------------------------------------------------------------------"
228229
@printf "\033[37m%-30s\033[0m %s\n" "# Makefile Help "

web-client/src/App.vue

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import { useRecTreeStore } from '@/stores/recTreeStore'
1616
import { useRoute } from 'vue-router'
1717
import SrClearCache from '@/components/SrClearCache.vue'
1818
import { useSysConfigStore } from '@/stores/sysConfigStore'
19-
import { useJwtStore } from '@/stores/SrJWTStore'
19+
import { useLegacyJwtStore } from '@/stores/SrLegacyJwtStore'
2020
import { useAuthDialogStore } from '@/stores/authDialogStore'
2121
import { useGoogleApiKeyStore } from '@/stores/googleApiKeyStore'
2222
import SrJsonDisplayDialog from '@/components/SrJsonDisplayDialog.vue'
@@ -30,6 +30,8 @@ import { useTourStore } from '@/stores/tourStore.js'
3030
import { useViewportHeight } from '@/composables/useViewportHeight'
3131
import { useSlideruleDefaults } from '@/stores/defaultsStore'
3232
import { createLogger } from '@/utils/logger'
33+
import { usePrivacyConsentStore } from '@/stores/privacyConsentStore'
34+
import SrConsentBanner from '@/components/SrConsentBanner.vue'
3335
3436
const logger = createLogger('App')
3537
@@ -39,9 +41,10 @@ const toast = useToast()
3941
const deviceStore = useDeviceStore()
4042
const tourStore = useTourStore()
4143
const sysConfigStore = useSysConfigStore()
42-
const jwtStore = useJwtStore()
44+
const legacyJwtStore = useLegacyJwtStore()
4345
const authDialogStore = useAuthDialogStore()
4446
const googleApiKeyStore = useGoogleApiKeyStore()
47+
const privacyConsentStore = usePrivacyConsentStore()
4548
const route = useRoute()
4649
4750
// Global login dialog state
@@ -66,16 +69,16 @@ const checkUnsupported = () => {
6669
}
6770
6871
const checkPrivateClusterAuth = () => {
69-
const domain = sysConfigStore.getDomain()
70-
const org = sysConfigStore.getOrganization()
72+
const domain = sysConfigStore.domain
73+
const org = sysConfigStore.cluster
7174
7275
// Skip check for public cluster
7376
if (org === 'sliderule') {
7477
return
7578
}
7679
7780
// Check if user has valid credentials for this private cluster
78-
const jwt = jwtStore.getCredentials()
81+
const jwt = legacyJwtStore.getCredentials()
7982
if (!jwt) {
8083
toast.add({
8184
severity: 'warn',
@@ -89,10 +92,10 @@ const checkPrivateClusterAuth = () => {
8992
}
9093
9194
async function fetchOrgInfo(): Promise<void> {
92-
const psHost = `https://ps.${sysConfigStore.getDomain()}`
95+
const psHost = `https://ps.${sysConfigStore.domain}`
9396
try {
9497
const response = await authenticatedFetch(
95-
`${psHost}/api/org_num_nodes/${sysConfigStore.getOrganization()}/`,
98+
`${psHost}/api/org_num_nodes/${sysConfigStore.cluster}/`,
9699
{
97100
method: 'GET',
98101
headers: {
@@ -105,10 +108,10 @@ async function fetchOrgInfo(): Promise<void> {
105108
if (response.ok) {
106109
const result = await response.json()
107110
logger.debug('fetchOrgInfo result', { result })
108-
sysConfigStore.setMinNodes(result.min_nodes)
109-
sysConfigStore.setCurrentNodes(result.current_nodes)
110-
sysConfigStore.setMaxNodes(result.max_nodes)
111-
sysConfigStore.setVersion(result.version)
111+
sysConfigStore.min_nodes = result.min_nodes
112+
sysConfigStore.current_nodes = result.current_nodes
113+
sysConfigStore.max_nodes = result.max_nodes
114+
sysConfigStore.version = result.version
112115
} else {
113116
logger.error('Failed to fetch org info', { status: response.status })
114117
}
@@ -120,8 +123,8 @@ async function fetchOrgInfo(): Promise<void> {
120123
}
121124
122125
async function handleGlobalLogin(): Promise<void> {
123-
const orgName = sysConfigStore.getOrganization()
124-
const psHost = `https://ps.${sysConfigStore.getDomain()}`
126+
const orgName = sysConfigStore.cluster
127+
const psHost = `https://ps.${sysConfigStore.domain}`
125128
logger.debug('handleGlobalLogin', { username: loginUsername.value, orgName })
126129
127130
const body = JSON.stringify({
@@ -145,7 +148,7 @@ async function handleGlobalLogin(): Promise<void> {
145148
refreshToken: result.refresh,
146149
expiration: result.expiration
147150
}
148-
jwtStore.setJwt(sysConfigStore.getDomain(), sysConfigStore.getOrganization(), jwt)
151+
legacyJwtStore.setJwt(sysConfigStore.domain, sysConfigStore.cluster, jwt)
149152
await fetchOrgInfo()
150153
toast.add({
151154
severity: 'success',
@@ -180,7 +183,7 @@ async function handleGlobalLogin(): Promise<void> {
180183
}
181184
182185
async function resetToPublicCluster() {
183-
jwtStore.clearAllJwts()
186+
legacyJwtStore.clearAllJwts()
184187
sysConfigStore.$reset()
185188
loginUsername.value = ''
186189
loginPassword.value = ''
@@ -348,6 +351,7 @@ onMounted(async () => {
348351
checkUnsupported()
349352
checkPrivateClusterAuth()
350353
tourStore.checkSeen()
354+
privacyConsentStore.initializeOnStartup()
351355
await nextTick()
352356
353357
if (!tourStore.hasSeenIntro) {
@@ -694,6 +698,7 @@ async function handleLongTourButtonClick() {
694698
<div class="sliderule-content">
695699
<RouterView />
696700
</div>
701+
<SrConsentBanner />
697702

698703
<!-- Dialog for displaying version information -->
699704
<Dialog
@@ -834,7 +839,7 @@ async function handleLongTourButtonClick() {
834839
>
835840
<form class="sr-global-login-form" @submit.prevent="handleGlobalLogin">
836841
<p class="sr-login-org-info">
837-
Logging in to: <strong>{{ sysConfigStore.getOrganization() }}</strong>
842+
Logging in to: <strong>{{ sysConfigStore.cluster }}</strong>
838843
</p>
839844
<div class="sr-login-field">
840845
<label for="global-username">Username</label>

0 commit comments

Comments
 (0)