8 Commits
10 changed files with 8435 additions and 9394 deletions

No files matched your search

+6
View File
@@ -0,0 +1,6 @@
node_modules
.git
.gitignore
*.md
dist
+20
View File
@@ -0,0 +1,20 @@
# Base
NUXT_API_ORIGIN=http://localhost:8000
# Variants, in the future
NUXT_MAIN_API_ORIGIN=http://localhost:8000
NUXT_BPJS_API_ORIGIN=http://localhost:8001
NUXT_SYNC_API_ORIGIN=http://localhost:8009
NUXT_API_VCLAIM_SWAGGER=https://vclaim-api.multy.chat
# SSO
SSO_CONFIRM_URL=https://auth.dev.rssa.id/realms/sandbox/protocol/openid-connect/userinfo
X_AP_CODE=rssa-sso
X_AP_SECRET_KEY=sapiperah
KEYCLOAK_LOGOUT_REDIRECT=http://localhost:3000/
# test local
KEYCLOAK_REALM=rssa_testing
KEYCLOAK_URL=http://127.0.0.1:8080/
CLIENT_ID=portal-simrs-new
+19
View File
@@ -0,0 +1,19 @@
# Base
NUXT_API_ORIGIN=http://simrs-x-main-api:8000
# Variants, in the future
NUXT_MAIN_API_ORIGIN=http://simrs-x-main-api:8000
NUXT_BPJS_API_ORIGIN=http://simrs-x-bpjs-api:8001
NUXT_SYNC_API_ORIGIN=http://simrs-x-sync-api:8009
NUXT_API_VCLAIM_SWAGGER=https://vclaim-api.multy.chat
# SSO
SSO_CONFIRM_URL =https://auth.dev.rssa.id/realms/sandbox/protocol/openid-connect/userinfo
X_AP_CODE=rssa-sso
X_AP_SECRET_KEY=sapiperah
KEYCLOAK_LOGOUT_REDIRECT=http://localhost:3000/
KEYCLOAK_REALM=rssa_testing
KEYCLOAK_URL=http://127.0.0.1:8080/
CLIENT_ID=portal-simrs-new
-16
View File
@@ -1,16 +0,0 @@
NUXT_MAIN_API_ORIGIN=
NUXT_BPJS_API_ORIGIN=
NUXT_API_VCLAIM_SWAGGER= # https://vclaim-api.multy.chat
NUXT_SYNC_API_ORIGIN=
NUXT_API_ORIGIN=
SSO_CONFIRM_URL =
X_AP_CODE=rssa-sso
X_AP_SECRET_KEY=sapiperah
KEYCLOAK_LOGOUT_REDIRECT=http://localhost:3000/
# test local
KEYCLOAK_REALM=rssa_testing
KEYCLOAK_URL=http://127.0.0.1:8080/
CLIENT_ID=portal-simrs-new
+17 -22
View File
@@ -1,33 +1,28 @@
# Build Stage # syntax = docker/dockerfile:1
FROM node:24-alpine AS build-stage # --- Build Stage ---
FROM node:20-alpine AS build
# Set the working directory inside the container
WORKDIR /app WORKDIR /app
# Enable pnpm using corepack
RUN corepack enable RUN corepack enable
# Copy pnpm related files and package.json to leverage Docker layer caching # Copy package.json and lock file, then install dependencies
COPY package.json pnpm-lock.yaml ./ COPY package.json pnpm-lock.yaml ./
RUN pnpm install
# Install dependencies using pnpm # Copy the rest of the application code and build
# Using --frozen-lockfile ensures consistent installations based on pnpm-lock.yaml
RUN --mount=type=cache,id=pnpm-store,target=/root/.pnpm-store pnpm install --frozen-lockfile
# Copy the rest of the application files
COPY . . COPY . .
# Build the Vue.js application for production
RUN pnpm build RUN pnpm build
# Production Stage # --- Production Stage ---
FROM nginx:stable-alpine AS production-stage FROM node:20-alpine AS prod
WORKDIR /app
# Copy the built Vue.js application from the build stage to Nginx's web root # Only copy the built output from the build stage
COPY --from=build-stage /app/dist /usr/share/nginx/html COPY --from=build /app/.output ./
# Expose port 80 for Nginx # Set environment variables for the server
EXPOSE 80 ENV PORT=3000
ENV HOST=0.0.0.0
EXPOSE $PORT
# Command to run Nginx in the foreground # Start the application
CMD ["nginx", "-g", "daemon off;"] CMD ["node", "server/index.mjs"]
+5 -5
View File
@@ -3,7 +3,7 @@ import type { z } from 'zod'
import { toTypedSchema } from '@vee-validate/zod' import { toTypedSchema } from '@vee-validate/zod'
import { Loader2 } from 'lucide-vue-next' import { Loader2 } from 'lucide-vue-next'
import { useForm } from 'vee-validate' import { useForm } from 'vee-validate'
import { useKeycloak } from "~/composables/useKeycloack" // import { useKeycloak } from "~/composables/useKeycloack"
interface Props { interface Props {
schema: z.ZodSchema<any> schema: z.ZodSchema<any>
@@ -36,19 +36,19 @@ const onSubmit = handleSubmit(async (values) => {
} }
}) })
const { initKeycloak, getProfile, loginSSO } = useKeycloak() // const { initKeycloak, getProfile, loginSSO } = useKeycloak()
const profile = ref<any>(null) const profile = ref<any>(null)
onMounted(async () => { onMounted(async () => {
await initKeycloak('check-sso') // await initKeycloak('check-sso')
profile.value = getProfile() // profile.value = getProfile()
console.log(profile) console.log(profile)
}) })
const onSSO = (async () => { const onSSO = (async () => {
try { try {
const redirect = window.location.origin + '/auth/sso' const redirect = window.location.origin + '/auth/sso'
await loginSSO({ redirectUri: redirect }) // await loginSSO({ redirectUri: redirect })
} catch (error) { } catch (error) {
console.error('Call SSO failed:', error) console.error('Call SSO failed:', error)
} }
+4 -4
View File
@@ -1,6 +1,6 @@
<script setup lang="ts"> <script setup lang="ts">
import { useSidebar } from '~/components/pub/ui/sidebar' import { useSidebar } from '~/components/pub/ui/sidebar'
import { useKeycloak } from "~/composables/useKeycloack" // import { useKeycloak } from "~/composables/useKeycloack"
// defineProps<{ // defineProps<{
// user: { // user: {
@@ -12,15 +12,15 @@ import { useKeycloak } from "~/composables/useKeycloack"
const { isMobile } = useSidebar() const { isMobile } = useSidebar()
const { user, logout, setActiveRole, getActiveRole } = useUserStore() const { user, logout, setActiveRole, getActiveRole } = useUserStore()
const { initKeycloak, logoutSSO } = useKeycloak() // const { initKeycloak, logoutSSO } = useKeycloak()
// const userStore = useUserStore().user // const userStore = useUserStore().user
function handleLogout() { function handleLogout() {
initKeycloak('check-sso') // initKeycloak('check-sso')
navigateTo('/auth/login') navigateTo('/auth/login')
logout() logout()
logoutSSO(window.location.origin + '/auth/login') // logoutSSO(window.location.origin + '/auth/login')
} }
const showModalTheme = ref(false) const showModalTheme = ref(false)
+1
View File
@@ -21,6 +21,7 @@ export function useKeycloak() {
try { try {
const initOptions = { const initOptions = {
onLoad, onLoad,
checkLoginIframe: false as const,
promiseType: "native" as const, promiseType: "native" as const,
pkceMethod: "S256" as const, pkceMethod: "S256" as const,
}; };
+6 -6
View File
@@ -1,4 +1,4 @@
import { useKeycloak } from "~/composables/useKeycloack" // import { useKeycloak } from "~/composables/useKeycloack"
export default defineNuxtRouteMiddleware(async (to) => { export default defineNuxtRouteMiddleware(async (to) => {
if (to.meta.public) return if (to.meta.public) return
@@ -6,17 +6,17 @@ export default defineNuxtRouteMiddleware(async (to) => {
const { $pinia } = useNuxtApp() const { $pinia } = useNuxtApp()
const { initKeycloak, isAuthenticated, getResponse} = useKeycloak(); // global composable // const { initKeycloak, isAuthenticated, getResponse} = useKeycloak(); // global composable
await initKeycloak("check-sso"); // await initKeycloak("check-sso");
if (import.meta.client) { if (import.meta.client) {
const userStore = useUserStore($pinia) const userStore = useUserStore($pinia)
if (!userStore.isAuthenticated && !isAuthenticated.value) { if (!userStore.isAuthenticated && !isAuthenticated.value) {
return navigateTo('/auth/login') return navigateTo('/auth/login')
} else { } else {
if (isAuthenticated.value) { // if (isAuthenticated.value) {
await getResponse() // await getResponse()
} // }
} }
} }
}) })
+8357 -9341
View File
File diff suppressed because it is too large Load diff