feat: upgrade to SQLite session & data store with zero-data-loss migration, dark theme, and Turkish i18n
This commit is contained in:
parent
1af973d001
commit
56274f479b
27 changed files with 4222 additions and 1360 deletions
|
|
@ -3,5 +3,10 @@ dist
|
||||||
.git
|
.git
|
||||||
.env
|
.env
|
||||||
*.log
|
*.log
|
||||||
|
.DS_Store
|
||||||
data/*.json
|
data/*.json
|
||||||
|
data/*.bak
|
||||||
|
data/*.db
|
||||||
|
data/*.db-*
|
||||||
|
data/.secrets.json
|
||||||
!data/.gitkeep
|
!data/.gitkeep
|
||||||
|
|
|
||||||
4
.gitignore
vendored
4
.gitignore
vendored
|
|
@ -2,6 +2,10 @@ node_modules/
|
||||||
dist/
|
dist/
|
||||||
.env
|
.env
|
||||||
data/*.json
|
data/*.json
|
||||||
|
data/*.bak
|
||||||
|
data/*.db
|
||||||
|
data/*.db-*
|
||||||
|
data/.secrets.json
|
||||||
!data/.gitkeep
|
!data/.gitkeep
|
||||||
*.log
|
*.log
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
|
|
||||||
18
Dockerfile
18
Dockerfile
|
|
@ -1,12 +1,14 @@
|
||||||
# ----------------------------------------------------
|
# ----------------------------------------------------
|
||||||
# Stage 1: Build TypeScript Application
|
# Stage 1: Build TypeScript Application & Native Addons
|
||||||
# ----------------------------------------------------
|
# ----------------------------------------------------
|
||||||
FROM node:18-alpine AS builder
|
FROM node:18-alpine AS builder
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
|
RUN apk add --no-cache python3 make g++
|
||||||
|
|
||||||
COPY package*.json ./
|
COPY package*.json ./
|
||||||
RUN npm install
|
RUN npm ci
|
||||||
|
|
||||||
COPY tsconfig.json ./
|
COPY tsconfig.json ./
|
||||||
COPY src/ ./src/
|
COPY src/ ./src/
|
||||||
|
|
@ -14,6 +16,7 @@ COPY views/ ./views/
|
||||||
COPY public/ ./public/
|
COPY public/ ./public/
|
||||||
|
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
RUN npm prune --omit=dev
|
||||||
|
|
||||||
# ----------------------------------------------------
|
# ----------------------------------------------------
|
||||||
# Stage 2: Production Runtime
|
# Stage 2: Production Runtime
|
||||||
|
|
@ -26,16 +29,17 @@ ENV NODE_ENV=production
|
||||||
ENV PORT=3000
|
ENV PORT=3000
|
||||||
|
|
||||||
COPY package*.json ./
|
COPY package*.json ./
|
||||||
RUN npm install --omit=dev
|
COPY --from=builder /app/node_modules ./node_modules
|
||||||
|
|
||||||
# Copy compiled code and assets from builder
|
|
||||||
COPY --from=builder /app/dist ./dist
|
COPY --from=builder /app/dist ./dist
|
||||||
COPY views/ ./views
|
COPY views/ ./views
|
||||||
COPY public/ ./public
|
COPY public/ ./public
|
||||||
|
|
||||||
# Ensure local data directory exists for persistent JSON db
|
# Ensure local data directory exists for persistent SQLite db & secrets
|
||||||
RUN mkdir -p /app/data
|
RUN mkdir -p /app/data && chown -R node:node /app
|
||||||
|
|
||||||
EXPOSE 3000
|
EXPOSE 3000
|
||||||
|
|
||||||
|
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
|
||||||
|
CMD wget -qO- http://localhost:3000/login > /dev/null || exit 1
|
||||||
|
|
||||||
CMD ["node", "dist/server.js"]
|
CMD ["node", "dist/server.js"]
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,8 @@ services:
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
environment:
|
environment:
|
||||||
- PORT=3000
|
- PORT=3000
|
||||||
- SESSION_SECRET=${SESSION_SECRET:-bekultur_default_secret_key_change_me}
|
- SESSION_SECRET=${SESSION_SECRET:-}
|
||||||
|
- ENCRYPTION_SECRET=${ENCRYPTION_SECRET:-}
|
||||||
- NODE_ENV=production
|
- NODE_ENV=production
|
||||||
volumes:
|
volumes:
|
||||||
- ./data:/app/data
|
- ./data:/app/data
|
||||||
|
|
|
||||||
437
package-lock.json
generated
437
package-lock.json
generated
|
|
@ -10,15 +10,19 @@
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"axios": "^1.7.7",
|
"axios": "^1.7.7",
|
||||||
|
"better-sqlite3": "^11.10.0",
|
||||||
"cheerio": "^1.0.0-rc.12",
|
"cheerio": "^1.0.0-rc.12",
|
||||||
"cookie-parser": "^1.4.7",
|
"cookie-parser": "^1.4.7",
|
||||||
"dotenv": "^16.4.5",
|
"dotenv": "^16.4.5",
|
||||||
"ejs": "^3.1.10",
|
"ejs": "^3.1.10",
|
||||||
"express": "^4.21.1",
|
"express": "^4.21.1",
|
||||||
"express-session": "^1.18.1"
|
"express-rate-limit": "^8.7.3",
|
||||||
|
"express-session": "^1.18.1",
|
||||||
|
"helmet": "^8.3.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@resvg/resvg-js": "^2.6.2",
|
"@resvg/resvg-js": "^2.6.2",
|
||||||
|
"@types/better-sqlite3": "^9.6.0",
|
||||||
"@types/cookie-parser": "^1.4.7",
|
"@types/cookie-parser": "^1.4.7",
|
||||||
"@types/ejs": "^3.1.5",
|
"@types/ejs": "^3.1.5",
|
||||||
"@types/express": "^4.17.21",
|
"@types/express": "^4.17.21",
|
||||||
|
|
@ -306,6 +310,15 @@
|
||||||
"integrity": "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==",
|
"integrity": "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"node_modules/@types/better-sqlite3": {
|
||||||
|
"version": "9.6.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/better-sqlite3/-/better-sqlite3-9.6.0.tgz",
|
||||||
|
"integrity": "sha512-ZEEwBSgMu7GYJOynoagg5X9JbxfL6dTJDsgViJIqh67jV44kyOr9RXfmFjLK5rzC4MWssP06t9hu/JwGDnUbCg==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"@types/node": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@types/body-parser": {
|
"node_modules/@types/body-parser": {
|
||||||
"version": "1.19.6",
|
"version": "1.19.6",
|
||||||
"resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.19.6.tgz",
|
"resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.19.6.tgz",
|
||||||
|
|
@ -566,6 +579,35 @@
|
||||||
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
|
||||||
"integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="
|
"integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="
|
||||||
},
|
},
|
||||||
|
"node_modules/base64-js": {
|
||||||
|
"version": "1.5.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz",
|
||||||
|
"integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==",
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"type": "github",
|
||||||
|
"url": "https://github.com/sponsors/feross"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "patreon",
|
||||||
|
"url": "https://www.patreon.com/feross"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "consulting",
|
||||||
|
"url": "https://feross.org/support"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"node_modules/better-sqlite3": {
|
||||||
|
"version": "11.10.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/better-sqlite3/-/better-sqlite3-11.10.0.tgz",
|
||||||
|
"integrity": "sha512-EwhOpyXiOEL/lKzHz9AW1msWFNzGc/z+LzeB3/jnFJpxu+th2yqvzsSWas1v9jgs9+xiXJcD5A8CJxAG2TaghQ==",
|
||||||
|
"hasInstallScript": true,
|
||||||
|
"dependencies": {
|
||||||
|
"bindings": "^1.5.0",
|
||||||
|
"prebuild-install": "^7.1.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/binary-extensions": {
|
"node_modules/binary-extensions": {
|
||||||
"version": "2.3.0",
|
"version": "2.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz",
|
||||||
|
|
@ -578,6 +620,24 @@
|
||||||
"url": "https://github.com/sponsors/sindresorhus"
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/bindings": {
|
||||||
|
"version": "1.5.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz",
|
||||||
|
"integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==",
|
||||||
|
"dependencies": {
|
||||||
|
"file-uri-to-path": "1.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/bl": {
|
||||||
|
"version": "4.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz",
|
||||||
|
"integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==",
|
||||||
|
"dependencies": {
|
||||||
|
"buffer": "^5.5.0",
|
||||||
|
"inherits": "^2.0.4",
|
||||||
|
"readable-stream": "^3.4.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/body-parser": {
|
"node_modules/body-parser": {
|
||||||
"version": "1.20.8",
|
"version": "1.20.8",
|
||||||
"resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.8.tgz",
|
"resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.8.tgz",
|
||||||
|
|
@ -637,6 +697,29 @@
|
||||||
"node": ">=8"
|
"node": ">=8"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/buffer": {
|
||||||
|
"version": "5.7.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz",
|
||||||
|
"integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==",
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"type": "github",
|
||||||
|
"url": "https://github.com/sponsors/feross"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "patreon",
|
||||||
|
"url": "https://www.patreon.com/feross"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "consulting",
|
||||||
|
"url": "https://feross.org/support"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"dependencies": {
|
||||||
|
"base64-js": "^1.3.1",
|
||||||
|
"ieee754": "^1.1.13"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/buffer-from": {
|
"node_modules/buffer-from": {
|
||||||
"version": "1.1.2",
|
"version": "1.1.2",
|
||||||
"resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz",
|
"resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz",
|
||||||
|
|
@ -738,6 +821,11 @@
|
||||||
"fsevents": "~2.3.2"
|
"fsevents": "~2.3.2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/chownr": {
|
||||||
|
"version": "1.1.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz",
|
||||||
|
"integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg=="
|
||||||
|
},
|
||||||
"node_modules/combined-stream": {
|
"node_modules/combined-stream": {
|
||||||
"version": "1.0.8",
|
"version": "1.0.8",
|
||||||
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
|
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
|
||||||
|
|
@ -839,6 +927,28 @@
|
||||||
"ms": "2.0.0"
|
"ms": "2.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/decompress-response": {
|
||||||
|
"version": "6.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-6.0.0.tgz",
|
||||||
|
"integrity": "sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==",
|
||||||
|
"dependencies": {
|
||||||
|
"mimic-response": "^3.1.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=10"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/deep-extend": {
|
||||||
|
"version": "0.6.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz",
|
||||||
|
"integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=4.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/delayed-stream": {
|
"node_modules/delayed-stream": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
|
||||||
|
|
@ -864,6 +974,14 @@
|
||||||
"npm": "1.2.8000 || >= 1.4.16"
|
"npm": "1.2.8000 || >= 1.4.16"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/detect-libc": {
|
||||||
|
"version": "2.1.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.1.2.tgz",
|
||||||
|
"integrity": "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/diff": {
|
"node_modules/diff": {
|
||||||
"version": "4.0.4",
|
"version": "4.0.4",
|
||||||
"resolved": "https://registry.npmjs.org/diff/-/diff-4.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/diff/-/diff-4.0.4.tgz",
|
||||||
|
|
@ -984,6 +1102,14 @@
|
||||||
"node": ">= 0.8"
|
"node": ">= 0.8"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/end-of-stream": {
|
||||||
|
"version": "1.4.5",
|
||||||
|
"resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.5.tgz",
|
||||||
|
"integrity": "sha512-ooEGc6HP26xXq/N+GCGOT0JKCLDGrq2bQUZrQ7gyrJiZANJ/8YDTxTpQBXGMn+WbIQXNVpyWymm7KYVICQnyOg==",
|
||||||
|
"dependencies": {
|
||||||
|
"once": "^1.4.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/entities": {
|
"node_modules/entities": {
|
||||||
"version": "4.5.0",
|
"version": "4.5.0",
|
||||||
"resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz",
|
"resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz",
|
||||||
|
|
@ -1049,6 +1175,14 @@
|
||||||
"node": ">= 0.6"
|
"node": ">= 0.6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/expand-template": {
|
||||||
|
"version": "2.0.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/expand-template/-/expand-template-2.0.3.tgz",
|
||||||
|
"integrity": "sha512-XYfuKMvj4O35f/pOXLObndIRvyQ+/+6AhODh+OKWj9S9498pHHn/IMszH+gt0fBCRWMNfk1ZSp5x3AifmnI2vg==",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=6"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/express": {
|
"node_modules/express": {
|
||||||
"version": "4.22.3",
|
"version": "4.22.3",
|
||||||
"resolved": "https://registry.npmjs.org/express/-/express-4.22.3.tgz",
|
"resolved": "https://registry.npmjs.org/express/-/express-4.22.3.tgz",
|
||||||
|
|
@ -1094,6 +1228,45 @@
|
||||||
"url": "https://opencollective.com/express"
|
"url": "https://opencollective.com/express"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/express-rate-limit": {
|
||||||
|
"version": "8.7.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/express-rate-limit/-/express-rate-limit-8.7.3.tgz",
|
||||||
|
"integrity": "sha512-zPLqDI2f0gV2WmGnacLf9XSSqn4VldRyP5LCzOwx0BKH40mO6+2PCFkoSsRO2jePx87/Kf6NUF6P2QOTKXHbQA==",
|
||||||
|
"dependencies": {
|
||||||
|
"debug": "^4.4.3",
|
||||||
|
"ip-address": "^10.2.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 16"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/express-rate-limit"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"express": ">= 4.11"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/express-rate-limit/node_modules/debug": {
|
||||||
|
"version": "4.4.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz",
|
||||||
|
"integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==",
|
||||||
|
"dependencies": {
|
||||||
|
"ms": "^2.1.3"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=6.0"
|
||||||
|
},
|
||||||
|
"peerDependenciesMeta": {
|
||||||
|
"supports-color": {
|
||||||
|
"optional": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/express-rate-limit/node_modules/ms": {
|
||||||
|
"version": "2.1.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
|
||||||
|
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="
|
||||||
|
},
|
||||||
"node_modules/express-session": {
|
"node_modules/express-session": {
|
||||||
"version": "1.19.0",
|
"version": "1.19.0",
|
||||||
"resolved": "https://registry.npmjs.org/express-session/-/express-session-1.19.0.tgz",
|
"resolved": "https://registry.npmjs.org/express-session/-/express-session-1.19.0.tgz",
|
||||||
|
|
@ -1121,6 +1294,11 @@
|
||||||
"resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.7.tgz",
|
"resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.7.tgz",
|
||||||
"integrity": "sha512-NXdYc3dLr47pBkpUCHtKSwIOQXLVn8dZEuywboCOJY/osA0wFSLlSawr3KN8qXJEyX66FcONTH8EIlVuK0yyFA=="
|
"integrity": "sha512-NXdYc3dLr47pBkpUCHtKSwIOQXLVn8dZEuywboCOJY/osA0wFSLlSawr3KN8qXJEyX66FcONTH8EIlVuK0yyFA=="
|
||||||
},
|
},
|
||||||
|
"node_modules/file-uri-to-path": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz",
|
||||||
|
"integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw=="
|
||||||
|
},
|
||||||
"node_modules/filelist": {
|
"node_modules/filelist": {
|
||||||
"version": "1.0.6",
|
"version": "1.0.6",
|
||||||
"resolved": "https://registry.npmjs.org/filelist/-/filelist-1.0.6.tgz",
|
"resolved": "https://registry.npmjs.org/filelist/-/filelist-1.0.6.tgz",
|
||||||
|
|
@ -1208,6 +1386,11 @@
|
||||||
"node": ">= 0.6"
|
"node": ">= 0.6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/fs-constants": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz",
|
||||||
|
"integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow=="
|
||||||
|
},
|
||||||
"node_modules/fs.realpath": {
|
"node_modules/fs.realpath": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
|
||||||
|
|
@ -1271,6 +1454,11 @@
|
||||||
"node": ">= 0.4"
|
"node": ">= 0.4"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/github-from-package": {
|
||||||
|
"version": "0.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/github-from-package/-/github-from-package-0.0.0.tgz",
|
||||||
|
"integrity": "sha512-SyHy3T1v2NUXn29OsWdxmK6RwHD+vkj3v8en8AOBZ1wBQ/hCAQ5bAQTD02kW4W9tUp/3Qh6J8r9EvntiyCmOOw=="
|
||||||
|
},
|
||||||
"node_modules/glob": {
|
"node_modules/glob": {
|
||||||
"version": "7.2.3",
|
"version": "7.2.3",
|
||||||
"resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz",
|
"resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz",
|
||||||
|
|
@ -1373,6 +1561,17 @@
|
||||||
"node": ">= 0.4"
|
"node": ">= 0.4"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/helmet": {
|
||||||
|
"version": "8.3.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/helmet/-/helmet-8.3.0.tgz",
|
||||||
|
"integrity": "sha512-Qgpiaws3Sm30Av8Eah6sjMCZZwjlBu+E68rhpCWBshY1lb09HtLwj5GviX0OyQIn+ulUS0iX0AxN5n3tLZzz1w==",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18.0.0"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/EvanHahn"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/htmlparser2": {
|
"node_modules/htmlparser2": {
|
||||||
"version": "8.0.2",
|
"version": "8.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-8.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-8.0.2.tgz",
|
||||||
|
|
@ -1443,6 +1642,25 @@
|
||||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
|
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
|
||||||
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="
|
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="
|
||||||
},
|
},
|
||||||
|
"node_modules/ieee754": {
|
||||||
|
"version": "1.2.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz",
|
||||||
|
"integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==",
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"type": "github",
|
||||||
|
"url": "https://github.com/sponsors/feross"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "patreon",
|
||||||
|
"url": "https://www.patreon.com/feross"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "consulting",
|
||||||
|
"url": "https://feross.org/support"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
"node_modules/inflight": {
|
"node_modules/inflight": {
|
||||||
"version": "1.0.6",
|
"version": "1.0.6",
|
||||||
"resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
|
"resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
|
||||||
|
|
@ -1459,6 +1677,19 @@
|
||||||
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
|
||||||
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
|
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
|
||||||
},
|
},
|
||||||
|
"node_modules/ini": {
|
||||||
|
"version": "1.3.8",
|
||||||
|
"resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz",
|
||||||
|
"integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew=="
|
||||||
|
},
|
||||||
|
"node_modules/ip-address": {
|
||||||
|
"version": "10.7.6",
|
||||||
|
"resolved": "https://registry.npmjs.org/ip-address/-/ip-address-10.7.6.tgz",
|
||||||
|
"integrity": "sha512-00LYkM6byILa9eQIx6qoaXCM40xTLd56AZ4vyaPW3YTyb49VZYPo5xsiAq4tuQ54GH4R7gVdYScJ1B7B77PuTg==",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 12"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/ipaddr.js": {
|
"node_modules/ipaddr.js": {
|
||||||
"version": "1.9.1",
|
"version": "1.9.1",
|
||||||
"resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz",
|
"resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz",
|
||||||
|
|
@ -1608,6 +1839,17 @@
|
||||||
"node": ">= 0.6"
|
"node": ">= 0.6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/mimic-response": {
|
||||||
|
"version": "3.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-3.1.0.tgz",
|
||||||
|
"integrity": "sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=10"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/minimatch": {
|
"node_modules/minimatch": {
|
||||||
"version": "5.1.9",
|
"version": "5.1.9",
|
||||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.9.tgz",
|
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.9.tgz",
|
||||||
|
|
@ -1623,7 +1865,6 @@
|
||||||
"version": "1.2.8",
|
"version": "1.2.8",
|
||||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz",
|
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz",
|
||||||
"integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==",
|
"integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==",
|
||||||
"dev": true,
|
|
||||||
"funding": {
|
"funding": {
|
||||||
"url": "https://github.com/sponsors/ljharb"
|
"url": "https://github.com/sponsors/ljharb"
|
||||||
}
|
}
|
||||||
|
|
@ -1640,11 +1881,21 @@
|
||||||
"node": ">=10"
|
"node": ">=10"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/mkdirp-classic": {
|
||||||
|
"version": "0.5.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz",
|
||||||
|
"integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A=="
|
||||||
|
},
|
||||||
"node_modules/ms": {
|
"node_modules/ms": {
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
|
||||||
"integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A=="
|
"integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A=="
|
||||||
},
|
},
|
||||||
|
"node_modules/napi-build-utils": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/napi-build-utils/-/napi-build-utils-2.0.0.tgz",
|
||||||
|
"integrity": "sha512-GEbrYkbfF7MoNaoh2iGG84Mnf/WZfB0GdGEsM8wz7Expx/LlWf5U8t9nvJKXSp3qr5IsEbK04cBGhol/KwOsWA=="
|
||||||
|
},
|
||||||
"node_modules/negotiator": {
|
"node_modules/negotiator": {
|
||||||
"version": "0.6.3",
|
"version": "0.6.3",
|
||||||
"resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz",
|
"resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz",
|
||||||
|
|
@ -1653,6 +1904,17 @@
|
||||||
"node": ">= 0.6"
|
"node": ">= 0.6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/node-abi": {
|
||||||
|
"version": "3.101.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.101.0.tgz",
|
||||||
|
"integrity": "sha512-bkb/RkuWCE64eWu1PCh3Fu2pGc9mKRs+kOE+FU2bGHRYlQa86/D321DSATV54AsCQMKz3/xSt9sRgraZTpqdhQ==",
|
||||||
|
"dependencies": {
|
||||||
|
"semver": "^7.3.5"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=10"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/normalize-path": {
|
"node_modules/normalize-path": {
|
||||||
"version": "3.0.0",
|
"version": "3.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz",
|
||||||
|
|
@ -1707,7 +1969,6 @@
|
||||||
"version": "1.4.0",
|
"version": "1.4.0",
|
||||||
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
|
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
|
||||||
"integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==",
|
"integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==",
|
||||||
"dev": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"wrappy": "1"
|
"wrappy": "1"
|
||||||
}
|
}
|
||||||
|
|
@ -1800,6 +2061,32 @@
|
||||||
"url": "https://github.com/sponsors/jonschlinkert"
|
"url": "https://github.com/sponsors/jonschlinkert"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/prebuild-install": {
|
||||||
|
"version": "7.1.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/prebuild-install/-/prebuild-install-7.1.3.tgz",
|
||||||
|
"integrity": "sha512-8Mf2cbV7x1cXPUILADGI3wuhfqWvtiLA1iclTDbFRZkgRQS0NqsPZphna9V+HyTEadheuPmjaJMsbzKQFOzLug==",
|
||||||
|
"deprecated": "No longer maintained. Please contact the author of the relevant native addon; alternatives are available.",
|
||||||
|
"dependencies": {
|
||||||
|
"detect-libc": "^2.0.0",
|
||||||
|
"expand-template": "^2.0.3",
|
||||||
|
"github-from-package": "0.0.0",
|
||||||
|
"minimist": "^1.2.3",
|
||||||
|
"mkdirp-classic": "^0.5.3",
|
||||||
|
"napi-build-utils": "^2.0.0",
|
||||||
|
"node-abi": "^3.3.0",
|
||||||
|
"pump": "^3.0.0",
|
||||||
|
"rc": "^1.2.7",
|
||||||
|
"simple-get": "^4.0.0",
|
||||||
|
"tar-fs": "^2.0.0",
|
||||||
|
"tunnel-agent": "^0.6.0"
|
||||||
|
},
|
||||||
|
"bin": {
|
||||||
|
"prebuild-install": "bin.js"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=10"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/proxy-addr": {
|
"node_modules/proxy-addr": {
|
||||||
"version": "2.0.8",
|
"version": "2.0.8",
|
||||||
"resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.8.tgz",
|
"resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.8.tgz",
|
||||||
|
|
@ -1824,6 +2111,15 @@
|
||||||
"node": ">=10"
|
"node": ">=10"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/pump": {
|
||||||
|
"version": "3.0.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/pump/-/pump-3.0.4.tgz",
|
||||||
|
"integrity": "sha512-VS7sjc6KR7e1ukRFhQSY5LM2uBWAUPiOPa/A3mkKmiMwSmRFUITt0xuj+/lesgnCv+dPIEYlkzrcyXgquIHMcA==",
|
||||||
|
"dependencies": {
|
||||||
|
"end-of-stream": "^1.1.0",
|
||||||
|
"once": "^1.3.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/qs": {
|
"node_modules/qs": {
|
||||||
"version": "6.16.1",
|
"version": "6.16.1",
|
||||||
"resolved": "https://registry.npmjs.org/qs/-/qs-6.16.1.tgz",
|
"resolved": "https://registry.npmjs.org/qs/-/qs-6.16.1.tgz",
|
||||||
|
|
@ -1880,6 +2176,33 @@
|
||||||
"node": ">=0.10.0"
|
"node": ">=0.10.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/rc": {
|
||||||
|
"version": "1.2.8",
|
||||||
|
"resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz",
|
||||||
|
"integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==",
|
||||||
|
"dependencies": {
|
||||||
|
"deep-extend": "^0.6.0",
|
||||||
|
"ini": "~1.3.0",
|
||||||
|
"minimist": "^1.2.0",
|
||||||
|
"strip-json-comments": "~2.0.1"
|
||||||
|
},
|
||||||
|
"bin": {
|
||||||
|
"rc": "cli.js"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/readable-stream": {
|
||||||
|
"version": "3.6.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz",
|
||||||
|
"integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==",
|
||||||
|
"dependencies": {
|
||||||
|
"inherits": "^2.0.3",
|
||||||
|
"string_decoder": "^1.1.1",
|
||||||
|
"util-deprecate": "^1.0.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 6"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/readdirp": {
|
"node_modules/readdirp": {
|
||||||
"version": "3.6.0",
|
"version": "3.6.0",
|
||||||
"resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz",
|
"resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz",
|
||||||
|
|
@ -1950,6 +2273,17 @@
|
||||||
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
|
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
|
||||||
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
|
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
|
||||||
},
|
},
|
||||||
|
"node_modules/semver": {
|
||||||
|
"version": "7.8.6",
|
||||||
|
"resolved": "https://registry.npmjs.org/semver/-/semver-7.8.6.tgz",
|
||||||
|
"integrity": "sha512-9lpSSU4Mly3mrtruwLs1eLK6+gzbzqeBFwRNjIjE+9LuDpWdYctrQlQ3ej1Ilgi7gknpsTRnPoLP8DpCHqHIJw==",
|
||||||
|
"bin": {
|
||||||
|
"semver": "bin/semver.js"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=10"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/send": {
|
"node_modules/send": {
|
||||||
"version": "0.19.2",
|
"version": "0.19.2",
|
||||||
"resolved": "https://registry.npmjs.org/send/-/send-0.19.2.tgz",
|
"resolved": "https://registry.npmjs.org/send/-/send-0.19.2.tgz",
|
||||||
|
|
@ -2065,6 +2399,49 @@
|
||||||
"url": "https://github.com/sponsors/ljharb"
|
"url": "https://github.com/sponsors/ljharb"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/simple-concat": {
|
||||||
|
"version": "1.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.1.tgz",
|
||||||
|
"integrity": "sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==",
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"type": "github",
|
||||||
|
"url": "https://github.com/sponsors/feross"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "patreon",
|
||||||
|
"url": "https://www.patreon.com/feross"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "consulting",
|
||||||
|
"url": "https://feross.org/support"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"node_modules/simple-get": {
|
||||||
|
"version": "4.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/simple-get/-/simple-get-4.0.1.tgz",
|
||||||
|
"integrity": "sha512-brv7p5WgH0jmQJr1ZDDfKDOSeWWg+OVypG99A/5vYGPqJ6pxiaHLy8nxtFjBA7oMa01ebA9gfh1uMCFqOuXxvA==",
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"type": "github",
|
||||||
|
"url": "https://github.com/sponsors/feross"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "patreon",
|
||||||
|
"url": "https://www.patreon.com/feross"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "consulting",
|
||||||
|
"url": "https://feross.org/support"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"dependencies": {
|
||||||
|
"decompress-response": "^6.0.0",
|
||||||
|
"once": "^1.3.1",
|
||||||
|
"simple-concat": "^1.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/source-map": {
|
"node_modules/source-map": {
|
||||||
"version": "0.6.1",
|
"version": "0.6.1",
|
||||||
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
|
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
|
||||||
|
|
@ -2092,6 +2469,14 @@
|
||||||
"node": ">= 0.8"
|
"node": ">= 0.8"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/string_decoder": {
|
||||||
|
"version": "1.3.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz",
|
||||||
|
"integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==",
|
||||||
|
"dependencies": {
|
||||||
|
"safe-buffer": "~5.2.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/strip-bom": {
|
"node_modules/strip-bom": {
|
||||||
"version": "3.0.0",
|
"version": "3.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz",
|
||||||
|
|
@ -2105,7 +2490,6 @@
|
||||||
"version": "2.0.1",
|
"version": "2.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz",
|
||||||
"integrity": "sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ==",
|
"integrity": "sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ==",
|
||||||
"dev": true,
|
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=0.10.0"
|
"node": ">=0.10.0"
|
||||||
}
|
}
|
||||||
|
|
@ -2122,6 +2506,32 @@
|
||||||
"url": "https://github.com/sponsors/ljharb"
|
"url": "https://github.com/sponsors/ljharb"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/tar-fs": {
|
||||||
|
"version": "2.1.5",
|
||||||
|
"resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-2.1.5.tgz",
|
||||||
|
"integrity": "sha512-OboTd8mmMhZDNPV+UjQcK9yKAatXu2aJ+r1w4im1Otd4M4fl2hwvdoXUxIYHFTHWK/3y3FarBP70v3vwmGlOxw==",
|
||||||
|
"dependencies": {
|
||||||
|
"chownr": "^1.1.1",
|
||||||
|
"mkdirp-classic": "^0.5.2",
|
||||||
|
"pump": "^3.0.0",
|
||||||
|
"tar-stream": "^2.1.4"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/tar-stream": {
|
||||||
|
"version": "2.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.2.0.tgz",
|
||||||
|
"integrity": "sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==",
|
||||||
|
"dependencies": {
|
||||||
|
"bl": "^4.0.3",
|
||||||
|
"end-of-stream": "^1.4.1",
|
||||||
|
"fs-constants": "^1.0.0",
|
||||||
|
"inherits": "^2.0.3",
|
||||||
|
"readable-stream": "^3.1.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=6"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/to-regex-range": {
|
"node_modules/to-regex-range": {
|
||||||
"version": "5.0.1",
|
"version": "5.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
|
||||||
|
|
@ -2240,6 +2650,17 @@
|
||||||
"strip-json-comments": "^2.0.0"
|
"strip-json-comments": "^2.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/tunnel-agent": {
|
||||||
|
"version": "0.6.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz",
|
||||||
|
"integrity": "sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w==",
|
||||||
|
"dependencies": {
|
||||||
|
"safe-buffer": "^5.0.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/type-is": {
|
"node_modules/type-is": {
|
||||||
"version": "1.6.18",
|
"version": "1.6.18",
|
||||||
"resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz",
|
"resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz",
|
||||||
|
|
@ -2290,6 +2711,11 @@
|
||||||
"node": ">= 0.8"
|
"node": ">= 0.8"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/util-deprecate": {
|
||||||
|
"version": "1.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
|
||||||
|
"integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw=="
|
||||||
|
},
|
||||||
"node_modules/utils-merge": {
|
"node_modules/utils-merge": {
|
||||||
"version": "1.0.1",
|
"version": "1.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz",
|
||||||
|
|
@ -2315,8 +2741,7 @@
|
||||||
"node_modules/wrappy": {
|
"node_modules/wrappy": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
|
||||||
"integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==",
|
"integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ=="
|
||||||
"dev": true
|
|
||||||
},
|
},
|
||||||
"node_modules/xtend": {
|
"node_modules/xtend": {
|
||||||
"version": "4.0.2",
|
"version": "4.0.2",
|
||||||
|
|
|
||||||
|
|
@ -20,15 +20,19 @@
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"axios": "^1.7.7",
|
"axios": "^1.7.7",
|
||||||
|
"better-sqlite3": "^11.10.0",
|
||||||
"cheerio": "^1.0.0-rc.12",
|
"cheerio": "^1.0.0-rc.12",
|
||||||
"cookie-parser": "^1.4.7",
|
"cookie-parser": "^1.4.7",
|
||||||
"dotenv": "^16.4.5",
|
"dotenv": "^16.4.5",
|
||||||
"ejs": "^3.1.10",
|
"ejs": "^3.1.10",
|
||||||
"express": "^4.21.1",
|
"express": "^4.21.1",
|
||||||
"express-session": "^1.18.1"
|
"express-rate-limit": "^8.7.3",
|
||||||
|
"express-session": "^1.18.1",
|
||||||
|
"helmet": "^8.3.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@resvg/resvg-js": "^2.6.2",
|
"@resvg/resvg-js": "^2.6.2",
|
||||||
|
"@types/better-sqlite3": "^9.6.0",
|
||||||
"@types/cookie-parser": "^1.4.7",
|
"@types/cookie-parser": "^1.4.7",
|
||||||
"@types/ejs": "^3.1.5",
|
"@types/ejs": "^3.1.5",
|
||||||
"@types/express": "^4.17.21",
|
"@types/express": "^4.17.21",
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -18,6 +18,13 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||||
let currentSearch = '';
|
let currentSearch = '';
|
||||||
let currentSubject = '';
|
let currentSubject = '';
|
||||||
|
|
||||||
|
function t(key, params) {
|
||||||
|
if (typeof window.BeKulturT === 'function') {
|
||||||
|
return window.BeKulturT(key, params);
|
||||||
|
}
|
||||||
|
return key;
|
||||||
|
}
|
||||||
|
|
||||||
// Checkbox toggle
|
// Checkbox toggle
|
||||||
if (assignmentList) {
|
if (assignmentList) {
|
||||||
assignmentList.addEventListener('click', async (e) => {
|
assignmentList.addEventListener('click', async (e) => {
|
||||||
|
|
@ -26,7 +33,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||||
// Exclude / Restore button
|
// Exclude / Restore button
|
||||||
if (target.classList.contains('btn-exclude') || target.classList.contains('btn-disinclude')) {
|
if (target.classList.contains('btn-exclude') || target.classList.contains('btn-disinclude')) {
|
||||||
if (window.BeKulturPWA && window.BeKulturPWA.isOffline()) {
|
if (window.BeKulturPWA && window.BeKulturPWA.isOffline()) {
|
||||||
alert('Çevrimdışı moddasınız. Ödev gizleme/geri alma işlemi için internet bağlantısı gereklidir.');
|
alert(t('dashboard.offlineExcludeAlert'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const assignmentId = target.dataset.id;
|
const assignmentId = target.dataset.id;
|
||||||
|
|
@ -47,8 +54,8 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||||
if (data.success && data.stats) {
|
if (data.success && data.stats) {
|
||||||
card.dataset.excluded = newExcluded ? 'true' : 'false';
|
card.dataset.excluded = newExcluded ? 'true' : 'false';
|
||||||
card.classList.toggle('is-excluded', newExcluded);
|
card.classList.toggle('is-excluded', newExcluded);
|
||||||
target.textContent = newExcluded ? 'Restore' : 'Exclude';
|
target.textContent = newExcluded ? t('dashboard.btnRestore') : t('dashboard.btnExclude');
|
||||||
target.title = newExcluded ? 'Restore this homework to your active list' : 'Exclude this homework (e.g. from another class)';
|
target.title = newExcluded ? t('dashboard.btnRestoreTitle') : t('dashboard.btnExcludeTitle');
|
||||||
|
|
||||||
const checkbox = card.querySelector('.assignment-toggle');
|
const checkbox = card.querySelector('.assignment-toggle');
|
||||||
if (checkbox) checkbox.disabled = newExcluded;
|
if (checkbox) checkbox.disabled = newExcluded;
|
||||||
|
|
@ -59,7 +66,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||||
if (badgesContainer) {
|
if (badgesContainer) {
|
||||||
const b = document.createElement('span');
|
const b = document.createElement('span');
|
||||||
b.className = 'badge badge-excluded';
|
b.className = 'badge badge-excluded';
|
||||||
b.textContent = 'Excluded';
|
b.textContent = t('dashboard.badgeExcluded');
|
||||||
badgesContainer.insertBefore(b, target);
|
badgesContainer.insertBefore(b, target);
|
||||||
}
|
}
|
||||||
} else if (!newExcluded && badgeExcluded) {
|
} else if (!newExcluded && badgeExcluded) {
|
||||||
|
|
@ -84,7 +91,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||||
|
|
||||||
if (window.BeKulturPWA && window.BeKulturPWA.isOffline()) {
|
if (window.BeKulturPWA && window.BeKulturPWA.isOffline()) {
|
||||||
target.checked = !target.checked;
|
target.checked = !target.checked;
|
||||||
alert('Çevrimdışı moddasınız. Ödev durumu internet bağlantısı olmadan değiştirilemez.');
|
alert(t('dashboard.offlineToggleAlert'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -131,21 +138,21 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||||
if (existingStatusBadge) {
|
if (existingStatusBadge) {
|
||||||
if (status === 'completed') {
|
if (status === 'completed') {
|
||||||
existingStatusBadge.className = 'badge badge-completed';
|
existingStatusBadge.className = 'badge badge-completed';
|
||||||
existingStatusBadge.textContent = 'Done';
|
existingStatusBadge.textContent = t('dashboard.badgeCompleted');
|
||||||
} else {
|
} else {
|
||||||
const orig = card.dataset.status;
|
const orig = card.dataset.status;
|
||||||
if (orig === 'next-week') {
|
if (orig === 'next-week') {
|
||||||
existingStatusBadge.className = 'badge badge-next-week';
|
existingStatusBadge.className = 'badge badge-next-week';
|
||||||
existingStatusBadge.textContent = 'Next Week';
|
existingStatusBadge.textContent = t('dashboard.badgeNextWeek');
|
||||||
} else if (orig === 'due-soon') {
|
} else if (orig === 'due-soon') {
|
||||||
existingStatusBadge.className = 'badge badge-due-soon';
|
existingStatusBadge.className = 'badge badge-due-soon';
|
||||||
existingStatusBadge.textContent = 'Due Soon';
|
existingStatusBadge.textContent = t('dashboard.badgeDueSoon');
|
||||||
} else if (orig === 'overdue') {
|
} else if (orig === 'overdue') {
|
||||||
existingStatusBadge.className = 'badge badge-overdue';
|
existingStatusBadge.className = 'badge badge-overdue';
|
||||||
existingStatusBadge.textContent = 'Overdue';
|
existingStatusBadge.textContent = t('dashboard.badgeOverdue');
|
||||||
} else {
|
} else {
|
||||||
existingStatusBadge.className = 'badge badge-active';
|
existingStatusBadge.className = 'badge badge-active';
|
||||||
existingStatusBadge.textContent = 'Active';
|
existingStatusBadge.textContent = t('dashboard.badgeActive');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -162,7 +169,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||||
const statTotal = document.getElementById('statTotalCount');
|
const statTotal = document.getElementById('statTotalCount');
|
||||||
|
|
||||||
if (statCompRate) statCompRate.textContent = `${stats.completionRate}%`;
|
if (statCompRate) statCompRate.textContent = `${stats.completionRate}%`;
|
||||||
if (statCompFrac) statCompFrac.textContent = `${stats.completed} / ${stats.total} done`;
|
if (statCompFrac) statCompFrac.textContent = `${stats.completed} / ${stats.total} ${t('dashboard.statDoneUnit')}`;
|
||||||
if (progressBar) progressBar.style.width = `${stats.completionRate}%`;
|
if (progressBar) progressBar.style.width = `${stats.completionRate}%`;
|
||||||
if (statActive) statActive.textContent = stats.active;
|
if (statActive) statActive.textContent = stats.active;
|
||||||
if (statNextWeek) statNextWeek.textContent = stats.checkedNextWeek;
|
if (statNextWeek) statNextWeek.textContent = stats.checkedNextWeek;
|
||||||
|
|
@ -310,7 +317,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
if (filteredCountText) {
|
if (filteredCountText) {
|
||||||
filteredCountText.textContent = `Showing ${visibleCount} assignments`;
|
filteredCountText.textContent = t('dashboard.showingCount', { count: visibleCount });
|
||||||
}
|
}
|
||||||
|
|
||||||
if (noResults) {
|
if (noResults) {
|
||||||
|
|
@ -322,12 +329,12 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||||
if (btnSyncRecent) {
|
if (btnSyncRecent) {
|
||||||
btnSyncRecent.addEventListener('click', async () => {
|
btnSyncRecent.addEventListener('click', async () => {
|
||||||
if (window.BeKulturPWA && window.BeKulturPWA.isOffline()) {
|
if (window.BeKulturPWA && window.BeKulturPWA.isOffline()) {
|
||||||
showAlert('Çevrimdışı moddasınız. Senkronizasyon için internet bağlantısı gereklidir.', 'danger');
|
showAlert(t('dashboard.offlineSyncAlert'), 'danger');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
btnSyncRecent.disabled = true;
|
btnSyncRecent.disabled = true;
|
||||||
btnSyncRecent.textContent = 'Syncing...';
|
btnSyncRecent.textContent = t('dashboard.syncing');
|
||||||
showAlert('Fetching recent assignments...', 'info');
|
showAlert(t('dashboard.fetchingRecent'), 'info');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const res = await fetch('/api/sync', { method: 'POST' });
|
const res = await fetch('/api/sync', { method: 'POST' });
|
||||||
|
|
@ -335,14 +342,14 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||||
if (data.success) {
|
if (data.success) {
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
} else {
|
} else {
|
||||||
showAlert(`Sync failed: ${data.error}`, 'danger');
|
showAlert(`${t('dashboard.syncFailed')} ${data.error}`, 'danger');
|
||||||
btnSyncRecent.disabled = false;
|
btnSyncRecent.disabled = false;
|
||||||
btnSyncRecent.textContent = 'Sync Recent';
|
btnSyncRecent.textContent = t('dashboard.syncRecent');
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
showAlert('Network error while syncing.', 'danger');
|
showAlert(t('dashboard.networkError'), 'danger');
|
||||||
btnSyncRecent.disabled = false;
|
btnSyncRecent.disabled = false;
|
||||||
btnSyncRecent.textContent = 'Sync Recent';
|
btnSyncRecent.textContent = t('dashboard.syncRecent');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -350,12 +357,12 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||||
if (btnSyncAll) {
|
if (btnSyncAll) {
|
||||||
btnSyncAll.addEventListener('click', async () => {
|
btnSyncAll.addEventListener('click', async () => {
|
||||||
if (window.BeKulturPWA && window.BeKulturPWA.isOffline()) {
|
if (window.BeKulturPWA && window.BeKulturPWA.isOffline()) {
|
||||||
showAlert('Çevrimdışı moddasınız. Senkronizasyon için internet bağlantısı gereklidir.', 'danger');
|
showAlert(t('dashboard.offlineSyncAlert'), 'danger');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
btnSyncAll.disabled = true;
|
btnSyncAll.disabled = true;
|
||||||
btnSyncAll.textContent = 'Syncing all...';
|
btnSyncAll.textContent = t('dashboard.syncingAll');
|
||||||
showAlert('Syncing full history from portal...', 'info');
|
showAlert(t('dashboard.fetchingAll'), 'info');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const res = await fetch('/api/sync-all', { method: 'POST' });
|
const res = await fetch('/api/sync-all', { method: 'POST' });
|
||||||
|
|
@ -363,14 +370,14 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||||
if (data.success) {
|
if (data.success) {
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
} else {
|
} else {
|
||||||
showAlert(`Sync all failed: ${data.error}`, 'danger');
|
showAlert(`${t('dashboard.syncFailed')} ${data.error}`, 'danger');
|
||||||
btnSyncAll.disabled = false;
|
btnSyncAll.disabled = false;
|
||||||
btnSyncAll.textContent = 'Sync Full History';
|
btnSyncAll.textContent = t('dashboard.syncAll');
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
showAlert('Network error while syncing full history.', 'danger');
|
showAlert(t('dashboard.networkError'), 'danger');
|
||||||
btnSyncAll.disabled = false;
|
btnSyncAll.disabled = false;
|
||||||
btnSyncAll.textContent = 'Sync Full History';
|
btnSyncAll.textContent = t('dashboard.syncAll');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,8 +24,6 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||||
const modalTypeBtns = document.querySelectorAll('.modal-type-btn');
|
const modalTypeBtns = document.querySelectorAll('.modal-type-btn');
|
||||||
const questionsGrid = document.getElementById('questionsGrid');
|
const questionsGrid = document.getElementById('questionsGrid');
|
||||||
const mistakeLoading = document.getElementById('mistakeLoading');
|
const mistakeLoading = document.getElementById('mistakeLoading');
|
||||||
const mistakeModalTitle = document.getElementById('mistakeModalTitle');
|
|
||||||
const mistakeModalSubtitle = document.getElementById('mistakeModalSubtitle');
|
|
||||||
|
|
||||||
// Lightbox
|
// Lightbox
|
||||||
const imageLightbox = document.getElementById('imageLightbox');
|
const imageLightbox = document.getElementById('imageLightbox');
|
||||||
|
|
@ -39,6 +37,13 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||||
let activeTypeFilter = 'all'; // 'all' | 'wrong' | 'empty'
|
let activeTypeFilter = 'all'; // 'all' | 'wrong' | 'empty'
|
||||||
let cachedWeaknesses = null;
|
let cachedWeaknesses = null;
|
||||||
|
|
||||||
|
function t(key, params) {
|
||||||
|
if (typeof window.BeKulturT === 'function') {
|
||||||
|
return window.BeKulturT(key, params);
|
||||||
|
}
|
||||||
|
return key;
|
||||||
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------
|
// ----------------------------------------------------
|
||||||
// Helper: Show Alert
|
// Helper: Show Alert
|
||||||
// ----------------------------------------------------
|
// ----------------------------------------------------
|
||||||
|
|
@ -97,14 +102,14 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||||
// ----------------------------------------------------
|
// ----------------------------------------------------
|
||||||
async function handleSync() {
|
async function handleSync() {
|
||||||
if (window.BeKulturPWA && window.BeKulturPWA.isOffline()) {
|
if (window.BeKulturPWA && window.BeKulturPWA.isOffline()) {
|
||||||
showAlert('Çevrimdışı moddasınız. Sınav senkronizasyonu için internet bağlantısı gereklidir.', 'danger');
|
showAlert(t('dashboard.offlineSyncAlert'), 'danger');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const triggerBtn = btnSyncExams || btnEmptySync;
|
const triggerBtn = btnSyncExams || btnEmptySync;
|
||||||
if (triggerBtn) {
|
if (triggerBtn) {
|
||||||
triggerBtn.disabled = true;
|
triggerBtn.disabled = true;
|
||||||
triggerBtn.textContent = 'Syncing...';
|
triggerBtn.textContent = t('exams.syncing');
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
@ -117,17 +122,17 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||||
if (data.success) {
|
if (data.success) {
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
} else {
|
} else {
|
||||||
showAlert(data.error || 'Failed to sync exams', 'danger');
|
showAlert(data.error || t('dashboard.syncFailed'), 'danger');
|
||||||
if (triggerBtn) {
|
if (triggerBtn) {
|
||||||
triggerBtn.disabled = false;
|
triggerBtn.disabled = false;
|
||||||
triggerBtn.textContent = 'Sync Exams';
|
triggerBtn.textContent = t('exams.syncBtn');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
showAlert('Connection error while syncing exams.', 'danger');
|
showAlert(t('dashboard.networkError'), 'danger');
|
||||||
if (triggerBtn) {
|
if (triggerBtn) {
|
||||||
triggerBtn.disabled = false;
|
triggerBtn.disabled = false;
|
||||||
triggerBtn.textContent = 'Sync Exams';
|
triggerBtn.textContent = t('exams.syncBtn');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -173,14 +178,14 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||||
} else {
|
} else {
|
||||||
weaknessContainer.innerHTML = `
|
weaknessContainer.innerHTML = `
|
||||||
<div class="empty-lessons-card">
|
<div class="empty-lessons-card">
|
||||||
<p>Bu sınav için henüz zayıf konu kaydı bulunamadı veya tüm konularda tam başarı sağlandı.</p>
|
<p>${escapeHtml(t('exams.weaknessEmpty'))}</p>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
weaknessLoading.classList.add('hidden');
|
weaknessLoading.classList.add('hidden');
|
||||||
weaknessContainer.innerHTML = `
|
weaknessContainer.innerHTML = `
|
||||||
<div class="alert alert-danger">Zayıf konu raporu yüklenirken bir hata oluştu.</div>
|
<div class="alert alert-danger">${escapeHtml(t('exams.weaknessError'))}</div>
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -206,10 +211,10 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||||
<div class="score-progress-fill ${fillClass}" style="width: ${item.successRate}%;"></div>
|
<div class="score-progress-fill ${fillClass}" style="width: ${item.successRate}%;"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="weakness-stats">
|
<div class="weakness-stats">
|
||||||
<span>Toplam: <strong>${item.totalCount}</strong></span>
|
<span>${escapeHtml(t('exams.weaknessTotal'))} <strong>${item.totalCount}</strong></span>
|
||||||
<span class="text-success">Doğru: <strong>${item.correctCount}</strong></span>
|
<span class="text-success">${escapeHtml(t('exams.weaknessCorrect'))} <strong>${item.correctCount}</strong></span>
|
||||||
<span class="text-danger">Yanlış: <strong>${item.wrongCount}</strong></span>
|
<span class="text-danger">${escapeHtml(t('exams.weaknessWrong'))} <strong>${item.wrongCount}</strong></span>
|
||||||
<span class="text-muted">Boş: <strong>${item.emptyCount}</strong></span>
|
<span class="text-muted">${escapeHtml(t('exams.weaknessEmptyCount'))} <strong>${item.emptyCount}</strong></span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|
@ -340,7 +345,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
mistakeLoading.classList.add('hidden');
|
mistakeLoading.classList.add('hidden');
|
||||||
questionsGrid.innerHTML = `
|
questionsGrid.innerHTML = `
|
||||||
<div class="alert alert-danger">Sorular yüklenirken bir hata oluştu.</div>
|
<div class="alert alert-danger">${escapeHtml(t('exams.modalError'))}</div>
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -355,7 +360,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||||
|
|
||||||
let html = `
|
let html = `
|
||||||
<button type="button" class="modal-lesson-btn ${activeLessonFilter === 'ALL' ? 'active' : ''}" data-lesson="ALL">
|
<button type="button" class="modal-lesson-btn ${activeLessonFilter === 'ALL' ? 'active' : ''}" data-lesson="ALL">
|
||||||
Tüm Yanlışlar (${totalAll})
|
${escapeHtml(t('exams.modalAllMistakes'))} (${totalAll})
|
||||||
</button>
|
</button>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
|
@ -419,7 +424,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||||
if (filteredList.length === 0) {
|
if (filteredList.length === 0) {
|
||||||
questionsGrid.innerHTML = `
|
questionsGrid.innerHTML = `
|
||||||
<div class="empty-lessons-card" style="grid-column: 1 / -1;">
|
<div class="empty-lessons-card" style="grid-column: 1 / -1;">
|
||||||
<p>Seçili filtrelere uygun soru bulunamadı.</p>
|
<p>${escapeHtml(t('exams.modalNoMatch'))}</p>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
return;
|
return;
|
||||||
|
|
@ -429,32 +434,32 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||||
filteredList.forEach(q => {
|
filteredList.forEach(q => {
|
||||||
const isWrong = q.status === 'wrong';
|
const isWrong = q.status === 'wrong';
|
||||||
const studentClass = isWrong ? 'answer-student-wrong' : 'answer-student-empty';
|
const studentClass = isWrong ? 'answer-student-wrong' : 'answer-student-empty';
|
||||||
const studentText = isWrong ? q.studentAnswer : 'Boş';
|
const studentText = isWrong ? q.studentAnswer : t('exams.emptyAnswerText');
|
||||||
|
|
||||||
html += `
|
html += `
|
||||||
<div class="question-card">
|
<div class="question-card">
|
||||||
<div class="question-card-header">
|
<div class="question-card-header">
|
||||||
<span class="question-no-badge">Soru #${q.questionNumber}</span>
|
<span class="question-no-badge">${escapeHtml(t('exams.questionNo', { num: q.questionNumber }))}</span>
|
||||||
<span class="question-subject-badge">${escapeHtml(q.subjectName || '')}</span>
|
<span class="question-subject-badge">${escapeHtml(q.subjectName || '')}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="question-card-answers">
|
<div class="question-card-answers">
|
||||||
<span class="answer-pill answer-correct">
|
<span class="answer-pill answer-correct">
|
||||||
Doğru: <strong>${escapeHtml(q.correctAnswer)}</strong>
|
${escapeHtml(t('exams.correctAnswer'))} <strong>${escapeHtml(q.correctAnswer)}</strong>
|
||||||
</span>
|
</span>
|
||||||
<span class="answer-pill ${studentClass}">
|
<span class="answer-pill ${studentClass}">
|
||||||
Öğrenci: <strong>${escapeHtml(studentText)}</strong>
|
${escapeHtml(t('exams.studentAnswer'))} <strong>${escapeHtml(studentText)}</strong>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
${
|
${
|
||||||
q.imageUrl
|
q.imageUrl
|
||||||
? `
|
? `
|
||||||
<div class="question-img-wrapper" title="Büyütmek için tıklayınız">
|
<div class="question-img-wrapper" title="${escapeHtml(t('exams.zoomHint'))}">
|
||||||
<img src="${escapeHtml(q.imageUrl)}" alt="Soru ${q.questionNumber}" class="question-img" loading="lazy" />
|
<img src="${escapeHtml(q.imageUrl)}" alt="Soru ${q.questionNumber}" class="question-img" loading="lazy" />
|
||||||
</div>
|
</div>
|
||||||
`
|
`
|
||||||
: `<div class="text-muted small">Soru görseli bulunamadı.</div>`
|
: `<div class="text-muted small">${escapeHtml(t('exams.noImage'))}</div>`
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,13 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||||
const lessonCards = document.querySelectorAll('.lesson-card');
|
const lessonCards = document.querySelectorAll('.lesson-card');
|
||||||
const sinifIdInput = document.getElementById('sinifId');
|
const sinifIdInput = document.getElementById('sinifId');
|
||||||
|
|
||||||
|
function t(key, params) {
|
||||||
|
if (typeof window.BeKulturT === 'function') {
|
||||||
|
return window.BeKulturT(key, params);
|
||||||
|
}
|
||||||
|
return key;
|
||||||
|
}
|
||||||
|
|
||||||
function showAlert(message, type = 'info', timeout = 4000) {
|
function showAlert(message, type = 'info', timeout = 4000) {
|
||||||
if (!alertBox) return;
|
if (!alertBox) return;
|
||||||
alertBox.className = `alert alert-${type}`;
|
alertBox.className = `alert alert-${type}`;
|
||||||
|
|
@ -44,9 +51,9 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||||
const dersId = selectCourse.value;
|
const dersId = selectCourse.value;
|
||||||
const sinifId = sinifIdInput ? sinifIdInput.value : '';
|
const sinifId = sinifIdInput ? sinifIdInput.value : '';
|
||||||
|
|
||||||
selectUnit.innerHTML = '<option value="">Önce ders seçiniz...</option>';
|
selectUnit.innerHTML = `<option value="">${t('privateLessons.selectCourseFirst')}</option>`;
|
||||||
selectUnit.disabled = true;
|
selectUnit.disabled = true;
|
||||||
selectTopic.innerHTML = '<option value="">Önce ünite seçiniz...</option>';
|
selectTopic.innerHTML = `<option value="">${t('privateLessons.selectUnitFirst')}</option>`;
|
||||||
selectTopic.disabled = true;
|
selectTopic.disabled = true;
|
||||||
if (btnSubmit) btnSubmit.disabled = true;
|
if (btnSubmit) btnSubmit.disabled = true;
|
||||||
|
|
||||||
|
|
@ -59,7 +66,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||||
const data = await res.json();
|
const data = await res.json();
|
||||||
|
|
||||||
if (data.success && data.units && data.units.length > 0) {
|
if (data.success && data.units && data.units.length > 0) {
|
||||||
selectUnit.innerHTML = '<option value="">Seçiniz...</option>';
|
selectUnit.innerHTML = `<option value="">${t('privateLessons.selectPrompt')}</option>`;
|
||||||
data.units.forEach(u => {
|
data.units.forEach(u => {
|
||||||
const opt = document.createElement('option');
|
const opt = document.createElement('option');
|
||||||
opt.value = u.id;
|
opt.value = u.id;
|
||||||
|
|
@ -68,11 +75,11 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||||
});
|
});
|
||||||
selectUnit.disabled = false;
|
selectUnit.disabled = false;
|
||||||
} else {
|
} else {
|
||||||
selectUnit.innerHTML = '<option value="">Ünite bulunamadı</option>';
|
selectUnit.innerHTML = `<option value="">${t('privateLessons.noUnitFound')}</option>`;
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Error fetching units:', err);
|
console.error('Error fetching units:', err);
|
||||||
selectUnit.innerHTML = '<option value="">Hata oluştu</option>';
|
selectUnit.innerHTML = `<option value="">${t('privateLessons.errorOccurred')}</option>`;
|
||||||
} finally {
|
} finally {
|
||||||
if (unitLoading) unitLoading.classList.add('hidden');
|
if (unitLoading) unitLoading.classList.add('hidden');
|
||||||
}
|
}
|
||||||
|
|
@ -85,7 +92,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||||
hideFeedback();
|
hideFeedback();
|
||||||
const uniteId = selectUnit.value;
|
const uniteId = selectUnit.value;
|
||||||
|
|
||||||
selectTopic.innerHTML = '<option value="">Önce ünite seçiniz...</option>';
|
selectTopic.innerHTML = `<option value="">${t('privateLessons.selectUnitFirst')}</option>`;
|
||||||
selectTopic.disabled = true;
|
selectTopic.disabled = true;
|
||||||
if (btnSubmit) btnSubmit.disabled = true;
|
if (btnSubmit) btnSubmit.disabled = true;
|
||||||
|
|
||||||
|
|
@ -98,20 +105,20 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||||
const data = await res.json();
|
const data = await res.json();
|
||||||
|
|
||||||
if (data.success && data.topics && data.topics.length > 0) {
|
if (data.success && data.topics && data.topics.length > 0) {
|
||||||
selectTopic.innerHTML = '<option value="">Seçiniz...</option>';
|
selectTopic.innerHTML = `<option value="">${t('privateLessons.selectPrompt')}</option>`;
|
||||||
data.topics.forEach(t => {
|
data.topics.forEach(tItem => {
|
||||||
const opt = document.createElement('option');
|
const opt = document.createElement('option');
|
||||||
opt.value = t.id;
|
opt.value = tItem.id;
|
||||||
opt.textContent = t.name;
|
opt.textContent = tItem.name;
|
||||||
selectTopic.appendChild(opt);
|
selectTopic.appendChild(opt);
|
||||||
});
|
});
|
||||||
selectTopic.disabled = false;
|
selectTopic.disabled = false;
|
||||||
} else {
|
} else {
|
||||||
selectTopic.innerHTML = '<option value="">Konu bulunamadı</option>';
|
selectTopic.innerHTML = `<option value="">${t('privateLessons.noTopicFound')}</option>`;
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Error fetching topics:', err);
|
console.error('Error fetching topics:', err);
|
||||||
selectTopic.innerHTML = '<option value="">Hata oluştu</option>';
|
selectTopic.innerHTML = `<option value="">${t('privateLessons.errorOccurred')}</option>`;
|
||||||
} finally {
|
} finally {
|
||||||
if (topicLoading) topicLoading.classList.add('hidden');
|
if (topicLoading) topicLoading.classList.add('hidden');
|
||||||
}
|
}
|
||||||
|
|
@ -134,7 +141,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||||
hideFeedback();
|
hideFeedback();
|
||||||
|
|
||||||
if (window.BeKulturPWA && window.BeKulturPWA.isOffline()) {
|
if (window.BeKulturPWA && window.BeKulturPWA.isOffline()) {
|
||||||
showFeedback('Çevrimdışı moddasınız. Yeni özel ders başvurusu yapmak için internet bağlantısı gereklidir.', 'error');
|
showFeedback(t('dashboard.offlineSyncAlert'), 'error');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -152,7 +159,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||||
|
|
||||||
if (btnSubmit) {
|
if (btnSubmit) {
|
||||||
btnSubmit.disabled = true;
|
btnSubmit.disabled = true;
|
||||||
btnSubmit.textContent = 'Gönderiliyor...';
|
btnSubmit.textContent = t('privateLessons.submittingBtn');
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
@ -167,9 +174,9 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||||
if (data.success) {
|
if (data.success) {
|
||||||
showFeedback(data.message || 'Özel ders talebiniz başarıyla iletildi!', 'success');
|
showFeedback(data.message || 'Özel ders talebiniz başarıyla iletildi!', 'success');
|
||||||
// Reset select elements
|
// Reset select elements
|
||||||
selectTopic.innerHTML = '<option value="">Önce ünite seçiniz...</option>';
|
selectTopic.innerHTML = `<option value="">${t('privateLessons.selectUnitFirst')}</option>`;
|
||||||
selectTopic.disabled = true;
|
selectTopic.disabled = true;
|
||||||
selectUnit.innerHTML = '<option value="">Önce ders seçiniz...</option>';
|
selectUnit.innerHTML = `<option value="">${t('privateLessons.selectCourseFirst')}</option>`;
|
||||||
selectUnit.disabled = true;
|
selectUnit.disabled = true;
|
||||||
selectCourse.value = '';
|
selectCourse.value = '';
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -180,7 +187,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||||
showFeedback('Bağlantı hatası oluştu. Lütfen tekrar deneyiniz.', 'error');
|
showFeedback('Bağlantı hatası oluştu. Lütfen tekrar deneyiniz.', 'error');
|
||||||
} finally {
|
} finally {
|
||||||
if (btnSubmit) {
|
if (btnSubmit) {
|
||||||
btnSubmit.textContent = 'Submit Request (Gönder)';
|
btnSubmit.textContent = t('privateLessons.submitBtn');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -208,26 +215,30 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||||
// 6. Sync Lessons
|
// 6. Sync Lessons
|
||||||
if (btnSync) {
|
if (btnSync) {
|
||||||
btnSync.addEventListener('click', async () => {
|
btnSync.addEventListener('click', async () => {
|
||||||
|
if (window.BeKulturPWA && window.BeKulturPWA.isOffline()) {
|
||||||
|
showAlert(t('dashboard.offlineSyncAlert'), 'danger');
|
||||||
|
return;
|
||||||
|
}
|
||||||
btnSync.disabled = true;
|
btnSync.disabled = true;
|
||||||
btnSync.textContent = 'Syncing...';
|
btnSync.textContent = t('privateLessons.syncing');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const res = await fetch('/api/private-lessons/sync', { method: 'POST' });
|
const res = await fetch('/api/private-lessons/sync', { method: 'POST' });
|
||||||
const data = await res.json();
|
const data = await res.json();
|
||||||
|
|
||||||
if (data.success) {
|
if (data.success) {
|
||||||
showAlert(`Successfully refreshed ${data.count} private lesson records.`, 'success');
|
showAlert(t('privateLessons.syncSuccess', { count: data.count }), 'info');
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
}, 800);
|
}, 800);
|
||||||
} else {
|
} else {
|
||||||
showAlert(data.error || 'Sync failed.', 'danger');
|
showAlert(data.error || t('dashboard.syncFailed'), 'danger');
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
showAlert('Network error while syncing private lessons.', 'danger');
|
showAlert(t('dashboard.networkError'), 'danger');
|
||||||
} finally {
|
} finally {
|
||||||
btnSync.disabled = false;
|
btnSync.disabled = false;
|
||||||
btnSync.textContent = 'Sync Lessons';
|
btnSync.textContent = t('privateLessons.syncBtn');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
122
public/js/pwa.js
122
public/js/pwa.js
|
|
@ -1,10 +1,98 @@
|
||||||
/**
|
/**
|
||||||
* BeKultur - PWA & Offline State Manager
|
* BeKultur - PWA, Theme & Offline State Manager
|
||||||
*/
|
*/
|
||||||
(function () {
|
(function () {
|
||||||
let isOffline = !navigator.onLine;
|
let isOffline = !navigator.onLine;
|
||||||
let bannerTimeout = null;
|
let bannerTimeout = null;
|
||||||
|
|
||||||
|
function t(key, params) {
|
||||||
|
if (typeof window.BeKulturT === 'function') {
|
||||||
|
return window.BeKulturT(key, params);
|
||||||
|
}
|
||||||
|
return key;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------
|
||||||
|
// 0. Dark / Light Theme Manager (System-Aware + Override)
|
||||||
|
// ----------------------------------------------------
|
||||||
|
function getSystemScheme() {
|
||||||
|
return window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches
|
||||||
|
? 'dark'
|
||||||
|
: 'light';
|
||||||
|
}
|
||||||
|
|
||||||
|
function getStoredScheme() {
|
||||||
|
try {
|
||||||
|
const val = localStorage.getItem('color-scheme');
|
||||||
|
if (val === 'dark' || val === 'light') return val;
|
||||||
|
} catch (e) {}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getResolvedScheme() {
|
||||||
|
return getStoredScheme() || getSystemScheme();
|
||||||
|
}
|
||||||
|
|
||||||
|
function applyThemeScheme(storedOverride) {
|
||||||
|
const meta = document.querySelector('meta[name="color-scheme"]');
|
||||||
|
const resolved = storedOverride === 'dark' || storedOverride === 'light'
|
||||||
|
? storedOverride
|
||||||
|
: getSystemScheme();
|
||||||
|
|
||||||
|
if (meta) {
|
||||||
|
meta.content = storedOverride === 'dark' || storedOverride === 'light'
|
||||||
|
? storedOverride
|
||||||
|
: 'light dark';
|
||||||
|
}
|
||||||
|
document.documentElement.setAttribute('data-theme', resolved);
|
||||||
|
}
|
||||||
|
|
||||||
|
function initThemeToggle() {
|
||||||
|
// Ensure initial attribute is synced
|
||||||
|
applyThemeScheme(getStoredScheme());
|
||||||
|
|
||||||
|
const toggleBtn = document.getElementById('themeToggleBtn');
|
||||||
|
if (toggleBtn) {
|
||||||
|
toggleBtn.addEventListener('click', () => {
|
||||||
|
const currentRendered = getResolvedScheme();
|
||||||
|
const target = currentRendered === 'dark' ? 'light' : 'dark';
|
||||||
|
const sys = getSystemScheme();
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (target === sys) {
|
||||||
|
// Revert to system default when target matches system preference
|
||||||
|
localStorage.removeItem('color-scheme');
|
||||||
|
applyThemeScheme(null);
|
||||||
|
} else {
|
||||||
|
localStorage.setItem('color-scheme', target);
|
||||||
|
applyThemeScheme(target);
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
applyThemeScheme(target);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Listen for OS theme changes when following system default
|
||||||
|
if (window.matchMedia) {
|
||||||
|
const mql = window.matchMedia('(prefers-color-scheme: dark)');
|
||||||
|
if (mql.addEventListener) {
|
||||||
|
mql.addEventListener('change', () => {
|
||||||
|
if (!getStoredScheme()) {
|
||||||
|
applyThemeScheme(null);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Keep tabs in sync
|
||||||
|
window.addEventListener('storage', (e) => {
|
||||||
|
if (e.key === 'color-scheme') {
|
||||||
|
applyThemeScheme(getStoredScheme());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// 1. Service Worker Registration
|
// 1. Service Worker Registration
|
||||||
if ('serviceWorker' in navigator) {
|
if ('serviceWorker' in navigator) {
|
||||||
window.addEventListener('load', () => {
|
window.addEventListener('load', () => {
|
||||||
|
|
@ -50,8 +138,8 @@
|
||||||
banner.className = 'offline-banner active';
|
banner.className = 'offline-banner active';
|
||||||
banner.innerHTML = `
|
banner.innerHTML = `
|
||||||
<div class="offline-banner-content">
|
<div class="offline-banner-content">
|
||||||
<span class="offline-badge-pill">⚡ Offline</span>
|
<span class="offline-badge-pill">${t('pwa.offlineBadge')}</span>
|
||||||
<span class="offline-banner-text">Showing locally cached data. Actions requiring connection are paused.</span>
|
<span class="offline-banner-text">${t('pwa.offlineText')}</span>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
@ -65,8 +153,8 @@
|
||||||
banner.className = 'offline-banner online';
|
banner.className = 'offline-banner online';
|
||||||
banner.innerHTML = `
|
banner.innerHTML = `
|
||||||
<div class="offline-banner-content">
|
<div class="offline-banner-content">
|
||||||
<span class="online-badge-pill">✓ Online</span>
|
<span class="online-badge-pill">${t('pwa.onlineBadge')}</span>
|
||||||
<span class="offline-banner-text">Connection restored. Live features re-enabled.</span>
|
<span class="offline-banner-text">${t('pwa.onlineText')}</span>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
bannerTimeout = setTimeout(() => {
|
bannerTimeout = setTimeout(() => {
|
||||||
|
|
@ -93,7 +181,7 @@
|
||||||
|
|
||||||
if (offline) {
|
if (offline) {
|
||||||
checkbox.disabled = true;
|
checkbox.disabled = true;
|
||||||
checkbox.title = 'Offline mode: Homework status cannot be changed without connection.';
|
checkbox.title = t('pwa.offlineCheckboxTitle');
|
||||||
} else {
|
} else {
|
||||||
// Only re-enable if not excluded
|
// Only re-enable if not excluded
|
||||||
checkbox.disabled = isExcluded;
|
checkbox.disabled = isExcluded;
|
||||||
|
|
@ -105,16 +193,17 @@
|
||||||
excludeButtons.forEach((btn) => {
|
excludeButtons.forEach((btn) => {
|
||||||
if (offline) {
|
if (offline) {
|
||||||
btn.disabled = true;
|
btn.disabled = true;
|
||||||
btn.title = 'Offline mode: Homework cannot be excluded without connection.';
|
btn.title = t('pwa.offlineExcludeTitle');
|
||||||
} else {
|
} else {
|
||||||
btn.disabled = false;
|
btn.disabled = false;
|
||||||
btn.title = btn.textContent.trim() === 'Restore' ? 'Restore homework' : 'Exclude homework';
|
const card = btn.closest('.assignment-card');
|
||||||
|
const isExcl = card && card.dataset.excluded === 'true';
|
||||||
|
btn.title = isExcl ? t('dashboard.btnRestoreTitle') : t('dashboard.btnExcludeTitle');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// --- B. Private Lesson Request Form ---
|
// --- B. Private Lesson Request Form ---
|
||||||
const lessonForm = document.getElementById('privateLessonForm');
|
const lessonForm = document.getElementById('privateLessonForm');
|
||||||
const btnSubmitLesson = document.getElementById('btnSubmitRequest');
|
|
||||||
const formSelects = document.querySelectorAll('#privateLessonForm select, #privateLessonForm button[type="submit"]');
|
const formSelects = document.querySelectorAll('#privateLessonForm select, #privateLessonForm button[type="submit"]');
|
||||||
|
|
||||||
let noticeEl = document.getElementById('privateLessonOfflineNotice');
|
let noticeEl = document.getElementById('privateLessonOfflineNotice');
|
||||||
|
|
@ -123,7 +212,7 @@
|
||||||
noticeEl.id = 'privateLessonOfflineNotice';
|
noticeEl.id = 'privateLessonOfflineNotice';
|
||||||
noticeEl.className = 'alert alert-warning hidden';
|
noticeEl.className = 'alert alert-warning hidden';
|
||||||
noticeEl.style.marginBottom = '12px';
|
noticeEl.style.marginBottom = '12px';
|
||||||
noticeEl.innerHTML = '⚡ <strong>Çevrimdışı mod:</strong> Yeni özel ders başvurusu yapmak için internet bağlantısı gereklidir.';
|
noticeEl.innerHTML = t('pwa.offlinePrivateNotice');
|
||||||
lessonForm.prepend(noticeEl);
|
lessonForm.prepend(noticeEl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -145,7 +234,7 @@
|
||||||
stationButtons.forEach((btn) => {
|
stationButtons.forEach((btn) => {
|
||||||
if (offline) {
|
if (offline) {
|
||||||
btn.classList.add('station-btn-offline');
|
btn.classList.add('station-btn-offline');
|
||||||
btn.title = 'Offline mode: Station selection requires connection.';
|
btn.title = t('pwa.offlineStationTitle');
|
||||||
} else {
|
} else {
|
||||||
btn.classList.remove('station-btn-offline');
|
btn.classList.remove('station-btn-offline');
|
||||||
btn.title = '';
|
btn.title = '';
|
||||||
|
|
@ -172,8 +261,8 @@
|
||||||
}
|
}
|
||||||
btn.disabled = true;
|
btn.disabled = true;
|
||||||
btn.classList.add('btn-offline-disabled');
|
btn.classList.add('btn-offline-disabled');
|
||||||
btn.title = 'Offline mode: Sync requires internet connection.';
|
btn.title = t('pwa.offlineSyncTitle');
|
||||||
btn.textContent = `${btn.dataset.onlineLabel} (Offline)`;
|
btn.textContent = `${btn.dataset.onlineLabel} ${t('pwa.offlineSuffix')}`;
|
||||||
} else {
|
} else {
|
||||||
btn.disabled = false;
|
btn.disabled = false;
|
||||||
btn.classList.remove('btn-offline-disabled');
|
btn.classList.remove('btn-offline-disabled');
|
||||||
|
|
@ -195,7 +284,7 @@
|
||||||
if (target.classList && target.classList.contains('assignment-toggle')) {
|
if (target.classList && target.classList.contains('assignment-toggle')) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
alert('Çevrimdışı moddasınız. Ödev durumu internet bağlantısı olmadan değiştirilemez.');
|
alert(t('dashboard.offlineToggleAlert'));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
true
|
true
|
||||||
|
|
@ -213,11 +302,13 @@
|
||||||
// 6. Initial Application on DOM Ready
|
// 6. Initial Application on DOM Ready
|
||||||
if (document.readyState === 'loading') {
|
if (document.readyState === 'loading') {
|
||||||
document.addEventListener('DOMContentLoaded', () => {
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
|
initThemeToggle();
|
||||||
if (!navigator.onLine) {
|
if (!navigator.onLine) {
|
||||||
applyOfflineState(true);
|
applyOfflineState(true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
initThemeToggle();
|
||||||
if (!navigator.onLine) {
|
if (!navigator.onLine) {
|
||||||
applyOfflineState(true);
|
applyOfflineState(true);
|
||||||
}
|
}
|
||||||
|
|
@ -226,6 +317,7 @@
|
||||||
// Export helper globally
|
// Export helper globally
|
||||||
window.BeKulturPWA = {
|
window.BeKulturPWA = {
|
||||||
isOffline: () => isOffline,
|
isOffline: () => isOffline,
|
||||||
refreshState: () => applyOfflineState(!navigator.onLine)
|
refreshState: () => applyOfflineState(!navigator.onLine),
|
||||||
|
getTheme: () => getResolvedScheme()
|
||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,13 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||||
const btnSyncSyllabus = document.getElementById('btnSyncSyllabus');
|
const btnSyncSyllabus = document.getElementById('btnSyncSyllabus');
|
||||||
const syllabusAlert = document.getElementById('syllabusAlert');
|
const syllabusAlert = document.getElementById('syllabusAlert');
|
||||||
|
|
||||||
|
function t(key, params) {
|
||||||
|
if (typeof window.BeKulturT === 'function') {
|
||||||
|
return window.BeKulturT(key, params);
|
||||||
|
}
|
||||||
|
return key;
|
||||||
|
}
|
||||||
|
|
||||||
// 1. Station Pill Selection (AJAX)
|
// 1. Station Pill Selection (AJAX)
|
||||||
if (stationPills) {
|
if (stationPills) {
|
||||||
stationPills.addEventListener('click', async (e) => {
|
stationPills.addEventListener('click', async (e) => {
|
||||||
|
|
@ -14,7 +21,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||||
if (!btn) return;
|
if (!btn) return;
|
||||||
|
|
||||||
if (window.BeKulturPWA && window.BeKulturPWA.isOffline()) {
|
if (window.BeKulturPWA && window.BeKulturPWA.isOffline()) {
|
||||||
showAlert('Çevrimdışı moddasınız. İstasyon seçimi için internet bağlantısı gereklidir.', 'danger');
|
showAlert(t('syllabus.offlineStationAlert'), 'danger');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -80,28 +87,28 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||||
if (btnSyncSyllabus) {
|
if (btnSyncSyllabus) {
|
||||||
btnSyncSyllabus.addEventListener('click', async () => {
|
btnSyncSyllabus.addEventListener('click', async () => {
|
||||||
if (window.BeKulturPWA && window.BeKulturPWA.isOffline()) {
|
if (window.BeKulturPWA && window.BeKulturPWA.isOffline()) {
|
||||||
showAlert('Çevrimdışı moddasınız. Senkronizasyon için internet bağlantısı gereklidir.', 'danger');
|
showAlert(t('dashboard.offlineSyncAlert'), 'danger');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
btnSyncSyllabus.disabled = true;
|
btnSyncSyllabus.disabled = true;
|
||||||
btnSyncSyllabus.textContent = 'Syncing...';
|
btnSyncSyllabus.textContent = t('syllabus.syncing');
|
||||||
showAlert('Fetching weekly timetable across all 5 days...', 'info');
|
showAlert(t('syllabus.fetchingAlert'), 'info');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const res = await fetch('/api/syllabus/sync', { method: 'POST' });
|
const res = await fetch('/api/syllabus/sync', { method: 'POST' });
|
||||||
const data = await res.json();
|
const data = await res.json();
|
||||||
if (data.success) {
|
if (data.success) {
|
||||||
showAlert('Syllabus updated successfully!', 'info');
|
showAlert(t('syllabus.updatedAlert'), 'info');
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
} else {
|
} else {
|
||||||
showAlert(`Sync failed: ${data.error}`, 'danger');
|
showAlert(`${t('dashboard.syncFailed')} ${data.error}`, 'danger');
|
||||||
btnSyncSyllabus.disabled = false;
|
btnSyncSyllabus.disabled = false;
|
||||||
btnSyncSyllabus.textContent = 'Sync Syllabus';
|
btnSyncSyllabus.textContent = t('syllabus.syncBtn');
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
showAlert('Network error while syncing syllabus.', 'danger');
|
showAlert(t('dashboard.networkError'), 'danger');
|
||||||
btnSyncSyllabus.disabled = false;
|
btnSyncSyllabus.disabled = false;
|
||||||
btnSyncSyllabus.textContent = 'Sync Syllabus';
|
btnSyncSyllabus.textContent = t('syllabus.syncBtn');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
const CACHE_NAME = 'bekultur-v2';
|
const CACHE_NAME = 'bekultur-v3';
|
||||||
|
|
||||||
const STATIC_ASSETS = [
|
const STATIC_ASSETS = [
|
||||||
'/',
|
'/',
|
||||||
|
|
|
||||||
251
src/server.ts
251
src/server.ts
|
|
@ -1,6 +1,8 @@
|
||||||
import express, { Request, Response, NextFunction } from 'express';
|
import express, { Request, Response, NextFunction } from 'express';
|
||||||
import session from 'express-session';
|
import session from 'express-session';
|
||||||
import cookieParser from 'cookie-parser';
|
import cookieParser from 'cookie-parser';
|
||||||
|
import helmet from 'helmet';
|
||||||
|
import rateLimit from 'express-rate-limit';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import dotenv from 'dotenv';
|
import dotenv from 'dotenv';
|
||||||
import { ScraperService } from './services/scraper';
|
import { ScraperService } from './services/scraper';
|
||||||
|
|
@ -8,13 +10,25 @@ import { LocalDatabase } from './services/db';
|
||||||
import { InsightService } from './services/insight';
|
import { InsightService } from './services/insight';
|
||||||
import { SyllabusService, DAY_NAMES } from './services/syllabus';
|
import { SyllabusService, DAY_NAMES } from './services/syllabus';
|
||||||
import { ExamService } from './services/exam';
|
import { ExamService } from './services/exam';
|
||||||
|
import { getSessionSecret } from './services/secrets';
|
||||||
|
import { SQLiteSessionStore } from './services/session-store';
|
||||||
|
import {
|
||||||
|
SupportedLocale,
|
||||||
|
DEFAULT_LOCALE,
|
||||||
|
normalizeLocale,
|
||||||
|
createTranslator,
|
||||||
|
getClientDictionary
|
||||||
|
} from './services/i18n';
|
||||||
import { Assignment, ExamReportDetail } from './types';
|
import { Assignment, ExamReportDetail } from './types';
|
||||||
|
|
||||||
dotenv.config();
|
dotenv.config();
|
||||||
|
|
||||||
const app = express();
|
const app = express();
|
||||||
const PORT = process.env.PORT || 3000;
|
const PORT = process.env.PORT || 3000;
|
||||||
const SESSION_SECRET = process.env.SESSION_SECRET || 'bekultur_secret_key_change_in_production';
|
const SESSION_SECRET = getSessionSecret();
|
||||||
|
|
||||||
|
// Trust first proxy (Cloudflare Tunnel / reverse proxy) so secure cookies work over proxied HTTPS
|
||||||
|
app.set('trust proxy', 1);
|
||||||
|
|
||||||
// View engine setup
|
// View engine setup
|
||||||
app.set('view engine', 'ejs');
|
app.set('view engine', 'ejs');
|
||||||
|
|
@ -23,11 +37,61 @@ const viewsPath = path.resolve(__dirname, '../views');
|
||||||
const publicPath = path.resolve(__dirname, '../public');
|
const publicPath = path.resolve(__dirname, '../public');
|
||||||
app.set('views', viewsPath);
|
app.set('views', viewsPath);
|
||||||
|
|
||||||
// Middleware
|
// Security Headers (Helmet with CSP tailored for BeKultur & school portal question images)
|
||||||
app.use(express.urlencoded({ extended: true }));
|
app.use(
|
||||||
app.use(express.json());
|
helmet({
|
||||||
|
contentSecurityPolicy: {
|
||||||
|
directives: {
|
||||||
|
defaultSrc: ["'self'"],
|
||||||
|
scriptSrc: ["'self'", "'unsafe-inline'"],
|
||||||
|
scriptSrcAttr: ["'unsafe-inline'"],
|
||||||
|
styleSrc: ["'self'", "'unsafe-inline'"],
|
||||||
|
imgSrc: [
|
||||||
|
"'self'",
|
||||||
|
'data:',
|
||||||
|
'https://*.ozelbursakulturokullari.com',
|
||||||
|
'http://*.ozelbursakulturokullari.com'
|
||||||
|
],
|
||||||
|
connectSrc: ["'self'"],
|
||||||
|
fontSrc: ["'self'", 'data:'],
|
||||||
|
objectSrc: ["'none'"],
|
||||||
|
frameAncestors: ["'none'"],
|
||||||
|
upgradeInsecureRequests: null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
crossOriginEmbedderPolicy: false,
|
||||||
|
crossOriginResourcePolicy: { policy: 'cross-origin' }
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
// Body & Cookie Parsers
|
||||||
|
app.use(express.urlencoded({ extended: true, limit: '256kb' }));
|
||||||
|
app.use(express.json({ limit: '256kb' }));
|
||||||
app.use(cookieParser(SESSION_SECRET));
|
app.use(cookieParser(SESSION_SECRET));
|
||||||
|
|
||||||
|
// Localization Middleware (Default: Turkish 'tr', switchable to 'en')
|
||||||
|
app.use((req: Request, res: Response, next: NextFunction) => {
|
||||||
|
let lang: SupportedLocale = DEFAULT_LOCALE;
|
||||||
|
|
||||||
|
if (typeof req.query.lang === 'string' && (req.query.lang === 'tr' || req.query.lang === 'en')) {
|
||||||
|
lang = normalizeLocale(req.query.lang);
|
||||||
|
res.cookie('bekultur_lang', lang, {
|
||||||
|
maxAge: 365 * 24 * 60 * 60 * 1000,
|
||||||
|
httpOnly: false,
|
||||||
|
sameSite: 'lax'
|
||||||
|
});
|
||||||
|
} else if (req.cookies?.bekultur_lang) {
|
||||||
|
lang = normalizeLocale(req.cookies.bekultur_lang);
|
||||||
|
}
|
||||||
|
|
||||||
|
const t = createTranslator(lang);
|
||||||
|
res.locals.lang = lang;
|
||||||
|
res.locals.t = t;
|
||||||
|
res.locals.i18nJson = JSON.stringify(getClientDictionary(lang));
|
||||||
|
res.locals.activePage = '';
|
||||||
|
next();
|
||||||
|
});
|
||||||
|
|
||||||
// Custom Service Worker route with proper scope and no-cache headers
|
// Custom Service Worker route with proper scope and no-cache headers
|
||||||
app.get('/sw.js', (req: Request, res: Response) => {
|
app.get('/sw.js', (req: Request, res: Response) => {
|
||||||
res.setHeader('Service-Worker-Allowed', '/');
|
res.setHeader('Service-Worker-Allowed', '/');
|
||||||
|
|
@ -43,8 +107,17 @@ app.get('/api/health', (req: Request, res: Response) => {
|
||||||
|
|
||||||
app.use(express.static(publicPath));
|
app.use(express.static(publicPath));
|
||||||
|
|
||||||
|
// Initialize SQLite Database & Persistent SQLite Session Store
|
||||||
|
const db = LocalDatabase.getInstance();
|
||||||
|
const sessionStore = new SQLiteSessionStore({
|
||||||
|
db: db.getSqliteDb(),
|
||||||
|
ttlMs: 14 * 24 * 60 * 60 * 1000
|
||||||
|
});
|
||||||
|
|
||||||
app.use(
|
app.use(
|
||||||
session({
|
session({
|
||||||
|
store: sessionStore,
|
||||||
|
name: 'bekultur.sid',
|
||||||
secret: SESSION_SECRET,
|
secret: SESSION_SECRET,
|
||||||
resave: false,
|
resave: false,
|
||||||
saveUninitialized: false,
|
saveUninitialized: false,
|
||||||
|
|
@ -52,11 +125,32 @@ app.use(
|
||||||
maxAge: 14 * 24 * 60 * 60 * 1000, // 14 days
|
maxAge: 14 * 24 * 60 * 60 * 1000, // 14 days
|
||||||
httpOnly: true,
|
httpOnly: true,
|
||||||
sameSite: 'lax',
|
sameSite: 'lax',
|
||||||
secure: process.env.NODE_ENV === 'production'
|
secure: process.env.COOKIE_SECURE === 'true' || (process.env.NODE_ENV === 'production' && process.env.COOKIE_SECURE !== 'false')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Rate Limiters for Production Hardening
|
||||||
|
const isTestEnv = process.env.NODE_ENV === 'test';
|
||||||
|
|
||||||
|
const loginLimiter = rateLimit({
|
||||||
|
windowMs: 15 * 60 * 1000, // 15 minutes
|
||||||
|
max: isTestEnv ? 1000 : 20,
|
||||||
|
standardHeaders: true,
|
||||||
|
legacyHeaders: false,
|
||||||
|
message: 'Çok fazla giriş denemesi yapıldı. Lütfen 15 dakika sonra tekrar deneyiniz.'
|
||||||
|
});
|
||||||
|
|
||||||
|
const apiLimiter = rateLimit({
|
||||||
|
windowMs: 1 * 60 * 1000, // 1 minute
|
||||||
|
max: isTestEnv ? 5000 : 120,
|
||||||
|
standardHeaders: true,
|
||||||
|
legacyHeaders: false,
|
||||||
|
message: { success: false, error: 'Çok fazla istek gönderildi. Lütfen biraz bekleyiniz.' }
|
||||||
|
});
|
||||||
|
|
||||||
|
app.use('/api/', apiLimiter);
|
||||||
|
|
||||||
// Augment express-session
|
// Augment express-session
|
||||||
declare module 'express-session' {
|
declare module 'express-session' {
|
||||||
interface SessionData {
|
interface SessionData {
|
||||||
|
|
@ -66,7 +160,36 @@ declare module 'express-session' {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const db = LocalDatabase.getInstance();
|
// Language Switcher Endpoints
|
||||||
|
app.get('/lang/:locale', (req: Request, res: Response) => {
|
||||||
|
const locale = normalizeLocale(req.params.locale);
|
||||||
|
res.cookie('bekultur_lang', locale, {
|
||||||
|
maxAge: 365 * 24 * 60 * 60 * 1000,
|
||||||
|
httpOnly: false,
|
||||||
|
sameSite: 'lax'
|
||||||
|
});
|
||||||
|
const referer = req.get('Referer') || '/';
|
||||||
|
// Avoid open redirect: only allow relative paths or same host
|
||||||
|
if (referer.startsWith('/')) {
|
||||||
|
return res.redirect(referer);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
const refUrl = new URL(referer);
|
||||||
|
return res.redirect(refUrl.pathname + refUrl.search);
|
||||||
|
} catch {
|
||||||
|
return res.redirect('/');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
app.post('/api/preferences/lang', (req: Request, res: Response) => {
|
||||||
|
const locale = normalizeLocale(req.body?.lang);
|
||||||
|
res.cookie('bekultur_lang', locale, {
|
||||||
|
maxAge: 365 * 24 * 60 * 60 * 1000,
|
||||||
|
httpOnly: false,
|
||||||
|
sameSite: 'lax'
|
||||||
|
});
|
||||||
|
res.json({ success: true, lang: locale });
|
||||||
|
});
|
||||||
|
|
||||||
// Auth guard helper
|
// Auth guard helper
|
||||||
function requireAuth(req: Request, res: Response, next: NextFunction) {
|
function requireAuth(req: Request, res: Response, next: NextFunction) {
|
||||||
|
|
@ -176,9 +299,16 @@ async function executeWithPortalSession<T>(
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------
|
// ----------------------------------------------------
|
||||||
// Routes
|
// Routes & Official E-Kültür Aliases
|
||||||
// ----------------------------------------------------
|
// ----------------------------------------------------
|
||||||
|
|
||||||
|
app.get('/login', (req: Request, res: Response) => res.redirect('/'));
|
||||||
|
app.get('/Kullanici/Giris', (req: Request, res: Response) => res.redirect('/'));
|
||||||
|
app.get('/giris', (req: Request, res: Response) => res.redirect('/'));
|
||||||
|
app.get('/Odev', (req: Request, res: Response) => res.redirect('/dashboard'));
|
||||||
|
app.get('/odev', (req: Request, res: Response) => res.redirect('/dashboard'));
|
||||||
|
app.get('/dersprogrami', (req: Request, res: Response) => res.redirect('/syllabus'));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GET /
|
* GET /
|
||||||
* Login Page
|
* Login Page
|
||||||
|
|
@ -190,11 +320,13 @@ app.get('/', (req: Request, res: Response) => {
|
||||||
|
|
||||||
const rememberedId = req.signedCookies?.bekultur_student_id || '';
|
const rememberedId = req.signedCookies?.bekultur_student_id || '';
|
||||||
const error = (req.query.error as string) || null;
|
const error = (req.query.error as string) || null;
|
||||||
|
const t = res.locals.t;
|
||||||
|
|
||||||
res.render('login', {
|
res.render('login', {
|
||||||
error,
|
error,
|
||||||
rememberedId,
|
rememberedId,
|
||||||
title: 'Login - BeKultur (Better E-Kultur)'
|
activePage: 'login',
|
||||||
|
title: t('login.pageTitle')
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -202,51 +334,56 @@ app.get('/', (req: Request, res: Response) => {
|
||||||
* POST /login
|
* POST /login
|
||||||
* Authenticate against portal and scrape recent assignments
|
* Authenticate against portal and scrape recent assignments
|
||||||
*/
|
*/
|
||||||
app.post('/login', async (req: Request, res: Response) => {
|
app.post('/login', loginLimiter, async (req: Request, res: Response) => {
|
||||||
const { studentId, password, rememberMe } = req.body;
|
const { studentId, password, rememberMe } = req.body;
|
||||||
|
const t = res.locals.t;
|
||||||
|
const cleanStudentId = typeof studentId === 'string' ? studentId.trim() : '';
|
||||||
|
const cleanPassword = typeof password === 'string' ? password : '';
|
||||||
|
|
||||||
if (!studentId || !password) {
|
if (!cleanStudentId || !cleanPassword) {
|
||||||
return res.render('login', {
|
return res.render('login', {
|
||||||
error: 'Please enter both Student ID and Password.',
|
error: t('login.errorMissing'),
|
||||||
rememberedId: studentId || '',
|
rememberedId: cleanStudentId,
|
||||||
title: 'Login - BeKultur'
|
activePage: 'login',
|
||||||
|
title: t('login.pageTitle')
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const loginRes = await ScraperService.login(studentId, password);
|
const loginRes = await ScraperService.login(cleanStudentId, cleanPassword);
|
||||||
|
|
||||||
if (!loginRes.success) {
|
if (!loginRes.success) {
|
||||||
return res.render('login', {
|
return res.render('login', {
|
||||||
error: loginRes.error || 'Authentication failed. Please check your credentials.',
|
error: loginRes.error || t('login.errorInvalid'),
|
||||||
rememberedId: studentId,
|
rememberedId: cleanStudentId,
|
||||||
title: 'Login - BeKultur'
|
activePage: 'login',
|
||||||
|
title: t('login.pageTitle')
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
req.session.studentId = studentId;
|
req.session.studentId = cleanStudentId;
|
||||||
req.session.portalCookies = loginRes.cookies;
|
req.session.portalCookies = loginRes.cookies;
|
||||||
req.session.studentName = loginRes.studentName;
|
req.session.studentName = loginRes.studentName;
|
||||||
|
|
||||||
// Handle "Remember Me"
|
// Handle "Remember Me"
|
||||||
if (rememberMe) {
|
if (rememberMe) {
|
||||||
db.saveCredentials(studentId, password);
|
db.saveCredentials(cleanStudentId, cleanPassword);
|
||||||
res.cookie('bekultur_student_id', studentId, {
|
res.cookie('bekultur_student_id', cleanStudentId, {
|
||||||
signed: true,
|
signed: true,
|
||||||
maxAge: 30 * 24 * 60 * 60 * 1000, // 30 days
|
maxAge: 30 * 24 * 60 * 60 * 1000, // 30 days
|
||||||
httpOnly: true,
|
httpOnly: true,
|
||||||
sameSite: 'lax',
|
sameSite: 'lax',
|
||||||
secure: process.env.NODE_ENV === 'production'
|
secure: process.env.COOKIE_SECURE === 'true' || (process.env.NODE_ENV === 'production' && process.env.COOKIE_SECURE !== 'false')
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
db.clearCredentials(studentId);
|
db.clearCredentials(cleanStudentId);
|
||||||
res.clearCookie('bekultur_student_id');
|
res.clearCookie('bekultur_student_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Scrape recent pages (1-2)
|
// Scrape recent pages (1-2)
|
||||||
try {
|
try {
|
||||||
const scrapeRes = await ScraperService.scrapeMultiplePages(loginRes.cookies, studentId, 2);
|
const scrapeRes = await ScraperService.scrapeMultiplePages(loginRes.cookies, cleanStudentId, 2);
|
||||||
db.mergeAssignments(studentId, scrapeRes.assignments);
|
db.mergeAssignments(cleanStudentId, scrapeRes.assignments);
|
||||||
} catch (scrapeErr: any) {
|
} catch (scrapeErr: any) {
|
||||||
console.warn('Initial scrape warning (cached data will be used if available):', scrapeErr.message);
|
console.warn('Initial scrape warning (cached data will be used if available):', scrapeErr.message);
|
||||||
}
|
}
|
||||||
|
|
@ -255,9 +392,10 @@ app.post('/login', async (req: Request, res: Response) => {
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
console.error('Login route error:', err);
|
console.error('Login route error:', err);
|
||||||
res.render('login', {
|
res.render('login', {
|
||||||
error: 'An unexpected server error occurred during login.',
|
error: t('login.errorServer'),
|
||||||
rememberedId: studentId,
|
rememberedId: cleanStudentId,
|
||||||
title: 'Login - BeKultur'
|
activePage: 'login',
|
||||||
|
title: t('login.pageTitle')
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -284,11 +422,12 @@ app.get('/logout', (req: Request, res: Response) => {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GET /dashboard
|
* GET /dashboard
|
||||||
* English dashboard with stats and checkable assignments
|
* Homework (Ödevler) dashboard with stats and checkable assignments
|
||||||
*/
|
*/
|
||||||
app.get('/dashboard', requireAuth, (req: Request, res: Response) => {
|
app.get('/dashboard', requireAuth, (req: Request, res: Response) => {
|
||||||
const studentId = req.session.studentId!;
|
const studentId = req.session.studentId!;
|
||||||
const studentStore = db.getStudentStore(studentId);
|
const studentStore = db.getStudentStore(studentId);
|
||||||
|
const t = res.locals.t;
|
||||||
|
|
||||||
// Recalculate status for each assignment relative to current date
|
// Recalculate status for each assignment relative to current date
|
||||||
const rawList = Object.values(studentStore.assignments);
|
const rawList = Object.values(studentStore.assignments);
|
||||||
|
|
@ -327,9 +466,10 @@ app.get('/dashboard', requireAuth, (req: Request, res: Response) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
res.render('dashboard', {
|
res.render('dashboard', {
|
||||||
title: 'Dashboard - BeKultur',
|
title: t('dashboard.pageTitle'),
|
||||||
|
activePage: 'dashboard',
|
||||||
studentId,
|
studentId,
|
||||||
studentName: req.session.studentName || `Student ${studentId}`,
|
studentName: req.session.studentName || `${t('dashboard.studentLabel')} ${studentId}`,
|
||||||
lastSynced: studentStore.lastSynced,
|
lastSynced: studentStore.lastSynced,
|
||||||
stats,
|
stats,
|
||||||
assignments: updatedAssignments,
|
assignments: updatedAssignments,
|
||||||
|
|
@ -345,7 +485,7 @@ app.post('/api/toggle', requireAuth, (req: Request, res: Response) => {
|
||||||
const studentId = req.session.studentId!;
|
const studentId = req.session.studentId!;
|
||||||
const { assignmentId, completed } = req.body;
|
const { assignmentId, completed } = req.body;
|
||||||
|
|
||||||
if (!assignmentId) {
|
if (!assignmentId || typeof assignmentId !== 'string') {
|
||||||
return res.status(400).json({ success: false, error: 'Assignment ID is required' });
|
return res.status(400).json({ success: false, error: 'Assignment ID is required' });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -377,7 +517,7 @@ app.post('/api/exclude', requireAuth, (req: Request, res: Response) => {
|
||||||
const studentId = req.session.studentId!;
|
const studentId = req.session.studentId!;
|
||||||
const { assignmentId, excluded } = req.body;
|
const { assignmentId, excluded } = req.body;
|
||||||
|
|
||||||
if (!assignmentId) {
|
if (!assignmentId || typeof assignmentId !== 'string') {
|
||||||
return res.status(400).json({ success: false, error: 'Assignment ID is required' });
|
return res.status(400).json({ success: false, error: 'Assignment ID is required' });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -481,6 +621,8 @@ app.post('/api/sync-all', requireAuth, async (req: Request, res: Response) => {
|
||||||
app.get('/syllabus', requireAuth, async (req: Request, res: Response) => {
|
app.get('/syllabus', requireAuth, async (req: Request, res: Response) => {
|
||||||
const studentId = req.session.studentId!;
|
const studentId = req.session.studentId!;
|
||||||
const currentWeek = SyllabusService.getWeekMetadata();
|
const currentWeek = SyllabusService.getWeekMetadata();
|
||||||
|
const t = res.locals.t;
|
||||||
|
const lang = res.locals.lang as SupportedLocale;
|
||||||
|
|
||||||
let syllabusStore = db.getSyllabus(studentId);
|
let syllabusStore = db.getSyllabus(studentId);
|
||||||
|
|
||||||
|
|
@ -504,7 +646,8 @@ app.get('/syllabus', requireAuth, async (req: Request, res: Response) => {
|
||||||
// Active day: 1 = Mon .. 5 = Fri (if weekend, default to Mon)
|
// Active day: 1 = Mon .. 5 = Fri (if weekend, default to Mon)
|
||||||
const todayDay = new Date().getDay();
|
const todayDay = new Date().getDay();
|
||||||
const defaultDay = todayDay >= 1 && todayDay <= 5 ? todayDay : 1;
|
const defaultDay = todayDay >= 1 && todayDay <= 5 ? todayDay : 1;
|
||||||
const activeDay = req.query.day ? parseInt(req.query.day as string, 10) : defaultDay;
|
const parsedQueryDay = req.query.day ? parseInt(req.query.day as string, 10) : defaultDay;
|
||||||
|
const activeDay = parsedQueryDay >= 1 && parsedQueryDay <= 5 ? parsedQueryDay : defaultDay;
|
||||||
|
|
||||||
// Compute filtered schedule for selected station & advisory teacher
|
// Compute filtered schedule for selected station & advisory teacher
|
||||||
const rawSchedule = syllabusStore?.schedule || {};
|
const rawSchedule = syllabusStore?.schedule || {};
|
||||||
|
|
@ -515,11 +658,14 @@ app.get('/syllabus', requireAuth, async (req: Request, res: Response) => {
|
||||||
|
|
||||||
const currentStatus = SyllabusService.getCurrentLessonStatus(
|
const currentStatus = SyllabusService.getCurrentLessonStatus(
|
||||||
filteredSchedule[activeDay] || [],
|
filteredSchedule[activeDay] || [],
|
||||||
activeDay
|
activeDay,
|
||||||
|
new Date(),
|
||||||
|
lang
|
||||||
);
|
);
|
||||||
|
|
||||||
res.render('syllabus', {
|
res.render('syllabus', {
|
||||||
title: 'Syllabus - BeKultur',
|
title: t('syllabus.pageTitle'),
|
||||||
|
activePage: 'syllabus',
|
||||||
studentId,
|
studentId,
|
||||||
weekId: currentWeek.weekId,
|
weekId: currentWeek.weekId,
|
||||||
weekRange: currentWeek.weekRange,
|
weekRange: currentWeek.weekRange,
|
||||||
|
|
@ -636,6 +782,7 @@ app.post('/api/syllabus/sync', requireAuth, async (req: Request, res: Response)
|
||||||
app.get('/private-lessons', requireAuth, async (req: Request, res: Response) => {
|
app.get('/private-lessons', requireAuth, async (req: Request, res: Response) => {
|
||||||
const studentId = req.session.studentId!;
|
const studentId = req.session.studentId!;
|
||||||
let store = db.getPrivateLessons(studentId);
|
let store = db.getPrivateLessons(studentId);
|
||||||
|
const t = res.locals.t;
|
||||||
|
|
||||||
// If not yet synced or formMeta missing, try auto-syncing
|
// If not yet synced or formMeta missing, try auto-syncing
|
||||||
if (!store || !store.lessons || !store.formMeta) {
|
if (!store || !store.lessons || !store.formMeta) {
|
||||||
|
|
@ -661,9 +808,10 @@ app.get('/private-lessons', requireAuth, async (req: Request, res: Response) =>
|
||||||
const subjects = Array.from(new Set(allLessons.map(l => l.subject))).sort();
|
const subjects = Array.from(new Set(allLessons.map(l => l.subject))).sort();
|
||||||
|
|
||||||
res.render('private-lessons', {
|
res.render('private-lessons', {
|
||||||
title: 'Private Lessons - BeKultur',
|
title: t('privateLessons.pageTitle'),
|
||||||
|
activePage: 'private-lessons',
|
||||||
studentId,
|
studentId,
|
||||||
studentName: req.session.studentName || store?.formMeta?.studentName || `Student ${studentId}`,
|
studentName: req.session.studentName || store?.formMeta?.studentName || `${t('dashboard.studentLabel')} ${studentId}`,
|
||||||
formMeta: store?.formMeta || null,
|
formMeta: store?.formMeta || null,
|
||||||
detectedAdvisor: store?.detectedAdvisor || db.getStudentAdvisoryTeacher(studentId) || null,
|
detectedAdvisor: store?.detectedAdvisor || db.getStudentAdvisoryTeacher(studentId) || null,
|
||||||
lastSynced: store?.lastSynced || null,
|
lastSynced: store?.lastSynced || null,
|
||||||
|
|
@ -678,6 +826,7 @@ app.get('/private-lessons', requireAuth, async (req: Request, res: Response) =>
|
||||||
* Redirect shortcuts
|
* Redirect shortcuts
|
||||||
*/
|
*/
|
||||||
app.get('/ozelders', (req: Request, res: Response) => res.redirect('/private-lessons'));
|
app.get('/ozelders', (req: Request, res: Response) => res.redirect('/private-lessons'));
|
||||||
|
app.get('/OzelDers', (req: Request, res: Response) => res.redirect('/private-lessons'));
|
||||||
app.get('/ozeldersistek', (req: Request, res: Response) => res.redirect('/private-lessons'));
|
app.get('/ozeldersistek', (req: Request, res: Response) => res.redirect('/private-lessons'));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -801,6 +950,7 @@ app.get('/rapor/sinav', (req: Request, res: Response) => {
|
||||||
app.get('/exams', requireAuth, async (req: Request, res: Response) => {
|
app.get('/exams', requireAuth, async (req: Request, res: Response) => {
|
||||||
const studentId = req.session.studentId!;
|
const studentId = req.session.studentId!;
|
||||||
let examStore = db.getExamReports(studentId);
|
let examStore = db.getExamReports(studentId);
|
||||||
|
const t = res.locals.t;
|
||||||
|
|
||||||
// If no cached exams or empty, sync now
|
// If no cached exams or empty, sync now
|
||||||
if (!examStore || !examStore.reports || Object.keys(examStore.reports).length === 0) {
|
if (!examStore || !examStore.reports || Object.keys(examStore.reports).length === 0) {
|
||||||
|
|
@ -842,7 +992,8 @@ app.get('/exams', requireAuth, async (req: Request, res: Response) => {
|
||||||
const kpis = ExamService.calculateKPIs(processedExams);
|
const kpis = ExamService.calculateKPIs(processedExams);
|
||||||
|
|
||||||
res.render('exams', {
|
res.render('exams', {
|
||||||
title: 'Sınav Raporları - BeKultur',
|
title: t('exams.pageTitle'),
|
||||||
|
activePage: 'exams',
|
||||||
studentId,
|
studentId,
|
||||||
studentName: req.session.studentName || '',
|
studentName: req.session.studentName || '',
|
||||||
allExams: processedExams,
|
allExams: processedExams,
|
||||||
|
|
@ -863,7 +1014,7 @@ app.get('/api/exams/:id', requireAuth, async (req: Request, res: Response) => {
|
||||||
const examId = req.params.id;
|
const examId = req.params.id;
|
||||||
|
|
||||||
let examStore = db.getExamReports(studentId);
|
let examStore = db.getExamReports(studentId);
|
||||||
let exam = examStore?.reports?.[examId];
|
const exam = examStore?.reports?.[examId];
|
||||||
|
|
||||||
if (!exam) {
|
if (!exam) {
|
||||||
try {
|
try {
|
||||||
|
|
@ -917,7 +1068,7 @@ app.get('/api/exams/:id/questions', requireAuth, async (req: Request, res: Respo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if all questions for this exam and tip are cached in db.json
|
// Check if all questions for this exam and tip are cached in SQLite
|
||||||
const cachedQuestions = db.getExamQuestions(studentId, cacheKey);
|
const cachedQuestions = db.getExamQuestions(studentId, cacheKey);
|
||||||
if (cachedQuestions && cachedQuestions.length > 0) {
|
if (cachedQuestions && cachedQuestions.length > 0) {
|
||||||
const subjectsMap: Record<string, { subjectName: string; subjectId: string; questions: any[] }> = {};
|
const subjectsMap: Record<string, { subjectName: string; subjectId: string; questions: any[] }> = {};
|
||||||
|
|
@ -1071,14 +1222,30 @@ app.post('/api/exams/sync', requireAuth, async (req: Request, res: Response) =>
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Start Server
|
// Start Server & Graceful Shutdown
|
||||||
if (process.env.NODE_ENV !== 'test') {
|
if (process.env.NODE_ENV !== 'test') {
|
||||||
app.listen(PORT, () => {
|
const server = app.listen(PORT, () => {
|
||||||
console.log(`=========================================`);
|
console.log(`=========================================`);
|
||||||
console.log(` BeKultur (Better E-Kultur) Server`);
|
console.log(` BeKultur (Better E-Kultur) Server`);
|
||||||
console.log(` Running at: http://localhost:${PORT}`);
|
console.log(` Running at: http://localhost:${PORT}`);
|
||||||
console.log(`=========================================`);
|
console.log(`=========================================`);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const shutdown = (signal: string) => {
|
||||||
|
console.log(`\n[${signal}] Shutting down BeKultur server gracefully...`);
|
||||||
|
sessionStore.stopPruning();
|
||||||
|
server.close(() => {
|
||||||
|
db.close();
|
||||||
|
process.exit(0);
|
||||||
|
});
|
||||||
|
setTimeout(() => {
|
||||||
|
db.close();
|
||||||
|
process.exit(0);
|
||||||
|
}, 5000).unref();
|
||||||
|
};
|
||||||
|
|
||||||
|
process.on('SIGTERM', () => shutdown('SIGTERM'));
|
||||||
|
process.on('SIGINT', () => shutdown('SIGINT'));
|
||||||
}
|
}
|
||||||
|
|
||||||
export default app;
|
export default app;
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
519
src/services/i18n.ts
Normal file
519
src/services/i18n.ts
Normal file
|
|
@ -0,0 +1,519 @@
|
||||||
|
export type SupportedLocale = 'tr' | 'en';
|
||||||
|
|
||||||
|
export const DEFAULT_LOCALE: SupportedLocale = 'tr';
|
||||||
|
|
||||||
|
export const DAY_NAMES_BY_LOCALE: Record<SupportedLocale, Record<number, string>> = {
|
||||||
|
tr: {
|
||||||
|
1: 'Pazartesi',
|
||||||
|
2: 'Salı',
|
||||||
|
3: 'Çarşamba',
|
||||||
|
4: 'Perşembe',
|
||||||
|
5: 'Cuma'
|
||||||
|
},
|
||||||
|
en: {
|
||||||
|
1: 'Pazartesi',
|
||||||
|
2: 'Salı',
|
||||||
|
3: 'Çarşamba',
|
||||||
|
4: 'Perşembe',
|
||||||
|
5: 'Cuma'
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const translations: Record<SupportedLocale, Record<string, string>> = {
|
||||||
|
tr: {
|
||||||
|
// Brand & Common
|
||||||
|
'app.title': 'BeKultur (E-Kültür)',
|
||||||
|
'nav.homework': 'Ödevler',
|
||||||
|
'nav.syllabus': 'Ders Programı',
|
||||||
|
'nav.privateLessons': 'Özel Ders',
|
||||||
|
'nav.exams': 'Sınav Raporları',
|
||||||
|
'header.student': 'Öğrenci',
|
||||||
|
'header.logout': 'Çıkış Yap',
|
||||||
|
'header.themeToggle': 'Tema Değiştir',
|
||||||
|
'header.themeLight': 'Açık Tema',
|
||||||
|
'header.themeDark': 'Koyu Tema',
|
||||||
|
'header.langToggleTitle': 'Dili Değiştir / Switch Language',
|
||||||
|
|
||||||
|
// Login (/Kullanici/Giris parity)
|
||||||
|
'login.pageTitle': 'Giriş Yap - BeKultur (E-Kültür)',
|
||||||
|
'login.subtitle': 'E-Kültür öğrenci portalı bilgilerinizle giriş yapınız.',
|
||||||
|
'login.studentIdLabel': 'Öğrenci ID',
|
||||||
|
'login.studentIdPlaceholder': 'Öğrenci ID',
|
||||||
|
'login.passwordLabel': 'Parola',
|
||||||
|
'login.passwordPlaceholder': 'Parola',
|
||||||
|
'login.rememberMe': 'Beni hatırla',
|
||||||
|
'login.submit': 'Giriş Yap',
|
||||||
|
'login.submitting': 'Giriş yapılıyor...',
|
||||||
|
'login.errorMissing': 'Lütfen Öğrenci ID ve Parola alanlarını doldurunuz.',
|
||||||
|
'login.errorInvalid': 'Öğrenci ID veya Parola hatalı.',
|
||||||
|
'login.errorServer': 'Giriş sırasında beklenmeyen bir sunucu hatası oluştu.',
|
||||||
|
|
||||||
|
// Homework / Dashboard (/Odev parity)
|
||||||
|
'dashboard.pageTitle': 'Ödevler - BeKultur',
|
||||||
|
'dashboard.title': 'Ödevler',
|
||||||
|
'dashboard.studentLabel': 'Öğrenci',
|
||||||
|
'dashboard.lastSynced': 'Son güncelleme:',
|
||||||
|
'dashboard.notSynced': 'Henüz güncellenmedi',
|
||||||
|
'dashboard.syncRecent': 'Güncel Ödevleri Çek',
|
||||||
|
'dashboard.syncAll': 'Tüm Geçmişi Çek',
|
||||||
|
'dashboard.syncing': 'Güncelleniyor...',
|
||||||
|
'dashboard.syncingAll': 'Tüm geçmiş çekiliyor...',
|
||||||
|
'dashboard.fetchingRecent': 'Güncel ödevler E-Kültür portalından çekiliyor...',
|
||||||
|
'dashboard.fetchingAll': 'Tüm ödev geçmişi E-Kültür portalından çekiliyor...',
|
||||||
|
'dashboard.syncFailed': 'Senkronizasyon başarısız:',
|
||||||
|
'dashboard.networkError': 'Senkronizasyon sırasında ağ hatası oluştu.',
|
||||||
|
'dashboard.statCompletion': 'Tamamlanma',
|
||||||
|
'dashboard.statDoneUnit': 'tamamlandı',
|
||||||
|
'dashboard.statActive': 'Aktif',
|
||||||
|
'dashboard.statActiveSub': 'Devam eden ödevler',
|
||||||
|
'dashboard.statNextWeek': 'Gelecek Hafta Kontrol',
|
||||||
|
'dashboard.statNextWeekSub': 'Haftaya teslim / kontrol',
|
||||||
|
'dashboard.statDueSoon': 'Yaklaşan',
|
||||||
|
'dashboard.statDueSoonSub': '3 gün içinde biten',
|
||||||
|
'dashboard.statOverdue': 'Süresi Geçen',
|
||||||
|
'dashboard.statOverdueSub': 'Bitiş tarihi geçmiş',
|
||||||
|
'dashboard.statTotal': 'Toplam',
|
||||||
|
'dashboard.statTotalSub': 'Tüm ödevler',
|
||||||
|
'dashboard.subjectsTitle': 'Dersler',
|
||||||
|
'dashboard.tabAll': 'Tümü',
|
||||||
|
'dashboard.tabNextWeek': 'Gelecek Hafta Kontrol',
|
||||||
|
'dashboard.tabActive': 'Aktif',
|
||||||
|
'dashboard.tabDueSoon': 'Yaklaşan',
|
||||||
|
'dashboard.tabCompleted': 'Tamamlanan',
|
||||||
|
'dashboard.tabOverdue': 'Süresi Geçen',
|
||||||
|
'dashboard.tabExcluded': 'Hariç Tutulan',
|
||||||
|
'dashboard.searchPlaceholder': 'Ders, yayın, ünite, konu veya açıklamaya göre ara...',
|
||||||
|
'dashboard.allSubjectsOption': 'Tüm Dersler',
|
||||||
|
'dashboard.showingCount': '{count} ödev gösteriliyor',
|
||||||
|
'dashboard.noResults': 'Filtrelere uygun ödev bulunamadı.',
|
||||||
|
'dashboard.resetFilters': 'Filtreleri Sıfırla',
|
||||||
|
'dashboard.checkDateBadge': 'Kontrol:',
|
||||||
|
'dashboard.badgeExcluded': 'Hariç Tutuldu',
|
||||||
|
'dashboard.badgeCompleted': 'Tamamlandı',
|
||||||
|
'dashboard.badgeNextWeek': 'Gelecek Hafta',
|
||||||
|
'dashboard.badgeDueSoon': 'Yaklaşan',
|
||||||
|
'dashboard.badgeOverdue': 'Süresi Geçti',
|
||||||
|
'dashboard.badgeActive': 'Aktif',
|
||||||
|
'dashboard.btnExclude': 'Hariç Tut',
|
||||||
|
'dashboard.btnRestore': 'Geri Al',
|
||||||
|
'dashboard.btnExcludeTitle': 'Bu ödevi listenden hariç tut (örn. başka sınıfa ait ödev)',
|
||||||
|
'dashboard.btnRestoreTitle': 'Bu ödevi aktif listene geri ekle',
|
||||||
|
'dashboard.unitLabel': 'Ünite:',
|
||||||
|
'dashboard.topicLabel': 'Konu:',
|
||||||
|
'dashboard.dateRangeLabel': 'Başlangıç - Bitiş Tarihi:',
|
||||||
|
'dashboard.descriptionLabel': 'Açıklama:',
|
||||||
|
'dashboard.completedOn': 'Tamamlandı:',
|
||||||
|
'dashboard.offlineToggleAlert': 'Çevrimdışı moddasınız. Ödev durumu internet bağlantısı olmadan değiştirilemez.',
|
||||||
|
'dashboard.offlineExcludeAlert': 'Çevrimdışı moddasınız. Ödev hariç tutma/geri alma işlemi için internet bağlantısı gereklidir.',
|
||||||
|
'dashboard.offlineSyncAlert': 'Çevrimdışı moddasınız. Senkronizasyon için internet bağlantısı gereklidir.',
|
||||||
|
|
||||||
|
// Syllabus (/dersprogrami parity)
|
||||||
|
'syllabus.pageTitle': 'Ders Programı - BeKultur',
|
||||||
|
'syllabus.title': 'Ders Programı',
|
||||||
|
'syllabus.weekLabel': 'Hafta:',
|
||||||
|
'syllabus.syncedLabel': 'Son güncelleme:',
|
||||||
|
'syllabus.notSynced': 'Henüz güncellenmedi',
|
||||||
|
'syllabus.syncBtn': 'Ders Programını Güncelle',
|
||||||
|
'syllabus.syncing': 'Güncelleniyor...',
|
||||||
|
'syllabus.fetchingAlert': '5 günlük ders programı E-Kültür portalından çekiliyor...',
|
||||||
|
'syllabus.updatedAlert': 'Ders programı başarıyla güncellendi!',
|
||||||
|
'syllabus.stationLabel': 'İstasyon:',
|
||||||
|
'syllabus.allStations': 'Tüm İstasyonlar',
|
||||||
|
'syllabus.advisorLabel': 'Danışman:',
|
||||||
|
'syllabus.advisoryTag': 'Danışmanlık',
|
||||||
|
'syllabus.viewLabel': 'Görünüm:',
|
||||||
|
'syllabus.dayView': 'Günlük Görünüm',
|
||||||
|
'syllabus.weekView': 'Haftalık Tablo',
|
||||||
|
'syllabus.todayBadge': 'Bugün',
|
||||||
|
'syllabus.noLessonsDay': '{day} günü için ders kaydı bulunamadı. Portaldan çekmek için "Ders Programını Güncelle" butonuna tıklayınız.',
|
||||||
|
'syllabus.classBadge': 'Sınıf',
|
||||||
|
'syllabus.periodHeader': 'Ders Saati',
|
||||||
|
'syllabus.periodNumberLabel': '{period}. Ders',
|
||||||
|
'syllabus.nowInSession': 'Şu anki ders: {period} — {subject} ({time})',
|
||||||
|
'syllabus.nextUp': 'Sıradaki ders: {period} — {subject} ({time})',
|
||||||
|
'syllabus.offlineStationAlert': 'Çevrimdışı moddasınız. İstasyon seçimi için internet bağlantısı gereklidir.',
|
||||||
|
|
||||||
|
// Private Lessons (/ozelders & /ozeldersistek parity)
|
||||||
|
'privateLessons.pageTitle': 'Özel Ders - BeKultur',
|
||||||
|
'privateLessons.title': 'Özel Ders',
|
||||||
|
'privateLessons.subtitle': 'Özel Ders & Başvuru',
|
||||||
|
'privateLessons.syncedLabel': 'Son güncelleme:',
|
||||||
|
'privateLessons.syncBtn': 'Dersleri Güncelle',
|
||||||
|
'privateLessons.syncing': 'Güncelleniyor...',
|
||||||
|
'privateLessons.syncSuccess': '{count} özel ders kaydı başarıyla güncellendi.',
|
||||||
|
'privateLessons.advisorLabel': 'Danışman:',
|
||||||
|
'privateLessons.policyNote': 'Başkası adına özel ders almayınız, seçtiğiniz öğretmen onayladığı takdirde özel derse alınacaksınız.',
|
||||||
|
'privateLessons.requestTitle': 'Özel Ders İstek',
|
||||||
|
'privateLessons.onlineBadge': 'Online Başvuru',
|
||||||
|
'privateLessons.courseLabel': 'Ders',
|
||||||
|
'privateLessons.unitLabel': 'Ünite',
|
||||||
|
'privateLessons.topicLabel': 'Konu',
|
||||||
|
'privateLessons.loading': 'Yükleniyor...',
|
||||||
|
'privateLessons.selectPrompt': 'Seçiniz...',
|
||||||
|
'privateLessons.selectCourseFirst': 'Önce ders seçiniz...',
|
||||||
|
'privateLessons.selectUnitFirst': 'Önce ünite seçiniz...',
|
||||||
|
'privateLessons.noUnitFound': 'Ünite bulunamadı',
|
||||||
|
'privateLessons.noTopicFound': 'Konu bulunamadı',
|
||||||
|
'privateLessons.errorOccurred': 'Hata oluştu',
|
||||||
|
'privateLessons.submitBtn': 'Gönder',
|
||||||
|
'privateLessons.submittingBtn': 'Gönderiliyor...',
|
||||||
|
'privateLessons.myLessonsTitle': 'Özel Derslerim',
|
||||||
|
'privateLessons.filterAll': 'Tümü',
|
||||||
|
'privateLessons.upcomingGroupTitle': 'Yaklaşan / Onaylanan Özel Dersler',
|
||||||
|
'privateLessons.upcomingBadge': 'Yaklaşan',
|
||||||
|
'privateLessons.activeCountBadge': '{count} Aktif',
|
||||||
|
'privateLessons.pastGroupTitle': 'Özel Ders Geçmişi',
|
||||||
|
'privateLessons.pastCountBadge': '{count} Geçmiş',
|
||||||
|
'privateLessons.completedBadge': 'Tamamlandı',
|
||||||
|
'privateLessons.emptyState': 'Henüz kayıtlı özel dersiniz bulunmuyor. Yukarıdaki formdan başvuru yapabilir veya portaldan çekmek için "Dersleri Güncelle" butonuna tıklayabilirsiniz.',
|
||||||
|
|
||||||
|
// Exam Reports (/rapor/sinav, /rapor/sinavkarne, /rapor/yanliskonu, /ogrencisoruanaliz parity)
|
||||||
|
'exams.pageTitle': 'Sınav Raporları - BeKultur',
|
||||||
|
'exams.title': 'Sınav Raporları',
|
||||||
|
'exams.subtitle': 'Sınav Karne, Gelişim Analizi & Öğrenci Soru Analiz',
|
||||||
|
'exams.syncedLabel': 'Son güncelleme:',
|
||||||
|
'exams.syncBtn': 'Sınavları Güncelle',
|
||||||
|
'exams.syncing': 'Güncelleniyor...',
|
||||||
|
'exams.kpiLatestNet': 'Son Sınav Neti',
|
||||||
|
'exams.kpiVsPrior': 'net (önceki sınava göre)',
|
||||||
|
'exams.kpiBaseline': 'İlk sınav (Referans)',
|
||||||
|
'exams.kpiBestNet': 'En Yüksek Net',
|
||||||
|
'exams.kpiAcrossExams': 'Toplam {count} sınav içinde',
|
||||||
|
'exams.kpiAvgNet': 'Ortalama Net',
|
||||||
|
'exams.kpiAvgSub': 'Genel net ortalaması',
|
||||||
|
'exams.kpiCurrentRank': 'Genel Sıra',
|
||||||
|
'exams.kpiBestRank': 'En iyi derece: #{rank}',
|
||||||
|
'exams.kpiGeneralStanding': 'Genel sıralama',
|
||||||
|
'exams.filterAll': 'Tüm Sınavlar',
|
||||||
|
'exams.answerKey': 'Cevap Anahtarı',
|
||||||
|
'exams.generalRankLabel': 'Genel Sıra :',
|
||||||
|
'exams.schoolRankLabel': 'Okul Sıra :',
|
||||||
|
'exams.rankDeltaUnit': 'sıra',
|
||||||
|
'exams.reviewMistakesBtn': '{count} Yanlış / Boş Soruyu İncele',
|
||||||
|
'exams.subtabBreakdown': 'Sınav Karne (Ders Dağılımı)',
|
||||||
|
'exams.subtabWeakness': 'Yanlış Konular (Zayıf Konu Analizi)',
|
||||||
|
'exams.colSubject': 'Ders',
|
||||||
|
'exams.colQuestions': 'Soru',
|
||||||
|
'exams.colCorrect': 'Doğru',
|
||||||
|
'exams.colWrong': 'Yanlış',
|
||||||
|
'exams.colEmpty': 'Boş',
|
||||||
|
'exams.colNet': 'Net',
|
||||||
|
'exams.colDeltaNet': 'Net Değişim (Δ)',
|
||||||
|
'exams.colSuccessRate': 'Başarı Oranı',
|
||||||
|
'exams.rowTotal': 'TOPLAM',
|
||||||
|
'exams.viewWrongQuestionsTitle': '{count} yanlış soruyu görüntülemek için tıklayınız',
|
||||||
|
'exams.viewEmptyQuestionsTitle': '{count} boş soruyu görüntülemek için tıklayınız',
|
||||||
|
'exams.weaknessLoading': 'Yanlış konu analizi yükleniyor...',
|
||||||
|
'exams.weaknessEmpty': 'Bu sınav için henüz yanlış konu kaydı bulunamadı veya tüm konularda tam başarı sağlandı.',
|
||||||
|
'exams.weaknessError': 'Yanlış konu raporu yüklenirken bir hata oluştu.',
|
||||||
|
'exams.weaknessTotal': 'Toplam:',
|
||||||
|
'exams.weaknessCorrect': 'Doğru:',
|
||||||
|
'exams.weaknessWrong': 'Yanlış:',
|
||||||
|
'exams.weaknessEmptyCount': 'Boş:',
|
||||||
|
'exams.modalTitle': 'Öğrenci Soru Analiz',
|
||||||
|
'exams.modalSubtitle': 'Yanlış ve Boş Bırakılan Sorular',
|
||||||
|
'exams.modalTypeAll': 'Tümü',
|
||||||
|
'exams.modalTypeWrong': 'Yanlış',
|
||||||
|
'exams.modalTypeEmpty': 'Boş',
|
||||||
|
'exams.modalAllMistakes': 'Tüm Sorular',
|
||||||
|
'exams.modalLoading': 'Sorular getiriliyor...',
|
||||||
|
'exams.modalNoMatch': 'Seçili filtrelere uygun soru bulunamadı.',
|
||||||
|
'exams.modalError': 'Sorular yüklenirken bir hata oluştu.',
|
||||||
|
'exams.questionNo': 'SoruNo: {num}',
|
||||||
|
'exams.correctAnswer': 'Doğru Cevap:',
|
||||||
|
'exams.studentAnswer': 'Öğrenci Cevap:',
|
||||||
|
'exams.emptyAnswerText': 'Boş',
|
||||||
|
'exams.zoomHint': 'Büyütmek için tıklayınız',
|
||||||
|
'exams.noImage': 'Soru görseli bulunamadı.',
|
||||||
|
'exams.emptyTitle': 'Henüz Sınav Raporu Bulunmuyor',
|
||||||
|
'exams.emptyDesc': 'Öğrenci portalındaki sınav karnelerinizi içe aktarmak için "Sınavları Güncelle" butonuna tıklayınız.',
|
||||||
|
|
||||||
|
// Exam Ratings
|
||||||
|
'rating.Breakthrough': 'Sıçrama',
|
||||||
|
'rating.Outperformed Curve': 'Zor Sınavda Başarı',
|
||||||
|
'rating.Net Growth': 'Net Artışı',
|
||||||
|
'rating.Rank Climb': 'Sıralama Yükselişi',
|
||||||
|
'rating.Top 10 Consistency': 'İlk 10 İstikrarı',
|
||||||
|
'rating.Needs Review': 'Tekrar Gerekli',
|
||||||
|
'rating.Stable Performance': 'Dengeli Performans',
|
||||||
|
'rating.Top 10 Baseline': 'İlk 10 Başlangıç',
|
||||||
|
'rating.Baseline Exam': 'İlk Sınav',
|
||||||
|
|
||||||
|
// PWA & Offline
|
||||||
|
'pwa.offlineBadge': '⚡ Çevrimdışı',
|
||||||
|
'pwa.offlineText': 'Önbellekteki veriler gösteriliyor. Bağlantı gerektiren işlemler duraklatıldı.',
|
||||||
|
'pwa.onlineBadge': '✓ Çevrimiçi',
|
||||||
|
'pwa.onlineText': 'Bağlantı yeniden sağlandı. Canlı özellikler aktif.',
|
||||||
|
'pwa.offlineSuffix': '(Çevrimdışı)',
|
||||||
|
'pwa.offlineCheckboxTitle': 'Çevrimdışı mod: Ödev durumu bağlantı olmadan değiştirilemez.',
|
||||||
|
'pwa.offlineExcludeTitle': 'Çevrimdışı mod: Ödev bağlantı olmadan hariç tutulamaz.',
|
||||||
|
'pwa.offlineStationTitle': 'Çevrimdışı mod: İstasyon seçimi bağlantı gerektirir.',
|
||||||
|
'pwa.offlineSyncTitle': 'Çevrimdışı mod: Senkronizasyon internet bağlantısı gerektirir.',
|
||||||
|
'pwa.offlinePrivateNotice': '⚡ <strong>Çevrimdışı mod:</strong> Yeni özel ders başvurusu yapmak için internet bağlantısı gereklidir.'
|
||||||
|
},
|
||||||
|
|
||||||
|
en: {
|
||||||
|
// Brand & Common
|
||||||
|
'app.title': 'BeKultur (Better E-Kultur)',
|
||||||
|
'nav.homework': 'Homework',
|
||||||
|
'nav.syllabus': 'Syllabus',
|
||||||
|
'nav.privateLessons': 'Private Lessons',
|
||||||
|
'nav.exams': 'Exams',
|
||||||
|
'header.student': 'Student',
|
||||||
|
'header.logout': 'Log out',
|
||||||
|
'header.themeToggle': 'Toggle Theme',
|
||||||
|
'header.themeLight': 'Light Theme',
|
||||||
|
'header.themeDark': 'Dark Theme',
|
||||||
|
'header.langToggleTitle': 'Switch Language / Dili Değiştir',
|
||||||
|
|
||||||
|
// Login
|
||||||
|
'login.pageTitle': 'Login - BeKultur (Better E-Kultur)',
|
||||||
|
'login.subtitle': 'Log in with your school portal credentials.',
|
||||||
|
'login.studentIdLabel': 'Student ID',
|
||||||
|
'login.studentIdPlaceholder': 'Student ID',
|
||||||
|
'login.passwordLabel': 'Password',
|
||||||
|
'login.passwordPlaceholder': 'Password',
|
||||||
|
'login.rememberMe': 'Remember credentials',
|
||||||
|
'login.submit': 'Log In',
|
||||||
|
'login.submitting': 'Logging in...',
|
||||||
|
'login.errorMissing': 'Please enter both Student ID and Password.',
|
||||||
|
'login.errorInvalid': 'Authentication failed. Please check your credentials.',
|
||||||
|
'login.errorServer': 'An unexpected server error occurred during login.',
|
||||||
|
|
||||||
|
// Homework / Dashboard
|
||||||
|
'dashboard.pageTitle': 'Dashboard - BeKultur',
|
||||||
|
'dashboard.title': 'Homework',
|
||||||
|
'dashboard.studentLabel': 'Student',
|
||||||
|
'dashboard.lastSynced': 'Last synced:',
|
||||||
|
'dashboard.notSynced': 'Not synced',
|
||||||
|
'dashboard.syncRecent': 'Sync Recent',
|
||||||
|
'dashboard.syncAll': 'Sync Full History',
|
||||||
|
'dashboard.syncing': 'Syncing...',
|
||||||
|
'dashboard.syncingAll': 'Syncing all...',
|
||||||
|
'dashboard.fetchingRecent': 'Fetching recent assignments...',
|
||||||
|
'dashboard.fetchingAll': 'Syncing full history from portal...',
|
||||||
|
'dashboard.syncFailed': 'Sync failed:',
|
||||||
|
'dashboard.networkError': 'Network error while syncing.',
|
||||||
|
'dashboard.statCompletion': 'Completion',
|
||||||
|
'dashboard.statDoneUnit': 'done',
|
||||||
|
'dashboard.statActive': 'Active',
|
||||||
|
'dashboard.statActiveSub': 'In progress',
|
||||||
|
'dashboard.statNextWeek': 'Checked Next Week',
|
||||||
|
'dashboard.statNextWeekSub': 'Due or checked next week',
|
||||||
|
'dashboard.statDueSoon': 'Due Soon',
|
||||||
|
'dashboard.statDueSoonSub': 'Within 3 days',
|
||||||
|
'dashboard.statOverdue': 'Overdue',
|
||||||
|
'dashboard.statOverdueSub': 'Past deadline',
|
||||||
|
'dashboard.statTotal': 'Total',
|
||||||
|
'dashboard.statTotalSub': 'All assignments',
|
||||||
|
'dashboard.subjectsTitle': 'Subjects',
|
||||||
|
'dashboard.tabAll': 'All',
|
||||||
|
'dashboard.tabNextWeek': 'Checked Next Week',
|
||||||
|
'dashboard.tabActive': 'Active',
|
||||||
|
'dashboard.tabDueSoon': 'Due Soon',
|
||||||
|
'dashboard.tabCompleted': 'Completed',
|
||||||
|
'dashboard.tabOverdue': 'Overdue',
|
||||||
|
'dashboard.tabExcluded': 'Excluded',
|
||||||
|
'dashboard.searchPlaceholder': 'Filter by subject, book, or description...',
|
||||||
|
'dashboard.allSubjectsOption': 'All Subjects',
|
||||||
|
'dashboard.showingCount': 'Showing {count} assignments',
|
||||||
|
'dashboard.noResults': 'No matching assignments found.',
|
||||||
|
'dashboard.resetFilters': 'Reset filters',
|
||||||
|
'dashboard.checkDateBadge': 'Kontrol:',
|
||||||
|
'dashboard.badgeExcluded': 'Excluded',
|
||||||
|
'dashboard.badgeCompleted': 'Done',
|
||||||
|
'dashboard.badgeNextWeek': 'Next Week',
|
||||||
|
'dashboard.badgeDueSoon': 'Due Soon',
|
||||||
|
'dashboard.badgeOverdue': 'Overdue',
|
||||||
|
'dashboard.badgeActive': 'Active',
|
||||||
|
'dashboard.btnExclude': 'Exclude',
|
||||||
|
'dashboard.btnRestore': 'Restore',
|
||||||
|
'dashboard.btnExcludeTitle': 'Exclude this homework (e.g. from another class)',
|
||||||
|
'dashboard.btnRestoreTitle': 'Restore this homework to your active list',
|
||||||
|
'dashboard.unitLabel': 'Ünite:',
|
||||||
|
'dashboard.topicLabel': 'Konu:',
|
||||||
|
'dashboard.dateRangeLabel': 'Start - End Date:',
|
||||||
|
'dashboard.descriptionLabel': 'Description:',
|
||||||
|
'dashboard.completedOn': 'Done:',
|
||||||
|
'dashboard.offlineToggleAlert': 'You are offline. Homework status cannot be changed without an internet connection.',
|
||||||
|
'dashboard.offlineExcludeAlert': 'You are offline. Excluding/restoring homework requires an internet connection.',
|
||||||
|
'dashboard.offlineSyncAlert': 'You are offline. Syncing requires an internet connection.',
|
||||||
|
|
||||||
|
// Syllabus
|
||||||
|
'syllabus.pageTitle': 'Syllabus - BeKultur',
|
||||||
|
'syllabus.title': 'Syllabus',
|
||||||
|
'syllabus.weekLabel': 'Week:',
|
||||||
|
'syllabus.syncedLabel': 'Synced:',
|
||||||
|
'syllabus.notSynced': 'Not synced',
|
||||||
|
'syllabus.syncBtn': 'Sync Syllabus',
|
||||||
|
'syllabus.syncing': 'Syncing...',
|
||||||
|
'syllabus.fetchingAlert': 'Fetching weekly timetable across all 5 days...',
|
||||||
|
'syllabus.updatedAlert': 'Syllabus updated successfully!',
|
||||||
|
'syllabus.stationLabel': 'Station:',
|
||||||
|
'syllabus.allStations': 'All Stations',
|
||||||
|
'syllabus.advisorLabel': 'Advisor:',
|
||||||
|
'syllabus.advisoryTag': 'Danışmanlık',
|
||||||
|
'syllabus.viewLabel': 'View:',
|
||||||
|
'syllabus.dayView': 'Day View',
|
||||||
|
'syllabus.weekView': 'Full Week Grid',
|
||||||
|
'syllabus.todayBadge': 'Today',
|
||||||
|
'syllabus.noLessonsDay': 'No lessons found for {day}. Click "Sync Syllabus" to fetch from portal.',
|
||||||
|
'syllabus.classBadge': 'Class',
|
||||||
|
'syllabus.periodHeader': 'Period',
|
||||||
|
'syllabus.periodNumberLabel': '{period}. Ders',
|
||||||
|
'syllabus.nowInSession': 'Now in session: {period} — {subject} ({time})',
|
||||||
|
'syllabus.nextUp': 'Next up: {period} — {subject} at {time}',
|
||||||
|
'syllabus.offlineStationAlert': 'You are offline. Station selection requires an internet connection.',
|
||||||
|
|
||||||
|
// Private Lessons
|
||||||
|
'privateLessons.pageTitle': 'Private Lessons - BeKultur',
|
||||||
|
'privateLessons.title': 'Private Lessons',
|
||||||
|
'privateLessons.subtitle': 'Özel Ders & Başvuru',
|
||||||
|
'privateLessons.syncedLabel': 'Synced:',
|
||||||
|
'privateLessons.syncBtn': 'Sync Lessons',
|
||||||
|
'privateLessons.syncing': 'Syncing...',
|
||||||
|
'privateLessons.syncSuccess': 'Successfully refreshed {count} private lesson records.',
|
||||||
|
'privateLessons.advisorLabel': 'Advisor:',
|
||||||
|
'privateLessons.policyNote': 'Başkası adına özel ders almayınız, seçtiğiniz öğretmen onayladığı takdirde özel derse alınacaksınız.',
|
||||||
|
'privateLessons.requestTitle': 'New Lesson Request (Özel Ders İstek)',
|
||||||
|
'privateLessons.onlineBadge': 'Online Başvuru',
|
||||||
|
'privateLessons.courseLabel': 'Ders (Course)',
|
||||||
|
'privateLessons.unitLabel': 'Ünite (Unit)',
|
||||||
|
'privateLessons.topicLabel': 'Konu (Topic)',
|
||||||
|
'privateLessons.loading': 'Loading...',
|
||||||
|
'privateLessons.selectPrompt': 'Seçiniz...',
|
||||||
|
'privateLessons.selectCourseFirst': 'Önce ders seçiniz...',
|
||||||
|
'privateLessons.selectUnitFirst': 'Önce ünite seçiniz...',
|
||||||
|
'privateLessons.noUnitFound': 'Ünite bulunamadı',
|
||||||
|
'privateLessons.noTopicFound': 'Konu bulunamadı',
|
||||||
|
'privateLessons.errorOccurred': 'Hata oluştu',
|
||||||
|
'privateLessons.submitBtn': 'Submit Request (Gönder)',
|
||||||
|
'privateLessons.submittingBtn': 'Gönderiliyor...',
|
||||||
|
'privateLessons.myLessonsTitle': 'My Lessons (Özel Derslerim)',
|
||||||
|
'privateLessons.filterAll': 'All',
|
||||||
|
'privateLessons.upcomingGroupTitle': 'Upcoming / Approved Lessons',
|
||||||
|
'privateLessons.upcomingBadge': 'Upcoming',
|
||||||
|
'privateLessons.activeCountBadge': '{count} Active',
|
||||||
|
'privateLessons.pastGroupTitle': 'Lesson History',
|
||||||
|
'privateLessons.pastCountBadge': '{count} Past',
|
||||||
|
'privateLessons.completedBadge': 'Completed',
|
||||||
|
'privateLessons.emptyState': 'No private lessons recorded yet. Submit a request above or click Sync Lessons to fetch from the portal.',
|
||||||
|
|
||||||
|
// Exam Reports
|
||||||
|
'exams.pageTitle': 'Exam Reports - BeKultur',
|
||||||
|
'exams.title': 'Exam Reports',
|
||||||
|
'exams.subtitle': 'Sınav Raporları, Gelişim Analizi & Soru İnceleme',
|
||||||
|
'exams.syncedLabel': 'Synced:',
|
||||||
|
'exams.syncBtn': 'Sync Exams',
|
||||||
|
'exams.syncing': 'Syncing...',
|
||||||
|
'exams.kpiLatestNet': 'Latest Net',
|
||||||
|
'exams.kpiVsPrior': 'net vs prior',
|
||||||
|
'exams.kpiBaseline': 'Baseline exam',
|
||||||
|
'exams.kpiBestNet': 'Personal Best Net',
|
||||||
|
'exams.kpiAcrossExams': 'Across all {count} exams',
|
||||||
|
'exams.kpiAvgNet': 'Average Net',
|
||||||
|
'exams.kpiAvgSub': 'Overall student mean',
|
||||||
|
'exams.kpiCurrentRank': 'Current Rank',
|
||||||
|
'exams.kpiBestRank': 'Best standing: #{rank}',
|
||||||
|
'exams.kpiGeneralStanding': 'General standing',
|
||||||
|
'exams.filterAll': 'All Exams',
|
||||||
|
'exams.answerKey': 'Cevap Anahtarı',
|
||||||
|
'exams.generalRankLabel': 'Genel Sıra :',
|
||||||
|
'exams.schoolRankLabel': 'Okul Sıra :',
|
||||||
|
'exams.rankDeltaUnit': 'sıra',
|
||||||
|
'exams.reviewMistakesBtn': 'Review {count} Mistakes',
|
||||||
|
'exams.subtabBreakdown': 'Subject Breakdown (Ders Dağılımı)',
|
||||||
|
'exams.subtabWeakness': 'Topic Weaknesses (Zayıf Konular)',
|
||||||
|
'exams.colSubject': 'Ders',
|
||||||
|
'exams.colQuestions': 'Soru',
|
||||||
|
'exams.colCorrect': 'Doğru',
|
||||||
|
'exams.colWrong': 'Yanlış',
|
||||||
|
'exams.colEmpty': 'Boş',
|
||||||
|
'exams.colNet': 'Net',
|
||||||
|
'exams.colDeltaNet': 'Net Değişim (Δ)',
|
||||||
|
'exams.colSuccessRate': 'Başarı Oranı',
|
||||||
|
'exams.rowTotal': 'TOPLAM',
|
||||||
|
'exams.viewWrongQuestionsTitle': 'Click to view {count} wrong questions',
|
||||||
|
'exams.viewEmptyQuestionsTitle': 'Click to view {count} blank questions',
|
||||||
|
'exams.weaknessLoading': 'Zayıf konu analizi yükleniyor...',
|
||||||
|
'exams.weaknessEmpty': 'Bu sınav için henüz zayıf konu kaydı bulunamadı veya tüm konularda tam başarı sağlandı.',
|
||||||
|
'exams.weaknessError': 'Zayıf konu raporu yüklenirken bir hata oluştu.',
|
||||||
|
'exams.weaknessTotal': 'Toplam:',
|
||||||
|
'exams.weaknessCorrect': 'Doğru:',
|
||||||
|
'exams.weaknessWrong': 'Yanlış:',
|
||||||
|
'exams.weaknessEmptyCount': 'Boş:',
|
||||||
|
'exams.modalTitle': 'Review Mistakes',
|
||||||
|
'exams.modalSubtitle': 'Wrong & Blank Questions',
|
||||||
|
'exams.modalTypeAll': 'All',
|
||||||
|
'exams.modalTypeWrong': 'Wrong (Yanlış)',
|
||||||
|
'exams.modalTypeEmpty': 'Blank (Boş)',
|
||||||
|
'exams.modalAllMistakes': 'Tüm Yanlışlar',
|
||||||
|
'exams.modalLoading': 'Sorular getiriliyor...',
|
||||||
|
'exams.modalNoMatch': 'Seçili filtrelere uygun soru bulunamadı.',
|
||||||
|
'exams.modalError': 'Sorular yüklenirken bir hata oluştu.',
|
||||||
|
'exams.questionNo': 'Soru #{num}',
|
||||||
|
'exams.correctAnswer': 'Doğru:',
|
||||||
|
'exams.studentAnswer': 'Öğrenci:',
|
||||||
|
'exams.emptyAnswerText': 'Boş',
|
||||||
|
'exams.zoomHint': 'Büyütmek için tıklayınız',
|
||||||
|
'exams.noImage': 'Soru görseli bulunamadı.',
|
||||||
|
'exams.emptyTitle': 'Henüz Sınav Raporu Bulunmuyor',
|
||||||
|
'exams.emptyDesc': 'Öğrenci portalındaki sınav verilerini içe aktarmak için "Sync Exams" butonuna tıklayınız.',
|
||||||
|
|
||||||
|
// Exam Ratings
|
||||||
|
'rating.Breakthrough': 'Breakthrough',
|
||||||
|
'rating.Outperformed Curve': 'Outperformed Curve',
|
||||||
|
'rating.Net Growth': 'Net Growth',
|
||||||
|
'rating.Rank Climb': 'Rank Climb',
|
||||||
|
'rating.Top 10 Consistency': 'Top 10 Consistency',
|
||||||
|
'rating.Needs Review': 'Needs Review',
|
||||||
|
'rating.Stable Performance': 'Stable Performance',
|
||||||
|
'rating.Top 10 Baseline': 'Top 10 Baseline',
|
||||||
|
'rating.Baseline Exam': 'Baseline Exam',
|
||||||
|
|
||||||
|
// PWA & Offline
|
||||||
|
'pwa.offlineBadge': '⚡ Offline',
|
||||||
|
'pwa.offlineText': 'Showing locally cached data. Actions requiring connection are paused.',
|
||||||
|
'pwa.onlineBadge': '✓ Online',
|
||||||
|
'pwa.onlineText': 'Connection restored. Live features re-enabled.',
|
||||||
|
'pwa.offlineSuffix': '(Offline)',
|
||||||
|
'pwa.offlineCheckboxTitle': 'Offline mode: Homework status cannot be changed without connection.',
|
||||||
|
'pwa.offlineExcludeTitle': 'Offline mode: Homework cannot be excluded without connection.',
|
||||||
|
'pwa.offlineStationTitle': 'Offline mode: Station selection requires connection.',
|
||||||
|
'pwa.offlineSyncTitle': 'Offline mode: Sync requires internet connection.',
|
||||||
|
'pwa.offlinePrivateNotice': '⚡ <strong>Çevrimdışı mod:</strong> Yeni özel ders başvurusu yapmak için internet bağlantısı gereklidir.'
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export function normalizeLocale(input?: string | null): SupportedLocale {
|
||||||
|
if (!input) return DEFAULT_LOCALE;
|
||||||
|
const cleaned = input.trim().toLowerCase();
|
||||||
|
if (cleaned === 'en' || cleaned.startsWith('en-')) return 'en';
|
||||||
|
if (cleaned === 'tr' || cleaned.startsWith('tr-')) return 'tr';
|
||||||
|
return DEFAULT_LOCALE;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function translate(
|
||||||
|
locale: SupportedLocale,
|
||||||
|
key: string,
|
||||||
|
params?: Record<string, string | number>
|
||||||
|
): string {
|
||||||
|
const dict = translations[locale] || translations[DEFAULT_LOCALE];
|
||||||
|
let template = dict[key] ?? translations[DEFAULT_LOCALE][key] ?? key;
|
||||||
|
if (params) {
|
||||||
|
for (const [k, v] of Object.entries(params)) {
|
||||||
|
template = template.replace(new RegExp(`\\{${k}\\}`, 'g'), String(v));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return template;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function createTranslator(locale: SupportedLocale) {
|
||||||
|
return (key: string, params?: Record<string, string | number>): string => {
|
||||||
|
return translate(locale, key, params);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getClientDictionary(locale: SupportedLocale): Record<string, string> {
|
||||||
|
return translations[locale] || translations[DEFAULT_LOCALE];
|
||||||
|
}
|
||||||
189
src/services/secrets.ts
Normal file
189
src/services/secrets.ts
Normal file
|
|
@ -0,0 +1,189 @@
|
||||||
|
import fs from 'fs';
|
||||||
|
import path from 'path';
|
||||||
|
import crypto from 'crypto';
|
||||||
|
|
||||||
|
const INSECURE_DEFAULTS = new Set([
|
||||||
|
'bekultur_secret_key_change_in_production',
|
||||||
|
'bekultur_default_secret_key_change_me',
|
||||||
|
''
|
||||||
|
]);
|
||||||
|
|
||||||
|
interface StoredSecrets {
|
||||||
|
sessionSecret: string;
|
||||||
|
encryptionSecret: string;
|
||||||
|
createdAt: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
let cachedSecrets: StoredSecrets | null = null;
|
||||||
|
|
||||||
|
function getSecretsFilePath(): string {
|
||||||
|
const customDbPath = process.env.DB_PATH;
|
||||||
|
const dataDir = customDbPath
|
||||||
|
? path.dirname(path.resolve(customDbPath))
|
||||||
|
: path.resolve(process.cwd(), 'data');
|
||||||
|
return path.join(dataDir, '.secrets.json');
|
||||||
|
}
|
||||||
|
|
||||||
|
function loadOrCreateSecrets(): StoredSecrets {
|
||||||
|
if (cachedSecrets) {
|
||||||
|
return cachedSecrets;
|
||||||
|
}
|
||||||
|
|
||||||
|
const secretsFile = getSecretsFilePath();
|
||||||
|
const dir = path.dirname(secretsFile);
|
||||||
|
if (!fs.existsSync(dir)) {
|
||||||
|
fs.mkdirSync(dir, { recursive: true });
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fs.existsSync(secretsFile)) {
|
||||||
|
try {
|
||||||
|
const raw = fs.readFileSync(secretsFile, 'utf-8');
|
||||||
|
const parsed = JSON.parse(raw) as StoredSecrets;
|
||||||
|
if (parsed.sessionSecret && parsed.encryptionSecret) {
|
||||||
|
cachedSecrets = parsed;
|
||||||
|
return cachedSecrets;
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
console.warn('Warning: Could not read .secrets.json, regenerating secrets.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const generated: StoredSecrets = {
|
||||||
|
sessionSecret: crypto.randomBytes(64).toString('hex'),
|
||||||
|
encryptionSecret: crypto.randomBytes(64).toString('hex'),
|
||||||
|
createdAt: new Date().toISOString()
|
||||||
|
};
|
||||||
|
|
||||||
|
try {
|
||||||
|
fs.writeFileSync(secretsFile, JSON.stringify(generated, null, 2), {
|
||||||
|
encoding: 'utf-8',
|
||||||
|
mode: 0o600
|
||||||
|
});
|
||||||
|
} catch (err) {
|
||||||
|
console.warn('Warning: Failed to persist .secrets.json to disk:', err);
|
||||||
|
}
|
||||||
|
|
||||||
|
cachedSecrets = generated;
|
||||||
|
return cachedSecrets;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve active session secret (prefers non-default env var, otherwise persistent generated secret)
|
||||||
|
*/
|
||||||
|
export function getSessionSecret(): string {
|
||||||
|
const envSecret = (process.env.SESSION_SECRET || '').trim();
|
||||||
|
if (envSecret && !INSECURE_DEFAULTS.has(envSecret)) {
|
||||||
|
return envSecret;
|
||||||
|
}
|
||||||
|
return loadOrCreateSecrets().sessionSecret;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve active encryption secret (prefers non-default env var, otherwise persistent generated secret)
|
||||||
|
*/
|
||||||
|
export function getEncryptionSecret(): string {
|
||||||
|
const envEnc = (process.env.ENCRYPTION_SECRET || process.env.CREDENTIAL_SECRET || '').trim();
|
||||||
|
if (envEnc && !INSECURE_DEFAULTS.has(envEnc)) {
|
||||||
|
return envEnc;
|
||||||
|
}
|
||||||
|
const envSess = (process.env.SESSION_SECRET || '').trim();
|
||||||
|
if (envSess && !INSECURE_DEFAULTS.has(envSess)) {
|
||||||
|
return envSess;
|
||||||
|
}
|
||||||
|
return loadOrCreateSecrets().encryptionSecret;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Encrypt sensitive text (student passwords, portal cookies) using AES-256-GCM with per-item random salt & IV
|
||||||
|
*/
|
||||||
|
export function encryptCredential(plaintext: string): string {
|
||||||
|
if (!plaintext) return '';
|
||||||
|
try {
|
||||||
|
const secret = getEncryptionSecret();
|
||||||
|
const salt = crypto.randomBytes(16);
|
||||||
|
const iv = crypto.randomBytes(12);
|
||||||
|
const key = crypto.scryptSync(secret, salt, 32);
|
||||||
|
const cipher = crypto.createCipheriv('aes-256-gcm', key, iv);
|
||||||
|
let encrypted = cipher.update(plaintext, 'utf8', 'hex');
|
||||||
|
encrypted += cipher.final('hex');
|
||||||
|
const authTag = cipher.getAuthTag().toString('hex');
|
||||||
|
return `enc:v2:${salt.toString('hex')}:${iv.toString('hex')}:${authTag}:${encrypted}`;
|
||||||
|
} catch (err) {
|
||||||
|
console.error('Failed to encrypt credential:', err);
|
||||||
|
throw new Error('Encryption failure');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Decrypt stored credential, supporting both v2 (random salt) and legacy v1 (static salt + legacy fallback keys)
|
||||||
|
*/
|
||||||
|
export function decryptCredential(stored: string): string {
|
||||||
|
if (!stored) return '';
|
||||||
|
if (!stored.startsWith('enc:')) {
|
||||||
|
// Legacy plaintext support
|
||||||
|
return stored;
|
||||||
|
}
|
||||||
|
|
||||||
|
// v2 format: enc:v2:<saltHex>:<ivHex>:<authTagHex>:<ciphertextHex>
|
||||||
|
if (stored.startsWith('enc:v2:')) {
|
||||||
|
const parts = stored.split(':');
|
||||||
|
if (parts.length !== 6) return '';
|
||||||
|
const [, , saltHex, ivHex, authTagHex, ciphertextHex] = parts;
|
||||||
|
const candidateSecrets = Array.from(
|
||||||
|
new Set([
|
||||||
|
getEncryptionSecret(),
|
||||||
|
process.env.ENCRYPTION_SECRET || '',
|
||||||
|
process.env.SESSION_SECRET || ''
|
||||||
|
].filter(Boolean))
|
||||||
|
);
|
||||||
|
|
||||||
|
for (const secret of candidateSecrets) {
|
||||||
|
try {
|
||||||
|
const key = crypto.scryptSync(secret, Buffer.from(saltHex, 'hex'), 32);
|
||||||
|
const decipher = crypto.createDecipheriv('aes-256-gcm', key, Buffer.from(ivHex, 'hex'));
|
||||||
|
decipher.setAuthTag(Buffer.from(authTagHex, 'hex'));
|
||||||
|
let decrypted = decipher.update(ciphertextHex, 'hex', 'utf8');
|
||||||
|
decrypted += decipher.final('utf8');
|
||||||
|
return decrypted;
|
||||||
|
} catch {
|
||||||
|
// Try next candidate key
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Legacy v1 format: enc:<ivHex>:<authTagHex>:<ciphertextHex>
|
||||||
|
const parts = stored.split(':');
|
||||||
|
if (parts.length !== 4) return '';
|
||||||
|
const [, ivHex, authTagHex, ciphertextHex] = parts;
|
||||||
|
|
||||||
|
const legacyCandidateSecrets = Array.from(
|
||||||
|
new Set([
|
||||||
|
getEncryptionSecret(),
|
||||||
|
process.env.ENCRYPTION_SECRET || '',
|
||||||
|
process.env.SESSION_SECRET || '',
|
||||||
|
'bekultur_secret_key_change_in_production',
|
||||||
|
'bekultur_default_secret_key_change_me'
|
||||||
|
].filter(Boolean))
|
||||||
|
);
|
||||||
|
|
||||||
|
for (const secret of legacyCandidateSecrets) {
|
||||||
|
try {
|
||||||
|
const key = crypto.scryptSync(secret, 'bekultur_credential_salt', 32);
|
||||||
|
const decipher = crypto.createDecipheriv('aes-256-gcm', key, Buffer.from(ivHex, 'hex'));
|
||||||
|
decipher.setAuthTag(Buffer.from(authTagHex, 'hex'));
|
||||||
|
let decrypted = decipher.update(ciphertextHex, 'hex', 'utf8');
|
||||||
|
decrypted += decipher.final('utf8');
|
||||||
|
return decrypted;
|
||||||
|
} catch {
|
||||||
|
// Try next candidate secret
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
console.error('Failed to decrypt legacy credential with any known key.');
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
export function isModernEncryptedFormat(stored: string): boolean {
|
||||||
|
return Boolean(stored && stored.startsWith('enc:v2:'));
|
||||||
|
}
|
||||||
212
src/services/session-store.ts
Normal file
212
src/services/session-store.ts
Normal file
|
|
@ -0,0 +1,212 @@
|
||||||
|
import session from 'express-session';
|
||||||
|
import Database from 'better-sqlite3';
|
||||||
|
import { encryptCredential, decryptCredential } from './secrets';
|
||||||
|
|
||||||
|
const DEFAULT_TTL_MS = 14 * 24 * 60 * 60 * 1000; // 14 days
|
||||||
|
const DEFAULT_PRUNE_INTERVAL_MS = 15 * 60 * 1000; // 15 minutes
|
||||||
|
|
||||||
|
export interface SQLiteSessionStoreOptions {
|
||||||
|
db: Database.Database;
|
||||||
|
ttlMs?: number;
|
||||||
|
pruneIntervalMs?: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class SQLiteSessionStore extends session.Store {
|
||||||
|
private db: Database.Database;
|
||||||
|
private ttlMs: number;
|
||||||
|
private pruneTimer: NodeJS.Timeout | null = null;
|
||||||
|
|
||||||
|
constructor(options: SQLiteSessionStoreOptions) {
|
||||||
|
super();
|
||||||
|
this.db = options.db;
|
||||||
|
this.ttlMs = options.ttlMs || DEFAULT_TTL_MS;
|
||||||
|
|
||||||
|
this.db.exec(`
|
||||||
|
CREATE TABLE IF NOT EXISTS sessions (
|
||||||
|
sid TEXT PRIMARY KEY,
|
||||||
|
sess TEXT NOT NULL,
|
||||||
|
expire INTEGER NOT NULL
|
||||||
|
);
|
||||||
|
CREATE INDEX IF NOT EXISTS idx_sessions_expire ON sessions(expire);
|
||||||
|
`);
|
||||||
|
|
||||||
|
this.pruneExpired();
|
||||||
|
|
||||||
|
const pruneInterval = options.pruneIntervalMs ?? DEFAULT_PRUNE_INTERVAL_MS;
|
||||||
|
if (pruneInterval > 0) {
|
||||||
|
this.pruneTimer = setInterval(() => {
|
||||||
|
this.pruneExpired();
|
||||||
|
}, pruneInterval);
|
||||||
|
if (this.pruneTimer.unref) {
|
||||||
|
this.pruneTimer.unref();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private computeExpireTimestamp(sess: session.SessionData): number {
|
||||||
|
if (sess?.cookie?.expires) {
|
||||||
|
const exp = new Date(sess.cookie.expires).getTime();
|
||||||
|
if (!isNaN(exp)) return exp;
|
||||||
|
}
|
||||||
|
if (typeof sess?.cookie?.maxAge === 'number') {
|
||||||
|
return Date.now() + sess.cookie.maxAge;
|
||||||
|
}
|
||||||
|
return Date.now() + this.ttlMs;
|
||||||
|
}
|
||||||
|
|
||||||
|
private serializeSession(sess: session.SessionData): string {
|
||||||
|
const clone: Record<string, any> = { ...sess };
|
||||||
|
if (typeof clone.portalCookies === 'string' && clone.portalCookies.length > 0 && !clone.portalCookies.startsWith('enc:')) {
|
||||||
|
clone.portalCookies = encryptCredential(clone.portalCookies);
|
||||||
|
}
|
||||||
|
return JSON.stringify(clone);
|
||||||
|
}
|
||||||
|
|
||||||
|
private deserializeSession(rawJson: string): session.SessionData | null {
|
||||||
|
try {
|
||||||
|
const parsed = JSON.parse(rawJson);
|
||||||
|
if (typeof parsed.portalCookies === 'string' && parsed.portalCookies.startsWith('enc:')) {
|
||||||
|
parsed.portalCookies = decryptCredential(parsed.portalCookies);
|
||||||
|
}
|
||||||
|
return parsed as session.SessionData;
|
||||||
|
} catch {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public pruneExpired(): number {
|
||||||
|
try {
|
||||||
|
if (!this.db.open) return 0;
|
||||||
|
const info = this.db
|
||||||
|
.prepare('DELETE FROM sessions WHERE expire <= ?')
|
||||||
|
.run(Date.now());
|
||||||
|
return info.changes;
|
||||||
|
} catch {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public get(
|
||||||
|
sid: string,
|
||||||
|
callback: (err: any, session?: session.SessionData | null) => void
|
||||||
|
): void {
|
||||||
|
try {
|
||||||
|
const row = this.db
|
||||||
|
.prepare('SELECT sess, expire FROM sessions WHERE sid = ?')
|
||||||
|
.get(sid) as { sess: string; expire: number } | undefined;
|
||||||
|
|
||||||
|
if (!row) {
|
||||||
|
return callback(null, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (row.expire <= Date.now()) {
|
||||||
|
this.db.prepare('DELETE FROM sessions WHERE sid = ?').run(sid);
|
||||||
|
return callback(null, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
const sess = this.deserializeSession(row.sess);
|
||||||
|
return callback(null, sess);
|
||||||
|
} catch (err) {
|
||||||
|
return callback(err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public set(
|
||||||
|
sid: string,
|
||||||
|
sess: session.SessionData,
|
||||||
|
callback?: (err?: any) => void
|
||||||
|
): void {
|
||||||
|
try {
|
||||||
|
const expire = this.computeExpireTimestamp(sess);
|
||||||
|
const serialized = this.serializeSession(sess);
|
||||||
|
|
||||||
|
this.db
|
||||||
|
.prepare(
|
||||||
|
'INSERT INTO sessions (sid, sess, expire) VALUES (?, ?, ?) ON CONFLICT(sid) DO UPDATE SET sess = excluded.sess, expire = excluded.expire'
|
||||||
|
)
|
||||||
|
.run(sid, serialized, expire);
|
||||||
|
|
||||||
|
if (callback) callback(null);
|
||||||
|
} catch (err) {
|
||||||
|
if (callback) callback(err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public destroy(sid: string, callback?: (err?: any) => void): void {
|
||||||
|
try {
|
||||||
|
this.db.prepare('DELETE FROM sessions WHERE sid = ?').run(sid);
|
||||||
|
if (callback) callback(null);
|
||||||
|
} catch (err) {
|
||||||
|
if (callback) callback(err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public touch(
|
||||||
|
sid: string,
|
||||||
|
sess: session.SessionData,
|
||||||
|
callback?: () => void
|
||||||
|
): void {
|
||||||
|
try {
|
||||||
|
const expire = this.computeExpireTimestamp(sess);
|
||||||
|
this.db
|
||||||
|
.prepare('UPDATE sessions SET expire = ? WHERE sid = ?')
|
||||||
|
.run(expire, sid);
|
||||||
|
if (callback) callback();
|
||||||
|
} catch {
|
||||||
|
if (callback) callback();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public length(callback: (err: any, length?: number) => void): void {
|
||||||
|
try {
|
||||||
|
this.pruneExpired();
|
||||||
|
const row = this.db
|
||||||
|
.prepare('SELECT COUNT(*) as cnt FROM sessions')
|
||||||
|
.get() as { cnt: number };
|
||||||
|
callback(null, row.cnt);
|
||||||
|
} catch (err) {
|
||||||
|
callback(err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public clear(callback?: (err?: any) => void): void {
|
||||||
|
try {
|
||||||
|
this.db.prepare('DELETE FROM sessions').run();
|
||||||
|
if (callback) callback(null);
|
||||||
|
} catch (err) {
|
||||||
|
if (callback) callback(err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public all(
|
||||||
|
callback: (
|
||||||
|
err: any,
|
||||||
|
obj?: session.SessionData[] | { [sid: string]: session.SessionData } | null
|
||||||
|
) => void
|
||||||
|
): void {
|
||||||
|
try {
|
||||||
|
this.pruneExpired();
|
||||||
|
const rows = this.db
|
||||||
|
.prepare('SELECT sid, sess FROM sessions WHERE expire > ?')
|
||||||
|
.all(Date.now()) as Array<{ sid: string; sess: string }>;
|
||||||
|
|
||||||
|
const sessions: Record<string, session.SessionData> = {};
|
||||||
|
for (const r of rows) {
|
||||||
|
const parsed = this.deserializeSession(r.sess);
|
||||||
|
if (parsed) {
|
||||||
|
sessions[r.sid] = parsed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
callback(null, sessions);
|
||||||
|
} catch (err) {
|
||||||
|
callback(err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public stopPruning(): void {
|
||||||
|
if (this.pruneTimer) {
|
||||||
|
clearInterval(this.pruneTimer);
|
||||||
|
this.pruneTimer = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
import { Lesson } from '../types';
|
import { Lesson } from '../types';
|
||||||
import { InsightService } from './insight';
|
import { InsightService } from './insight';
|
||||||
|
import { SupportedLocale, translate } from './i18n';
|
||||||
|
|
||||||
export const DAY_NAMES: Record<number, string> = {
|
export const DAY_NAMES: Record<number, string> = {
|
||||||
1: 'Pazartesi',
|
1: 'Pazartesi',
|
||||||
|
|
@ -167,7 +168,8 @@ export class SyllabusService {
|
||||||
public static getCurrentLessonStatus(
|
public static getCurrentLessonStatus(
|
||||||
dayLessons: Lesson[],
|
dayLessons: Lesson[],
|
||||||
currentDayNumber: number,
|
currentDayNumber: number,
|
||||||
refDate: Date = new Date()
|
refDate: Date = new Date(),
|
||||||
|
locale: SupportedLocale = 'tr'
|
||||||
): { currentLesson: Lesson | null; nextLesson: Lesson | null; statusText: string | null } {
|
): { currentLesson: Lesson | null; nextLesson: Lesson | null; statusText: string | null } {
|
||||||
const todayDay = refDate.getDay(); // 1 = Mon, ..., 5 = Fri
|
const todayDay = refDate.getDay(); // 1 = Mon, ..., 5 = Fri
|
||||||
if (todayDay !== currentDayNumber) {
|
if (todayDay !== currentDayNumber) {
|
||||||
|
|
@ -199,9 +201,17 @@ export class SyllabusService {
|
||||||
|
|
||||||
let statusText: string | null = null;
|
let statusText: string | null = null;
|
||||||
if (current) {
|
if (current) {
|
||||||
statusText = `Now in session: ${current.period} — ${current.subject} (${current.time})`;
|
statusText = translate(locale, 'syllabus.nowInSession', {
|
||||||
|
period: current.period,
|
||||||
|
subject: current.subject,
|
||||||
|
time: current.time
|
||||||
|
});
|
||||||
} else if (next) {
|
} else if (next) {
|
||||||
statusText = `Next up: ${next.period} — ${next.subject} at ${next.startTime}`;
|
statusText = translate(locale, 'syllabus.nextUp', {
|
||||||
|
period: next.period,
|
||||||
|
subject: next.subject,
|
||||||
|
time: next.startTime
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return { currentLesson: current, nextLesson: next, statusText };
|
return { currentLesson: current, nextLesson: next, statusText };
|
||||||
|
|
|
||||||
1626
test/run-tests.ts
1626
test/run-tests.ts
File diff suppressed because it is too large
Load diff
|
|
@ -4,15 +4,15 @@
|
||||||
<!-- Top Bar -->
|
<!-- Top Bar -->
|
||||||
<div class="dashboard-topbar">
|
<div class="dashboard-topbar">
|
||||||
<div class="dashboard-title-area">
|
<div class="dashboard-title-area">
|
||||||
<h1 class="dashboard-title">Homework</h1>
|
<h1 class="dashboard-title"><%= t('dashboard.title') %></h1>
|
||||||
<p class="dashboard-subtitle">
|
<p class="dashboard-subtitle">
|
||||||
Student <strong>#<%= studentId %></strong>
|
<%= t('dashboard.studentLabel') %> <strong>#<%= studentId %></strong>
|
||||||
<span class="dot-separator">•</span>
|
<span class="dot-separator">•</span>
|
||||||
<span id="syncStatus">
|
<span id="syncStatus">
|
||||||
<% if (lastSynced) { %>
|
<% if (lastSynced) { %>
|
||||||
Last synced: <%= new Date(lastSynced).toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' }) %>
|
<%= t('dashboard.lastSynced') %> <%= new Date(lastSynced).toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' }) %>
|
||||||
<% } else { %>
|
<% } else { %>
|
||||||
Not synced
|
<%= t('dashboard.notSynced') %>
|
||||||
<% } %>
|
<% } %>
|
||||||
</span>
|
</span>
|
||||||
</p>
|
</p>
|
||||||
|
|
@ -20,10 +20,10 @@
|
||||||
|
|
||||||
<div class="sync-actions">
|
<div class="sync-actions">
|
||||||
<button type="button" class="btn btn-secondary btn-sm" id="btnSyncRecent">
|
<button type="button" class="btn btn-secondary btn-sm" id="btnSyncRecent">
|
||||||
Sync Recent
|
<%= t('dashboard.syncRecent') %>
|
||||||
</button>
|
</button>
|
||||||
<button type="button" class="btn btn-primary btn-sm" id="btnSyncAll">
|
<button type="button" class="btn btn-primary btn-sm" id="btnSyncAll">
|
||||||
Sync Full History
|
<%= t('dashboard.syncAll') %>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -33,49 +33,49 @@
|
||||||
<!-- Summary Stats -->
|
<!-- Summary Stats -->
|
||||||
<div class="stats-grid">
|
<div class="stats-grid">
|
||||||
<div class="stat-card">
|
<div class="stat-card">
|
||||||
<div class="stat-label">Completion</div>
|
<div class="stat-label"><%= t('dashboard.statCompletion') %></div>
|
||||||
<div class="stat-value" id="statCompletionRate"><%= stats.completionRate %>%</div>
|
<div class="stat-value" id="statCompletionRate"><%= stats.completionRate %>%</div>
|
||||||
<div class="stat-subtext" id="statCompletionFraction"><%= stats.completed %> / <%= stats.total %> done</div>
|
<div class="stat-subtext" id="statCompletionFraction"><%= stats.completed %> / <%= stats.total %> <%= t('dashboard.statDoneUnit') %></div>
|
||||||
<div class="progress-bar-container">
|
<div class="progress-bar-container">
|
||||||
<div class="progress-bar-fill" id="progressBarFill" style="width: <%= stats.completionRate %>%"></div>
|
<div class="progress-bar-fill" id="progressBarFill" style="width: <%= stats.completionRate %>%"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="stat-card">
|
<div class="stat-card">
|
||||||
<div class="stat-label">Active</div>
|
<div class="stat-label"><%= t('dashboard.statActive') %></div>
|
||||||
<div class="stat-value" id="statActiveCount"><%= stats.active %></div>
|
<div class="stat-value" id="statActiveCount"><%= stats.active %></div>
|
||||||
<div class="stat-subtext">In progress</div>
|
<div class="stat-subtext"><%= t('dashboard.statActiveSub') %></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="stat-card stat-highlight">
|
<div class="stat-card stat-highlight">
|
||||||
<div class="stat-label">Checked Next Week</div>
|
<div class="stat-label"><%= t('dashboard.statNextWeek') %></div>
|
||||||
<div class="stat-value" id="statNextWeekCount"><%= stats.checkedNextWeek %></div>
|
<div class="stat-value" id="statNextWeekCount"><%= stats.checkedNextWeek %></div>
|
||||||
<div class="stat-subtext">Due or checked next week</div>
|
<div class="stat-subtext"><%= t('dashboard.statNextWeekSub') %></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="stat-card">
|
<div class="stat-card">
|
||||||
<div class="stat-label">Due Soon</div>
|
<div class="stat-label"><%= t('dashboard.statDueSoon') %></div>
|
||||||
<div class="stat-value" id="statDueSoonCount"><%= stats.dueSoon %></div>
|
<div class="stat-value" id="statDueSoonCount"><%= stats.dueSoon %></div>
|
||||||
<div class="stat-subtext">Within 3 days</div>
|
<div class="stat-subtext"><%= t('dashboard.statDueSoonSub') %></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="stat-card">
|
<div class="stat-card">
|
||||||
<div class="stat-label">Overdue</div>
|
<div class="stat-label"><%= t('dashboard.statOverdue') %></div>
|
||||||
<div class="stat-value" id="statOverdueCount"><%= stats.overdue %></div>
|
<div class="stat-value" id="statOverdueCount"><%= stats.overdue %></div>
|
||||||
<div class="stat-subtext">Past deadline</div>
|
<div class="stat-subtext"><%= t('dashboard.statOverdueSub') %></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="stat-card">
|
<div class="stat-card">
|
||||||
<div class="stat-label">Total</div>
|
<div class="stat-label"><%= t('dashboard.statTotal') %></div>
|
||||||
<div class="stat-value" id="statTotalCount"><%= stats.total %></div>
|
<div class="stat-value" id="statTotalCount"><%= stats.total %></div>
|
||||||
<div class="stat-subtext">All assignments</div>
|
<div class="stat-subtext"><%= t('dashboard.statTotalSub') %></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Subjects Overview (Collapsible) -->
|
<!-- Subjects Overview (Collapsible) -->
|
||||||
<div class="section-card">
|
<div class="section-card">
|
||||||
<div class="section-header cursor-pointer" id="subjectToggleHeader">
|
<div class="section-header cursor-pointer" id="subjectToggleHeader">
|
||||||
<span class="section-title">Subjects (<%= Object.keys(stats.bySubject).length %>)</span>
|
<span class="section-title"><%= t('dashboard.subjectsTitle') %> (<%= Object.keys(stats.bySubject).length %>)</span>
|
||||||
<span class="toggle-indicator" id="subjectToggleIcon">▼</span>
|
<span class="toggle-indicator" id="subjectToggleIcon">▼</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="subject-breakdown-body" id="subjectBreakdownBody">
|
<div class="subject-breakdown-body" id="subjectBreakdownBody">
|
||||||
|
|
@ -99,25 +99,25 @@
|
||||||
<div class="toolbar-card">
|
<div class="toolbar-card">
|
||||||
<div class="filter-tabs" id="filterTabs">
|
<div class="filter-tabs" id="filterTabs">
|
||||||
<button type="button" class="tab-btn active" data-filter="all">
|
<button type="button" class="tab-btn active" data-filter="all">
|
||||||
All (<span id="tabAllCount"><%= stats.total %></span>)
|
<%= t('dashboard.tabAll') %> (<span id="tabAllCount"><%= stats.total %></span>)
|
||||||
</button>
|
</button>
|
||||||
<button type="button" class="tab-btn" data-filter="next-week">
|
<button type="button" class="tab-btn" data-filter="next-week">
|
||||||
Checked Next Week (<span id="tabNextWeekCount"><%= stats.checkedNextWeek %></span>)
|
<%= t('dashboard.tabNextWeek') %> (<span id="tabNextWeekCount"><%= stats.checkedNextWeek %></span>)
|
||||||
</button>
|
</button>
|
||||||
<button type="button" class="tab-btn" data-filter="active">
|
<button type="button" class="tab-btn" data-filter="active">
|
||||||
Active (<span id="tabActiveCount"><%= stats.active %></span>)
|
<%= t('dashboard.tabActive') %> (<span id="tabActiveCount"><%= stats.active %></span>)
|
||||||
</button>
|
</button>
|
||||||
<button type="button" class="tab-btn" data-filter="due-soon">
|
<button type="button" class="tab-btn" data-filter="due-soon">
|
||||||
Due Soon (<span id="tabDueSoonCount"><%= stats.dueSoon %></span>)
|
<%= t('dashboard.tabDueSoon') %> (<span id="tabDueSoonCount"><%= stats.dueSoon %></span>)
|
||||||
</button>
|
</button>
|
||||||
<button type="button" class="tab-btn" data-filter="completed">
|
<button type="button" class="tab-btn" data-filter="completed">
|
||||||
Completed (<span id="tabCompletedCount"><%= stats.completed %></span>)
|
<%= t('dashboard.tabCompleted') %> (<span id="tabCompletedCount"><%= stats.completed %></span>)
|
||||||
</button>
|
</button>
|
||||||
<button type="button" class="tab-btn" data-filter="overdue">
|
<button type="button" class="tab-btn" data-filter="overdue">
|
||||||
Overdue (<span id="tabOverdueCount"><%= stats.overdue %></span>)
|
<%= t('dashboard.tabOverdue') %> (<span id="tabOverdueCount"><%= stats.overdue %></span>)
|
||||||
</button>
|
</button>
|
||||||
<button type="button" class="tab-btn" data-filter="excluded">
|
<button type="button" class="tab-btn" data-filter="excluded">
|
||||||
Excluded (<span id="tabExcludedCount"><%= stats.excludedCount || 0 %></span>)
|
<%= t('dashboard.tabExcluded') %> (<span id="tabExcludedCount"><%= stats.excludedCount || 0 %></span>)
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -127,14 +127,14 @@
|
||||||
type="text"
|
type="text"
|
||||||
id="searchInput"
|
id="searchInput"
|
||||||
class="search-input"
|
class="search-input"
|
||||||
placeholder="Filter by subject, book, or description..."
|
placeholder="<%= t('dashboard.searchPlaceholder') %>"
|
||||||
>
|
>
|
||||||
<button type="button" id="searchClear" class="search-clear hidden">×</button>
|
<button type="button" id="searchClear" class="search-clear hidden">×</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="select-box">
|
<div class="select-box">
|
||||||
<select id="subjectSelect" class="form-select">
|
<select id="subjectSelect" class="form-select">
|
||||||
<option value="">All Subjects</option>
|
<option value=""><%= t('dashboard.allSubjectsOption') %></option>
|
||||||
<% subjects.forEach(function(s) { %>
|
<% subjects.forEach(function(s) { %>
|
||||||
<option value="<%= s %>"><%= s %></option>
|
<option value="<%= s %>"><%= s %></option>
|
||||||
<% }); %>
|
<% }); %>
|
||||||
|
|
@ -144,13 +144,13 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="list-meta">
|
<div class="list-meta">
|
||||||
<span id="filteredCountText">Showing <%= assignments.length %> assignments</span>
|
<span id="filteredCountText"><%= t('dashboard.showingCount', { count: assignments.length }) %></span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Empty Search State -->
|
<!-- Empty Search State -->
|
||||||
<div id="noResults" class="empty-state hidden">
|
<div id="noResults" class="empty-state hidden">
|
||||||
<p>No matching assignments found.</p>
|
<p><%= t('dashboard.noResults') %></p>
|
||||||
<button type="button" class="btn btn-secondary btn-sm" id="btnResetFilters">Reset filters</button>
|
<button type="button" class="btn btn-secondary btn-sm" id="btnResetFilters"><%= t('dashboard.resetFilters') %></button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Assignments -->
|
<!-- Assignments -->
|
||||||
|
|
@ -187,39 +187,39 @@
|
||||||
<div class="card-badges">
|
<div class="card-badges">
|
||||||
<% if (item.detectedCheckDate) { %>
|
<% if (item.detectedCheckDate) { %>
|
||||||
<span class="badge badge-check-date">
|
<span class="badge badge-check-date">
|
||||||
Kontrol: <%= item.detectedCheckDate %>
|
<%= t('dashboard.checkDateBadge') %> <%= item.detectedCheckDate %>
|
||||||
</span>
|
</span>
|
||||||
<% } %>
|
<% } %>
|
||||||
|
|
||||||
<% if (item.excluded) { %>
|
<% if (item.excluded) { %>
|
||||||
<span class="badge badge-excluded">Excluded</span>
|
<span class="badge badge-excluded"><%= t('dashboard.badgeExcluded') %></span>
|
||||||
<% } else if (item.completed) { %>
|
<% } else if (item.completed) { %>
|
||||||
<span class="badge badge-completed">Done</span>
|
<span class="badge badge-completed"><%= t('dashboard.badgeCompleted') %></span>
|
||||||
<% } else if (item.status === 'next-week') { %>
|
<% } else if (item.status === 'next-week') { %>
|
||||||
<span class="badge badge-next-week">Next Week</span>
|
<span class="badge badge-next-week"><%= t('dashboard.badgeNextWeek') %></span>
|
||||||
<% } else if (item.status === 'due-soon') { %>
|
<% } else if (item.status === 'due-soon') { %>
|
||||||
<span class="badge badge-due-soon">Due Soon</span>
|
<span class="badge badge-due-soon"><%= t('dashboard.badgeDueSoon') %></span>
|
||||||
<% } else if (item.status === 'overdue') { %>
|
<% } else if (item.status === 'overdue') { %>
|
||||||
<span class="badge badge-overdue">Overdue</span>
|
<span class="badge badge-overdue"><%= t('dashboard.badgeOverdue') %></span>
|
||||||
<% } else { %>
|
<% } else { %>
|
||||||
<span class="badge badge-active">Active</span>
|
<span class="badge badge-active"><%= t('dashboard.badgeActive') %></span>
|
||||||
<% } %>
|
<% } %>
|
||||||
|
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
class="btn-exclude"
|
class="btn-exclude"
|
||||||
data-id="<%= item.id %>"
|
data-id="<%= item.id %>"
|
||||||
title="<%= item.excluded ? 'Restore this homework to your active list' : 'Exclude this homework (e.g. from another class)' %>"
|
title="<%= item.excluded ? t('dashboard.btnRestoreTitle') : t('dashboard.btnExcludeTitle') %>"
|
||||||
>
|
>
|
||||||
<%= item.excluded ? 'Restore' : 'Exclude' %>
|
<%= item.excluded ? t('dashboard.btnRestore') : t('dashboard.btnExclude') %>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<% if (item.unit || item.topic) { %>
|
<% if (item.unit || item.topic) { %>
|
||||||
<div class="card-sub-meta">
|
<div class="card-sub-meta">
|
||||||
<% if (item.unit) { %><span><strong>Ünite:</strong> <%= item.unit %></span><% } %>
|
<% if (item.unit) { %><span><strong><%= t('dashboard.unitLabel') %></strong> <%= item.unit %></span><% } %>
|
||||||
<% if (item.topic) { %><span><strong>Konu:</strong> <%= item.topic %></span><% } %>
|
<% if (item.topic) { %><span><strong><%= t('dashboard.topicLabel') %></strong> <%= item.topic %></span><% } %>
|
||||||
</div>
|
</div>
|
||||||
<% } %>
|
<% } %>
|
||||||
|
|
||||||
|
|
@ -228,13 +228,13 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="card-footer-row">
|
<div class="card-footer-row">
|
||||||
<div class="card-dates">
|
<div class="card-dates" title="<%= t('dashboard.dateRangeLabel') %>">
|
||||||
<span><%= item.startDate %> — <strong><%= item.endDate %></strong></span>
|
<span><%= item.startDate %> — <strong><%= item.endDate %></strong></span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="card-timestamps">
|
<div class="card-timestamps">
|
||||||
<% if (item.completed && item.completedAt) { %>
|
<% if (item.completed && item.completedAt) { %>
|
||||||
<span class="completed-timestamp">Done: <%= new Date(item.completedAt).toLocaleDateString() %></span>
|
<span class="completed-timestamp"><%= t('dashboard.completedOn') %> <%= new Date(item.completedAt).toLocaleDateString() %></span>
|
||||||
<% } %>
|
<% } %>
|
||||||
<span class="card-hash">#<%= item.id %></span>
|
<span class="card-hash">#<%= item.id %></span>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -4,18 +4,18 @@
|
||||||
<!-- Top Bar -->
|
<!-- Top Bar -->
|
||||||
<div class="dashboard-top-row">
|
<div class="dashboard-top-row">
|
||||||
<div>
|
<div>
|
||||||
<h1 class="page-title">Exam Reports</h1>
|
<h1 class="page-title"><%= t('exams.title') %></h1>
|
||||||
<p class="page-subtitle">
|
<p class="page-subtitle">
|
||||||
Sınav Raporları, Gelişim Analizi & Soru İnceleme
|
<%= t('exams.subtitle') %>
|
||||||
<% if (lastSynced) { %>
|
<% if (lastSynced) { %>
|
||||||
• <span class="sync-time">Synced: <%= new Date(lastSynced).toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' }) %></span>
|
• <span class="sync-time"><%= t('exams.syncedLabel') %> <%= new Date(lastSynced).toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' }) %></span>
|
||||||
<% } %>
|
<% } %>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="sync-actions">
|
<div class="sync-actions">
|
||||||
<button type="button" class="btn btn-primary btn-sm" id="btnSyncExams">
|
<button type="button" class="btn btn-primary btn-sm" id="btnSyncExams">
|
||||||
Sync Exams
|
<%= t('exams.syncBtn') %>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -26,41 +26,41 @@
|
||||||
<!-- KPI Summary Row -->
|
<!-- KPI Summary Row -->
|
||||||
<div class="stats-grid">
|
<div class="stats-grid">
|
||||||
<div class="stat-card">
|
<div class="stat-card">
|
||||||
<span class="stat-label">Latest Net</span>
|
<span class="stat-label"><%= t('exams.kpiLatestNet') %></span>
|
||||||
<span class="stat-value"><%= kpis.latestNet.toFixed(2) %></span>
|
<span class="stat-value"><%= kpis.latestNet.toFixed(2) %></span>
|
||||||
<span class="stat-sub">
|
<span class="stat-sub">
|
||||||
<% if (allExams[0].summary.deltaNet !== undefined) { %>
|
<% if (allExams[0].summary.deltaNet !== undefined) { %>
|
||||||
<span class="<%= allExams[0].summary.deltaNet >= 0 ? 'text-success' : 'text-danger' %>">
|
<span class="<%= allExams[0].summary.deltaNet >= 0 ? 'text-success' : 'text-danger' %>">
|
||||||
<%= allExams[0].summary.deltaNet >= 0 ? '+' : '' %><%= allExams[0].summary.deltaNet.toFixed(2) %> net vs prior
|
<%= allExams[0].summary.deltaNet >= 0 ? '+' : '' %><%= allExams[0].summary.deltaNet.toFixed(2) %> <%= t('exams.kpiVsPrior') %>
|
||||||
</span>
|
</span>
|
||||||
<% } else { %>
|
<% } else { %>
|
||||||
Baseline exam
|
<%= t('exams.kpiBaseline') %>
|
||||||
<% } %>
|
<% } %>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="stat-card">
|
<div class="stat-card">
|
||||||
<span class="stat-label">Personal Best Net</span>
|
<span class="stat-label"><%= t('exams.kpiBestNet') %></span>
|
||||||
<span class="stat-value text-success"><%= kpis.bestNet.toFixed(2) %></span>
|
<span class="stat-value text-success"><%= kpis.bestNet.toFixed(2) %></span>
|
||||||
<span class="stat-sub">Across all <%= kpis.totalExams %> exams</span>
|
<span class="stat-sub"><%= t('exams.kpiAcrossExams', { count: kpis.totalExams }) %></span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="stat-card">
|
<div class="stat-card">
|
||||||
<span class="stat-label">Average Net</span>
|
<span class="stat-label"><%= t('exams.kpiAvgNet') %></span>
|
||||||
<span class="stat-value"><%= kpis.averageNet.toFixed(2) %></span>
|
<span class="stat-value"><%= kpis.averageNet.toFixed(2) %></span>
|
||||||
<span class="stat-sub">Overall student mean</span>
|
<span class="stat-sub"><%= t('exams.kpiAvgSub') %></span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="stat-card">
|
<div class="stat-card">
|
||||||
<span class="stat-label">Current Rank</span>
|
<span class="stat-label"><%= t('exams.kpiCurrentRank') %></span>
|
||||||
<span class="stat-value text-primary">
|
<span class="stat-value text-primary">
|
||||||
<%= kpis.latestRank ? '#' + kpis.latestRank : '-' %>
|
<%= kpis.latestRank ? '#' + kpis.latestRank : '-' %>
|
||||||
</span>
|
</span>
|
||||||
<span class="stat-sub">
|
<span class="stat-sub">
|
||||||
<% if (kpis.bestRank) { %>
|
<% if (kpis.bestRank) { %>
|
||||||
Best standing: #<%= kpis.bestRank %>
|
<%= t('exams.kpiBestRank', { rank: kpis.bestRank }) %>
|
||||||
<% } else { %>
|
<% } else { %>
|
||||||
General standing
|
<%= t('exams.kpiGeneralStanding') %>
|
||||||
<% } %>
|
<% } %>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -70,7 +70,7 @@
|
||||||
<div class="exam-filter-row">
|
<div class="exam-filter-row">
|
||||||
<div class="filter-pills" id="categoryFilterPills">
|
<div class="filter-pills" id="categoryFilterPills">
|
||||||
<button type="button" class="filter-pill active" data-category="ALL">
|
<button type="button" class="filter-pill active" data-category="ALL">
|
||||||
All Exams (<%= allExams.length %>)
|
<%= t('exams.filterAll') %> (<%= allExams.length %>)
|
||||||
</button>
|
</button>
|
||||||
<button type="button" class="filter-pill" data-category="TYT">
|
<button type="button" class="filter-pill" data-category="TYT">
|
||||||
TYT / YKS (<%= tytExams.length %>)
|
TYT / YKS (<%= tytExams.length %>)
|
||||||
|
|
@ -110,7 +110,7 @@
|
||||||
<div class="exam-pill-rank">
|
<div class="exam-pill-rank">
|
||||||
<span class="rank-badge">#<%= exam.summary.generalRank %></span>
|
<span class="rank-badge">#<%= exam.summary.generalRank %></span>
|
||||||
<% if (exam.summary.deltaRank !== undefined && exam.summary.deltaRank !== 0) { %>
|
<% if (exam.summary.deltaRank !== undefined && exam.summary.deltaRank !== 0) { %>
|
||||||
<span class="delta-rank-badge <%= exam.summary.deltaRank > 0 ? 'rank-up' : 'rank-down' %>" title="Place change vs prior exam">
|
<span class="delta-rank-badge <%= exam.summary.deltaRank > 0 ? 'rank-up' : 'rank-down' %>">
|
||||||
<%= exam.summary.deltaRank > 0 ? '+' : '' %><%= exam.summary.deltaRank %>
|
<%= exam.summary.deltaRank > 0 ? '+' : '' %><%= exam.summary.deltaRank %>
|
||||||
</span>
|
</span>
|
||||||
<% } %>
|
<% } %>
|
||||||
|
|
@ -121,7 +121,7 @@
|
||||||
<% if (exam.summary.rating) { %>
|
<% if (exam.summary.rating) { %>
|
||||||
<div class="exam-pill-rating">
|
<div class="exam-pill-rating">
|
||||||
<span class="badge <%= exam.summary.rating.badgeClass %>">
|
<span class="badge <%= exam.summary.rating.badgeClass %>">
|
||||||
<i class="bi <%= exam.summary.rating.icon %>"></i> <%= exam.summary.rating.label %>
|
<i class="bi <%= exam.summary.rating.icon %>"></i> <%= t('rating.' + exam.summary.rating.label) %>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<% } %>
|
<% } %>
|
||||||
|
|
@ -140,8 +140,8 @@
|
||||||
</span>
|
</span>
|
||||||
<h2 class="exam-title-text" id="selectedExamTitle"><%= selectedExam.summary.name %></h2>
|
<h2 class="exam-title-text" id="selectedExamTitle"><%= selectedExam.summary.name %></h2>
|
||||||
<% if (selectedExam.hasAnswerKey && selectedExam.answerKeyUrl) { %>
|
<% if (selectedExam.hasAnswerKey && selectedExam.answerKeyUrl) { %>
|
||||||
<a href="<%= selectedExam.answerKeyUrl %>" target="_blank" rel="noopener noreferrer" class="btn btn-outline btn-xs" title="Cevap Anahtarı">
|
<a href="<%= selectedExam.answerKeyUrl %>" target="_blank" rel="noopener noreferrer" class="btn btn-outline btn-xs" title="<%= t('exams.answerKey') %>">
|
||||||
Cevap Anahtarı
|
<%= t('exams.answerKey') %>
|
||||||
</a>
|
</a>
|
||||||
<% } %>
|
<% } %>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -149,22 +149,22 @@
|
||||||
<div class="detail-badge-line">
|
<div class="detail-badge-line">
|
||||||
<% if (selectedExam.summary.generalRank) { %>
|
<% if (selectedExam.summary.generalRank) { %>
|
||||||
<span class="badge badge-soft-primary">
|
<span class="badge badge-soft-primary">
|
||||||
Genel Sıra : <strong><%= selectedExam.summary.generalRank %></strong>
|
<%= t('exams.generalRankLabel') %> <strong><%= selectedExam.summary.generalRank %></strong>
|
||||||
<% if (selectedExam.summary.deltaRank !== undefined && selectedExam.summary.deltaRank !== 0) { %>
|
<% if (selectedExam.summary.deltaRank !== undefined && selectedExam.summary.deltaRank !== 0) { %>
|
||||||
(<%= selectedExam.summary.deltaRank > 0 ? '+' : '' %><%= selectedExam.summary.deltaRank %> sıra)
|
(<%= selectedExam.summary.deltaRank > 0 ? '+' : '' %><%= selectedExam.summary.deltaRank %> <%= t('exams.rankDeltaUnit') %>)
|
||||||
<% } %>
|
<% } %>
|
||||||
</span>
|
</span>
|
||||||
<% } %>
|
<% } %>
|
||||||
|
|
||||||
<% if (selectedExam.summary.schoolRank) { %>
|
<% if (selectedExam.summary.schoolRank) { %>
|
||||||
<span class="badge badge-soft-secondary">
|
<span class="badge badge-soft-secondary">
|
||||||
Okul Sıra : <strong><%= selectedExam.summary.schoolRank %></strong>
|
<%= t('exams.schoolRankLabel') %> <strong><%= selectedExam.summary.schoolRank %></strong>
|
||||||
</span>
|
</span>
|
||||||
<% } %>
|
<% } %>
|
||||||
|
|
||||||
<% if (selectedExam.summary.rating) { %>
|
<% if (selectedExam.summary.rating) { %>
|
||||||
<span class="badge <%= selectedExam.summary.rating.badgeClass %>">
|
<span class="badge <%= selectedExam.summary.rating.badgeClass %>">
|
||||||
<i class="bi <%= selectedExam.summary.rating.icon %>"></i> <%= selectedExam.summary.rating.label %>
|
<i class="bi <%= selectedExam.summary.rating.icon %>"></i> <%= t('rating.' + selectedExam.summary.rating.label) %>
|
||||||
</span>
|
</span>
|
||||||
<% } %>
|
<% } %>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -179,7 +179,7 @@
|
||||||
data-wrong="<%= selectedExam.summary.totalWrong %>"
|
data-wrong="<%= selectedExam.summary.totalWrong %>"
|
||||||
data-empty="<%= selectedExam.summary.totalEmpty %>"
|
data-empty="<%= selectedExam.summary.totalEmpty %>"
|
||||||
>
|
>
|
||||||
Review <%= selectedExam.summary.totalWrong + selectedExam.summary.totalEmpty %> Mistakes
|
<%= t('exams.reviewMistakesBtn', { count: selectedExam.summary.totalWrong + selectedExam.summary.totalEmpty }) %>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -187,10 +187,10 @@
|
||||||
<!-- Sub Tabs: Subject Breakdown vs Topic Weaknesses -->
|
<!-- Sub Tabs: Subject Breakdown vs Topic Weaknesses -->
|
||||||
<div class="exam-subtabs">
|
<div class="exam-subtabs">
|
||||||
<button type="button" class="subtab-btn active" id="subtabBreakdown" data-target="breakdownView">
|
<button type="button" class="subtab-btn active" id="subtabBreakdown" data-target="breakdownView">
|
||||||
Subject Breakdown (Ders Dağılımı)
|
<%= t('exams.subtabBreakdown') %>
|
||||||
</button>
|
</button>
|
||||||
<button type="button" class="subtab-btn" id="subtabWeakness" data-target="weaknessView" data-exam-id="<%= selectedExam.summary.id %>">
|
<button type="button" class="subtab-btn" id="subtabWeakness" data-target="weaknessView" data-exam-id="<%= selectedExam.summary.id %>">
|
||||||
Topic Weaknesses (Zayıf Konular)
|
<%= t('exams.subtabWeakness') %>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -200,14 +200,14 @@
|
||||||
<table class="exam-score-table">
|
<table class="exam-score-table">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Ders</th>
|
<th><%= t('exams.colSubject') %></th>
|
||||||
<th class="text-center">Soru</th>
|
<th class="text-center"><%= t('exams.colQuestions') %></th>
|
||||||
<th class="text-center">Doğru</th>
|
<th class="text-center"><%= t('exams.colCorrect') %></th>
|
||||||
<th class="text-center">Yanlış</th>
|
<th class="text-center"><%= t('exams.colWrong') %></th>
|
||||||
<th class="text-center">Boş</th>
|
<th class="text-center"><%= t('exams.colEmpty') %></th>
|
||||||
<th class="text-center">Net</th>
|
<th class="text-center"><%= t('exams.colNet') %></th>
|
||||||
<th class="text-center">Net Değişim (Δ)</th>
|
<th class="text-center"><%= t('exams.colDeltaNet') %></th>
|
||||||
<th class="text-center">Başarı Oranı</th>
|
<th class="text-center"><%= t('exams.colSuccessRate') %></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody id="examSubjectsTbody">
|
<tbody id="examSubjectsTbody">
|
||||||
|
|
@ -227,7 +227,7 @@
|
||||||
data-subject-name="<%= sub.subjectName %>"
|
data-subject-name="<%= sub.subjectName %>"
|
||||||
data-ogrenci-donem-id="<%= sub.ogrenciDonemId || '' %>"
|
data-ogrenci-donem-id="<%= sub.ogrenciDonemId || '' %>"
|
||||||
data-tip="Y"
|
data-tip="Y"
|
||||||
title="Click to view <%= sub.wrongCount %> wrong questions"
|
title="<%= t('exams.viewWrongQuestionsTitle', { count: sub.wrongCount }) %>"
|
||||||
>
|
>
|
||||||
<%= sub.wrongCount %>
|
<%= sub.wrongCount %>
|
||||||
</button>
|
</button>
|
||||||
|
|
@ -244,7 +244,7 @@
|
||||||
data-subject-name="<%= sub.subjectName %>"
|
data-subject-name="<%= sub.subjectName %>"
|
||||||
data-ogrenci-donem-id="<%= sub.ogrenciDonemId || '' %>"
|
data-ogrenci-donem-id="<%= sub.ogrenciDonemId || '' %>"
|
||||||
data-tip="B"
|
data-tip="B"
|
||||||
title="Click to view <%= sub.emptyCount %> blank questions"
|
title="<%= t('exams.viewEmptyQuestionsTitle', { count: sub.emptyCount }) %>"
|
||||||
>
|
>
|
||||||
<%= sub.emptyCount %>
|
<%= sub.emptyCount %>
|
||||||
</button>
|
</button>
|
||||||
|
|
@ -280,7 +280,7 @@
|
||||||
</tbody>
|
</tbody>
|
||||||
<tfoot>
|
<tfoot>
|
||||||
<tr class="table-total-row">
|
<tr class="table-total-row">
|
||||||
<td><strong>TOPLAM</strong></td>
|
<td><strong><%= t('exams.rowTotal') %></strong></td>
|
||||||
<td class="text-center"><strong><%= selectedExam.summary.totalQuestions %></strong></td>
|
<td class="text-center"><strong><%= selectedExam.summary.totalQuestions %></strong></td>
|
||||||
<td class="text-center"><strong class="text-success"><%= selectedExam.summary.totalCorrect %></strong></td>
|
<td class="text-center"><strong class="text-success"><%= selectedExam.summary.totalCorrect %></strong></td>
|
||||||
<td class="text-center"><strong class="text-danger"><%= selectedExam.summary.totalWrong %></strong></td>
|
<td class="text-center"><strong class="text-danger"><%= selectedExam.summary.totalWrong %></strong></td>
|
||||||
|
|
@ -320,7 +320,7 @@
|
||||||
<!-- Tab 2: Topic Weaknesses -->
|
<!-- Tab 2: Topic Weaknesses -->
|
||||||
<div class="subtab-content hidden" id="weaknessView">
|
<div class="subtab-content hidden" id="weaknessView">
|
||||||
<div class="weakness-loading-state" id="weaknessLoading">
|
<div class="weakness-loading-state" id="weaknessLoading">
|
||||||
<span class="spinner-small"></span> Zayıf konu analizi yükleniyor...
|
<span class="spinner-small"></span> <%= t('exams.weaknessLoading') %>
|
||||||
</div>
|
</div>
|
||||||
<div id="weaknessContainer"></div>
|
<div id="weaknessContainer"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -331,9 +331,9 @@
|
||||||
<!-- Empty State -->
|
<!-- Empty State -->
|
||||||
<div class="empty-state-card">
|
<div class="empty-state-card">
|
||||||
<div class="empty-icon">📊</div>
|
<div class="empty-icon">📊</div>
|
||||||
<h3>Henüz Sınav Raporu Bulunmuyor</h3>
|
<h3><%= t('exams.emptyTitle') %></h3>
|
||||||
<p>Öğrenci portalındaki sınav verilerini içe aktarmak için "Sync Exams" butonuna tıklayınız.</p>
|
<p><%= t('exams.emptyDesc') %></p>
|
||||||
<button type="button" class="btn btn-primary" id="btnEmptySync">Sync Exams</button>
|
<button type="button" class="btn btn-primary" id="btnEmptySync"><%= t('exams.syncBtn') %></button>
|
||||||
</div>
|
</div>
|
||||||
<% } %>
|
<% } %>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -345,8 +345,8 @@
|
||||||
<div class="modal-dialog modal-xl">
|
<div class="modal-dialog modal-xl">
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<div class="modal-title-group">
|
<div class="modal-title-group">
|
||||||
<h3 class="modal-title" id="mistakeModalTitle">Review Mistakes</h3>
|
<h3 class="modal-title" id="mistakeModalTitle"><%= t('exams.modalTitle') %></h3>
|
||||||
<span class="modal-subtitle" id="mistakeModalSubtitle">Wrong & Blank Questions</span>
|
<span class="modal-subtitle" id="mistakeModalSubtitle"><%= t('exams.modalSubtitle') %></span>
|
||||||
</div>
|
</div>
|
||||||
<button type="button" class="modal-close-btn" id="btnMistakeModalClose" aria-label="Close">×</button>
|
<button type="button" class="modal-close-btn" id="btnMistakeModalClose" aria-label="Close">×</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -357,15 +357,15 @@
|
||||||
<!-- Rendered dynamically -->
|
<!-- Rendered dynamically -->
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-type-toggles">
|
<div class="modal-type-toggles">
|
||||||
<button type="button" class="modal-type-btn active" data-type="all">All</button>
|
<button type="button" class="modal-type-btn active" data-type="all"><%= t('exams.modalTypeAll') %></button>
|
||||||
<button type="button" class="modal-type-btn" data-type="wrong">Wrong (Yanlış)</button>
|
<button type="button" class="modal-type-btn" data-type="wrong"><%= t('exams.modalTypeWrong') %></button>
|
||||||
<button type="button" class="modal-type-btn" data-type="empty">Blank (Boş)</button>
|
<button type="button" class="modal-type-btn" data-type="empty"><%= t('exams.modalTypeEmpty') %></button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="modal-body" id="mistakeModalBody">
|
<div class="modal-body" id="mistakeModalBody">
|
||||||
<div class="modal-loading-state" id="mistakeLoading">
|
<div class="modal-loading-state" id="mistakeLoading">
|
||||||
<span class="spinner-small"></span> Sorular getiriliyor...
|
<span class="spinner-small"></span> <%= t('exams.modalLoading') %>
|
||||||
</div>
|
</div>
|
||||||
<div class="questions-grid" id="questionsGrid"></div>
|
<div class="questions-grid" id="questionsGrid"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
<div class="auth-wrapper">
|
<div class="auth-wrapper">
|
||||||
<div class="auth-card">
|
<div class="auth-card">
|
||||||
<h1 class="auth-title">BeKultur</h1>
|
<h1 class="auth-title">BeKultur</h1>
|
||||||
<p class="auth-subtitle">Log in with your school portal credentials.</p>
|
<p class="auth-subtitle"><%= typeof t === 'function' ? t('login.subtitle') : 'E-Kültür öğrenci portalı bilgilerinizle giriş yapınız.' %></p>
|
||||||
|
|
||||||
<% if (typeof error !== 'undefined' && error) { %>
|
<% if (typeof error !== 'undefined' && error) { %>
|
||||||
<div class="alert alert-danger" role="alert">
|
<div class="alert alert-danger" role="alert">
|
||||||
|
|
@ -13,13 +13,13 @@
|
||||||
|
|
||||||
<form action="/login" method="POST" class="auth-form" id="loginForm">
|
<form action="/login" method="POST" class="auth-form" id="loginForm">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="studentId" class="form-label">Student ID</label>
|
<label for="studentId" class="form-label"><%= typeof t === 'function' ? t('login.studentIdLabel') : 'Öğrenci ID' %></label>
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
id="studentId"
|
id="studentId"
|
||||||
name="studentId"
|
name="studentId"
|
||||||
class="form-control"
|
class="form-control"
|
||||||
placeholder="Student ID"
|
placeholder="<%= typeof t === 'function' ? t('login.studentIdPlaceholder') : 'Öğrenci ID' %>"
|
||||||
value="<%= typeof rememberedId !== 'undefined' ? rememberedId : '' %>"
|
value="<%= typeof rememberedId !== 'undefined' ? rememberedId : '' %>"
|
||||||
required
|
required
|
||||||
autofocus
|
autofocus
|
||||||
|
|
@ -27,13 +27,13 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="password" class="form-label">Password</label>
|
<label for="password" class="form-label"><%= typeof t === 'function' ? t('login.passwordLabel') : 'Parola' %></label>
|
||||||
<input
|
<input
|
||||||
type="password"
|
type="password"
|
||||||
id="password"
|
id="password"
|
||||||
name="password"
|
name="password"
|
||||||
class="form-control"
|
class="form-control"
|
||||||
placeholder="Password"
|
placeholder="<%= typeof t === 'function' ? t('login.passwordPlaceholder') : 'Parola' %>"
|
||||||
required
|
required
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -41,13 +41,13 @@
|
||||||
<div class="form-row-between">
|
<div class="form-row-between">
|
||||||
<label class="checkbox-label">
|
<label class="checkbox-label">
|
||||||
<input type="checkbox" name="rememberMe" value="true" checked>
|
<input type="checkbox" name="rememberMe" value="true" checked>
|
||||||
<span>Remember credentials</span>
|
<span><%= typeof t === 'function' ? t('login.rememberMe') : 'Beni hatırla' %></span>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-actions">
|
<div class="form-actions">
|
||||||
<button type="submit" class="btn btn-primary btn-block" id="submitBtn">
|
<button type="submit" class="btn btn-primary btn-block" id="submitBtn">
|
||||||
Log In
|
<%= typeof t === 'function' ? t('login.submit') : 'Giriş Yap' %>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
@ -58,7 +58,7 @@
|
||||||
document.getElementById('loginForm').addEventListener('submit', function() {
|
document.getElementById('loginForm').addEventListener('submit', function() {
|
||||||
var btn = document.getElementById('submitBtn');
|
var btn = document.getElementById('submitBtn');
|
||||||
btn.disabled = true;
|
btn.disabled = true;
|
||||||
btn.textContent = 'Logging in...';
|
btn.textContent = window.BeKulturT ? window.BeKulturT('login.submitting') : 'Giriş yapılıyor...';
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
</main>
|
</main>
|
||||||
<footer class="app-footer">
|
<footer class="app-footer">
|
||||||
<div class="footer-container">
|
<div class="footer-container">
|
||||||
<span class="footer-text">BeKultur</span>
|
<span class="footer-text">BeKultur • E-Kültür</span>
|
||||||
</div>
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
<script src="/js/pwa.js"></script>
|
<script src="/js/pwa.js"></script>
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,25 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="<%= typeof lang !== 'undefined' ? lang : 'tr' %>">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<meta name="color-scheme" content="light dark">
|
||||||
|
<script>
|
||||||
|
(function() {
|
||||||
|
try {
|
||||||
|
var saved = localStorage.getItem('color-scheme');
|
||||||
|
var meta = document.querySelector('meta[name="color-scheme"]');
|
||||||
|
if (saved === 'dark' || saved === 'light') {
|
||||||
|
if (meta) meta.content = saved;
|
||||||
|
document.documentElement.setAttribute('data-theme', saved);
|
||||||
|
} else {
|
||||||
|
if (meta) meta.content = 'light dark';
|
||||||
|
var sysDark = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches;
|
||||||
|
document.documentElement.setAttribute('data-theme', sysDark ? 'dark' : 'light');
|
||||||
|
}
|
||||||
|
} catch (e) {}
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
<title><%= typeof title !== 'undefined' ? title : 'BeKultur' %></title>
|
<title><%= typeof title !== 'undefined' ? title : 'BeKultur' %></title>
|
||||||
|
|
||||||
<!-- PWA & Mobile Web App Meta Tags -->
|
<!-- PWA & Mobile Web App Meta Tags -->
|
||||||
|
|
@ -16,6 +33,19 @@
|
||||||
<link rel="icon" type="image/png" sizes="192x192" href="/icons/icon-192.png">
|
<link rel="icon" type="image/png" sizes="192x192" href="/icons/icon-192.png">
|
||||||
|
|
||||||
<link rel="stylesheet" href="/css/style.css">
|
<link rel="stylesheet" href="/css/style.css">
|
||||||
|
<script>
|
||||||
|
window.BeKulturLang = "<%= typeof lang !== 'undefined' ? lang : 'tr' %>";
|
||||||
|
window.BeKulturDict = <%- typeof i18nJson !== 'undefined' ? i18nJson : '{}' %>;
|
||||||
|
window.BeKulturT = function(key, params) {
|
||||||
|
var str = (window.BeKulturDict && window.BeKulturDict[key]) || key;
|
||||||
|
if (params) {
|
||||||
|
Object.keys(params).forEach(function(k) {
|
||||||
|
str = str.replace(new RegExp('\\{' + k + '\\}', 'g'), String(params[k]));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return str;
|
||||||
|
};
|
||||||
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<!-- Offline Indicator Banner -->
|
<!-- Offline Indicator Banner -->
|
||||||
|
|
@ -29,19 +59,32 @@
|
||||||
</a>
|
</a>
|
||||||
<% if (typeof studentId !== 'undefined' && studentId) { %>
|
<% if (typeof studentId !== 'undefined' && studentId) { %>
|
||||||
<nav class="main-nav">
|
<nav class="main-nav">
|
||||||
<a href="/dashboard" class="nav-item <%= typeof title !== 'undefined' && title.includes('Dashboard') ? 'active' : '' %>">Homework</a>
|
<a href="/dashboard" class="nav-item <%= (typeof activePage !== 'undefined' && activePage === 'dashboard') || (typeof title !== 'undefined' && (title.includes('Dashboard') || title.includes('Ödev'))) ? 'active' : '' %>"><%= typeof t === 'function' ? t('nav.homework') : 'Ödevler' %></a>
|
||||||
<a href="/syllabus" class="nav-item <%= typeof title !== 'undefined' && title.includes('Syllabus') ? 'active' : '' %>">Syllabus</a>
|
<a href="/syllabus" class="nav-item <%= (typeof activePage !== 'undefined' && activePage === 'syllabus') || (typeof title !== 'undefined' && (title.includes('Syllabus') || title.includes('Ders Programı'))) ? 'active' : '' %>"><%= typeof t === 'function' ? t('nav.syllabus') : 'Ders Programı' %></a>
|
||||||
<a href="/private-lessons" class="nav-item <%= typeof title !== 'undefined' && title.includes('Private Lessons') ? 'active' : '' %>">Private Lessons</a>
|
<a href="/private-lessons" class="nav-item <%= (typeof activePage !== 'undefined' && activePage === 'private-lessons') || (typeof title !== 'undefined' && (title.includes('Private Lessons') || title.includes('Özel Ders'))) ? 'active' : '' %>"><%= typeof t === 'function' ? t('nav.privateLessons') : 'Özel Ders' %></a>
|
||||||
<a href="/exams" class="nav-item <%= typeof title !== 'undefined' && title.includes('Exam') ? 'active' : '' %>">Exams</a>
|
<a href="/exams" class="nav-item <%= (typeof activePage !== 'undefined' && activePage === 'exams') || (typeof title !== 'undefined' && (title.includes('Exam') || title.includes('Sınav'))) ? 'active' : '' %>"><%= typeof t === 'function' ? t('nav.exams') : 'Sınav Raporları' %></a>
|
||||||
</nav>
|
</nav>
|
||||||
<% } %>
|
<% } %>
|
||||||
</div>
|
</div>
|
||||||
<% if (typeof studentId !== 'undefined' && studentId) { %>
|
|
||||||
<div class="user-nav">
|
<div class="user-nav">
|
||||||
<span class="user-id">Student: <%= studentId %></span>
|
<!-- Language Switcher (TR Default / EN) -->
|
||||||
<a href="/logout" class="btn btn-outline btn-sm">Log out</a>
|
<div class="lang-switcher" role="group" aria-label="<%= typeof t === 'function' ? t('header.langToggleTitle') : 'Dil Seçimi' %>">
|
||||||
|
<a href="/lang/tr" class="lang-btn <%= (typeof lang === 'undefined' || lang === 'tr') ? 'active' : '' %>" data-lang="tr">TR</a>
|
||||||
|
<a href="/lang/en" class="lang-btn <%= (typeof lang !== 'undefined' && lang === 'en') ? 'active' : '' %>" data-lang="en">EN</a>
|
||||||
</div>
|
</div>
|
||||||
<% } %>
|
|
||||||
|
<!-- Theme Toggle Button -->
|
||||||
|
<button type="button" id="themeToggleBtn" class="btn-icon-toggle" title="<%= typeof t === 'function' ? t('header.themeToggle') : 'Tema Değiştir' %>" aria-label="<%= typeof t === 'function' ? t('header.themeToggle') : 'Tema Değiştir' %>">
|
||||||
|
<span class="theme-icon theme-icon-sun" aria-hidden="true">☀️</span>
|
||||||
|
<span class="theme-icon theme-icon-moon" aria-hidden="true">🌙</span>
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<% if (typeof studentId !== 'undefined' && studentId) { %>
|
||||||
|
<span class="user-id"><%= typeof t === 'function' ? t('header.student') : 'Öğrenci' %>: <%= studentId %></span>
|
||||||
|
<a href="/logout" class="btn btn-outline btn-sm"><%= typeof t === 'function' ? t('header.logout') : 'Çıkış Yap' %></a>
|
||||||
|
<% } %>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
<main class="main-content">
|
<main class="main-content">
|
||||||
|
|
|
||||||
|
|
@ -4,18 +4,18 @@
|
||||||
<!-- Top Bar -->
|
<!-- Top Bar -->
|
||||||
<div class="dashboard-top-row">
|
<div class="dashboard-top-row">
|
||||||
<div>
|
<div>
|
||||||
<h1 class="page-title">Private Lessons</h1>
|
<h1 class="page-title"><%= t('privateLessons.title') %></h1>
|
||||||
<p class="page-subtitle">
|
<p class="page-subtitle">
|
||||||
Özel Ders & Başvuru
|
<%= t('privateLessons.subtitle') %>
|
||||||
<% if (lastSynced) { %>
|
<% if (lastSynced) { %>
|
||||||
• <span class="sync-time">Synced: <%= new Date(lastSynced).toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' }) %></span>
|
• <span class="sync-time"><%= t('privateLessons.syncedLabel') %> <%= new Date(lastSynced).toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' }) %></span>
|
||||||
<% } %>
|
<% } %>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="sync-actions">
|
<div class="sync-actions">
|
||||||
<button type="button" class="btn btn-primary btn-sm" id="btnSyncPrivateLessons">
|
<button type="button" class="btn btn-primary btn-sm" id="btnSyncPrivateLessons">
|
||||||
Sync Lessons
|
<%= t('privateLessons.syncBtn') %>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -34,7 +34,7 @@
|
||||||
<p class="student-school"><%= formMeta.schoolName %> • <%= formMeta.className %></p>
|
<p class="student-school"><%= formMeta.schoolName %> • <%= formMeta.className %></p>
|
||||||
<% if (detectedAdvisor) { %>
|
<% if (detectedAdvisor) { %>
|
||||||
<div class="student-advisor-badge">
|
<div class="student-advisor-badge">
|
||||||
<span class="advisor-badge-label">Advisor:</span>
|
<span class="advisor-badge-label"><%= t('privateLessons.advisorLabel') %></span>
|
||||||
<strong><%= detectedAdvisor %></strong>
|
<strong><%= detectedAdvisor %></strong>
|
||||||
</div>
|
</div>
|
||||||
<% } %>
|
<% } %>
|
||||||
|
|
@ -42,7 +42,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="student-policy-note">
|
<div class="student-policy-note">
|
||||||
<span class="policy-icon">ℹ</span>
|
<span class="policy-icon">ℹ</span>
|
||||||
<span>Başkası adına özel ders almayınız, seçtiğiniz öğretmen onayladığı takdirde özel derse alınacaksınız.</span>
|
<span><%= t('privateLessons.policyNote') %></span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<% } %>
|
<% } %>
|
||||||
|
|
@ -50,8 +50,8 @@
|
||||||
<!-- Request Form Card -->
|
<!-- Request Form Card -->
|
||||||
<div class="request-form-card">
|
<div class="request-form-card">
|
||||||
<div class="form-card-header">
|
<div class="form-card-header">
|
||||||
<h2 class="section-title">New Lesson Request (Özel Ders İstek)</h2>
|
<h2 class="section-title"><%= t('privateLessons.requestTitle') %></h2>
|
||||||
<span class="form-header-badge">Online Başvuru</span>
|
<span class="form-header-badge"><%= t('privateLessons.onlineBadge') %></span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<form id="privateLessonForm" class="private-lesson-form">
|
<form id="privateLessonForm" class="private-lesson-form">
|
||||||
|
|
@ -68,9 +68,9 @@
|
||||||
<div class="form-grid-3">
|
<div class="form-grid-3">
|
||||||
<!-- Course Select -->
|
<!-- Course Select -->
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="selectCourse" class="form-label">Ders (Course)</label>
|
<label for="selectCourse" class="form-label"><%= t('privateLessons.courseLabel') %></label>
|
||||||
<select id="selectCourse" name="dersId" class="form-select" required>
|
<select id="selectCourse" name="dersId" class="form-select" required>
|
||||||
<option value="">Seçiniz...</option>
|
<option value=""><%= t('privateLessons.selectPrompt') %></option>
|
||||||
<% if (formMeta && formMeta.courses) { %>
|
<% if (formMeta && formMeta.courses) { %>
|
||||||
<% formMeta.courses.forEach(function(course) { %>
|
<% formMeta.courses.forEach(function(course) { %>
|
||||||
<option value="<%= course.id %>"><%= course.name %></option>
|
<option value="<%= course.id %>"><%= course.name %></option>
|
||||||
|
|
@ -82,29 +82,29 @@
|
||||||
<!-- Unit Select -->
|
<!-- Unit Select -->
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="selectUnit" class="form-label">
|
<label for="selectUnit" class="form-label">
|
||||||
Ünite (Unit)
|
<%= t('privateLessons.unitLabel') %>
|
||||||
<span id="unitLoading" class="select-loading hidden">Loading...</span>
|
<span id="unitLoading" class="select-loading hidden"><%= t('privateLessons.loading') %></span>
|
||||||
</label>
|
</label>
|
||||||
<select id="selectUnit" name="uniteId" class="form-select" disabled required>
|
<select id="selectUnit" name="uniteId" class="form-select" disabled required>
|
||||||
<option value="">Önce ders seçiniz...</option>
|
<option value=""><%= t('privateLessons.selectCourseFirst') %></option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Topic Select -->
|
<!-- Topic Select -->
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="selectTopic" class="form-label">
|
<label for="selectTopic" class="form-label">
|
||||||
Konu (Topic)
|
<%= t('privateLessons.topicLabel') %>
|
||||||
<span id="topicLoading" class="select-loading hidden">Loading...</span>
|
<span id="topicLoading" class="select-loading hidden"><%= t('privateLessons.loading') %></span>
|
||||||
</label>
|
</label>
|
||||||
<select id="selectTopic" name="konuId" class="form-select" disabled required>
|
<select id="selectTopic" name="konuId" class="form-select" disabled required>
|
||||||
<option value="">Önce ünite seçiniz...</option>
|
<option value=""><%= t('privateLessons.selectUnitFirst') %></option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-actions-row">
|
<div class="form-actions-row">
|
||||||
<button type="submit" id="btnSubmitRequest" class="btn btn-primary" disabled>
|
<button type="submit" id="btnSubmitRequest" class="btn btn-primary" disabled>
|
||||||
Submit Request (Gönder)
|
<%= t('privateLessons.submitBtn') %>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -116,14 +116,14 @@
|
||||||
<div class="lessons-section">
|
<div class="lessons-section">
|
||||||
<div class="lessons-header-row">
|
<div class="lessons-header-row">
|
||||||
<div class="lessons-title-wrap">
|
<div class="lessons-title-wrap">
|
||||||
<h2 class="section-title">My Lessons (Özel Derslerim)</h2>
|
<h2 class="section-title"><%= t('privateLessons.myLessonsTitle') %></h2>
|
||||||
<span class="lessons-count-badge" id="lessonsCountBadge"><%= allLessons.length %></span>
|
<span class="lessons-count-badge" id="lessonsCountBadge"><%= allLessons.length %></span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Subject Filters -->
|
<!-- Subject Filters -->
|
||||||
<% if (subjects.length > 0) { %>
|
<% if (subjects.length > 0) { %>
|
||||||
<div class="subject-filter-pills" id="subjectFilterPills">
|
<div class="subject-filter-pills" id="subjectFilterPills">
|
||||||
<button type="button" class="subject-pill-btn active" data-subject="all">All</button>
|
<button type="button" class="subject-pill-btn active" data-subject="all"><%= t('privateLessons.filterAll') %></button>
|
||||||
<% subjects.forEach(function(sub) { %>
|
<% subjects.forEach(function(sub) { %>
|
||||||
<button type="button" class="subject-pill-btn" data-subject="<%= sub %>"><%= sub %></button>
|
<button type="button" class="subject-pill-btn" data-subject="<%= sub %>"><%= sub %></button>
|
||||||
<% }); %>
|
<% }); %>
|
||||||
|
|
@ -135,15 +135,15 @@
|
||||||
<% if (upcomingLessons.length > 0) { %>
|
<% if (upcomingLessons.length > 0) { %>
|
||||||
<div class="upcoming-lessons-group" id="upcomingGroup">
|
<div class="upcoming-lessons-group" id="upcomingGroup">
|
||||||
<div class="group-header">
|
<div class="group-header">
|
||||||
<span class="group-title">Upcoming / Approved Lessons</span>
|
<span class="group-title"><%= t('privateLessons.upcomingGroupTitle') %></span>
|
||||||
<span class="badge badge-active"><%= upcomingLessons.length %> Active</span>
|
<span class="badge badge-active"><%= t('privateLessons.activeCountBadge', { count: upcomingLessons.length }) %></span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="lessons-grid">
|
<div class="lessons-grid">
|
||||||
<% upcomingLessons.forEach(function(item) { %>
|
<% upcomingLessons.forEach(function(item) { %>
|
||||||
<div class="lesson-card is-upcoming" data-subject="<%= item.subject %>">
|
<div class="lesson-card is-upcoming" data-subject="<%= item.subject %>">
|
||||||
<div class="lesson-card-header">
|
<div class="lesson-card-header">
|
||||||
<span class="badge badge-active">Upcoming</span>
|
<span class="badge badge-active"><%= t('privateLessons.upcomingBadge') %></span>
|
||||||
<span class="lesson-date"><%= item.date %></span>
|
<span class="lesson-date"><%= item.date %></span>
|
||||||
</div>
|
</div>
|
||||||
<div class="lesson-card-body">
|
<div class="lesson-card-body">
|
||||||
|
|
@ -166,20 +166,20 @@
|
||||||
<!-- Past Lessons -->
|
<!-- Past Lessons -->
|
||||||
<div class="past-lessons-group" id="pastGroup">
|
<div class="past-lessons-group" id="pastGroup">
|
||||||
<div class="group-header">
|
<div class="group-header">
|
||||||
<span class="group-title">Lesson History</span>
|
<span class="group-title"><%= t('privateLessons.pastGroupTitle') %></span>
|
||||||
<span class="badge badge-type"><%= pastLessons.length %> Past</span>
|
<span class="badge badge-type"><%= t('privateLessons.pastCountBadge', { count: pastLessons.length }) %></span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<% if (pastLessons.length === 0 && upcomingLessons.length === 0) { %>
|
<% if (pastLessons.length === 0 && upcomingLessons.length === 0) { %>
|
||||||
<div class="empty-lessons-card">
|
<div class="empty-lessons-card">
|
||||||
<p>No private lessons recorded yet. Submit a request above or click <strong>Sync Lessons</strong> to fetch from the portal.</p>
|
<p><%= t('privateLessons.emptyState') %></p>
|
||||||
</div>
|
</div>
|
||||||
<% } else { %>
|
<% } else { %>
|
||||||
<div class="lessons-grid" id="pastLessonsGrid">
|
<div class="lessons-grid" id="pastLessonsGrid">
|
||||||
<% pastLessons.forEach(function(item) { %>
|
<% pastLessons.forEach(function(item) { %>
|
||||||
<div class="lesson-card is-past" data-subject="<%= item.subject %>">
|
<div class="lesson-card is-past" data-subject="<%= item.subject %>">
|
||||||
<div class="lesson-card-header">
|
<div class="lesson-card-header">
|
||||||
<span class="badge badge-type">Completed</span>
|
<span class="badge badge-type"><%= t('privateLessons.completedBadge') %></span>
|
||||||
<span class="lesson-date"><%= item.date %></span>
|
<span class="lesson-date"><%= item.date %></span>
|
||||||
</div>
|
</div>
|
||||||
<div class="lesson-card-body">
|
<div class="lesson-card-body">
|
||||||
|
|
|
||||||
|
|
@ -4,15 +4,15 @@
|
||||||
<!-- Top Bar -->
|
<!-- Top Bar -->
|
||||||
<div class="dashboard-topbar">
|
<div class="dashboard-topbar">
|
||||||
<div class="dashboard-title-area">
|
<div class="dashboard-title-area">
|
||||||
<h1 class="dashboard-title">Syllabus</h1>
|
<h1 class="dashboard-title"><%= t('syllabus.title') %></h1>
|
||||||
<p class="dashboard-subtitle">
|
<p class="dashboard-subtitle">
|
||||||
Week: <strong><%= weekRange %></strong> (<%= weekId %>)
|
<%= t('syllabus.weekLabel') %> <strong><%= weekRange %></strong> (<%= weekId %>)
|
||||||
<span class="dot-separator">•</span>
|
<span class="dot-separator">•</span>
|
||||||
<span id="syllabusSyncStatus">
|
<span id="syllabusSyncStatus">
|
||||||
<% if (lastSynced) { %>
|
<% if (lastSynced) { %>
|
||||||
Synced: <%= new Date(lastSynced).toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' }) %>
|
<%= t('syllabus.syncedLabel') %> <%= new Date(lastSynced).toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' }) %>
|
||||||
<% } else { %>
|
<% } else { %>
|
||||||
Not synced
|
<%= t('syllabus.notSynced') %>
|
||||||
<% } %>
|
<% } %>
|
||||||
</span>
|
</span>
|
||||||
</p>
|
</p>
|
||||||
|
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
<div class="sync-actions">
|
<div class="sync-actions">
|
||||||
<button type="button" class="btn btn-primary btn-sm" id="btnSyncSyllabus">
|
<button type="button" class="btn btn-primary btn-sm" id="btnSyncSyllabus">
|
||||||
Sync Syllabus
|
<%= t('syllabus.syncBtn') %>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -38,32 +38,32 @@
|
||||||
<!-- Controls Card: Station Selector & View Toggle -->
|
<!-- Controls Card: Station Selector & View Toggle -->
|
||||||
<div class="toolbar-card">
|
<div class="toolbar-card">
|
||||||
<div class="station-select-row">
|
<div class="station-select-row">
|
||||||
<span class="toolbar-label">Station:</span>
|
<span class="toolbar-label"><%= t('syllabus.stationLabel') %></span>
|
||||||
<div class="station-pills" id="stationPills">
|
<div class="station-pills" id="stationPills">
|
||||||
<button type="button" class="station-btn <%= selectedStation === 'İst-1' ? 'active' : '' %>" data-station="İst-1">İst-1</button>
|
<button type="button" class="station-btn <%= selectedStation === 'İst-1' ? 'active' : '' %>" data-station="İst-1">İst-1</button>
|
||||||
<button type="button" class="station-btn <%= selectedStation === 'İst-2' ? 'active' : '' %>" data-station="İst-2">İst-2</button>
|
<button type="button" class="station-btn <%= selectedStation === 'İst-2' ? 'active' : '' %>" data-station="İst-2">İst-2</button>
|
||||||
<button type="button" class="station-btn <%= selectedStation === 'İst-3' ? 'active' : '' %>" data-station="İst-3">İst-3</button>
|
<button type="button" class="station-btn <%= selectedStation === 'İst-3' ? 'active' : '' %>" data-station="İst-3">İst-3</button>
|
||||||
<button type="button" class="station-btn <%= selectedStation === 'İst-4' || !selectedStation ? 'active' : '' %>" data-station="İst-4">İst-4</button>
|
<button type="button" class="station-btn <%= selectedStation === 'İst-4' || !selectedStation ? 'active' : '' %>" data-station="İst-4">İst-4</button>
|
||||||
<button type="button" class="station-btn <%= selectedStation === 'İst-5' ? 'active' : '' %>" data-station="İst-5">İst-5</button>
|
<button type="button" class="station-btn <%= selectedStation === 'İst-5' ? 'active' : '' %>" data-station="İst-5">İst-5</button>
|
||||||
<button type="button" class="station-btn <%= selectedStation === 'all' ? 'active' : '' %>" data-station="all">All Stations</button>
|
<button type="button" class="station-btn <%= selectedStation === 'all' ? 'active' : '' %>" data-station="all"><%= t('syllabus.allStations') %></button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<% if (typeof advisoryTeacher !== 'undefined' && advisoryTeacher) { %>
|
<% if (typeof advisoryTeacher !== 'undefined' && advisoryTeacher) { %>
|
||||||
<div class="advisor-row">
|
<div class="advisor-row">
|
||||||
<span class="toolbar-label">Advisor:</span>
|
<span class="toolbar-label"><%= t('syllabus.advisorLabel') %></span>
|
||||||
<div class="advisor-pill">
|
<div class="advisor-pill">
|
||||||
<span class="advisor-name"><%= advisoryTeacher %></span>
|
<span class="advisor-name"><%= advisoryTeacher %></span>
|
||||||
<span class="advisor-sub">Danışmanlık</span>
|
<span class="advisor-sub"><%= t('syllabus.advisoryTag') %></span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<% } %>
|
<% } %>
|
||||||
|
|
||||||
<div class="view-toggle-row">
|
<div class="view-toggle-row">
|
||||||
<span class="toolbar-label">View:</span>
|
<span class="toolbar-label"><%= t('syllabus.viewLabel') %></span>
|
||||||
<div class="view-toggle-pills" id="viewTogglePills">
|
<div class="view-toggle-pills" id="viewTogglePills">
|
||||||
<button type="button" class="view-btn active" data-view="day">Day View</button>
|
<button type="button" class="view-btn active" data-view="day"><%= t('syllabus.dayView') %></button>
|
||||||
<button type="button" class="view-btn" data-view="week">Full Week Grid</button>
|
<button type="button" class="view-btn" data-view="week"><%= t('syllabus.weekView') %></button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -81,7 +81,7 @@
|
||||||
>
|
>
|
||||||
<span><%= DAY_NAMES[d] %></span>
|
<span><%= DAY_NAMES[d] %></span>
|
||||||
<% if (isToday) { %>
|
<% if (isToday) { %>
|
||||||
<span class="today-badge">Today</span>
|
<span class="today-badge"><%= t('syllabus.todayBadge') %></span>
|
||||||
<% } %>
|
<% } %>
|
||||||
<span class="day-count-badge"><%= (filteredSchedule[d] || []).length %></span>
|
<span class="day-count-badge"><%= (filteredSchedule[d] || []).length %></span>
|
||||||
</button>
|
</button>
|
||||||
|
|
@ -94,7 +94,7 @@
|
||||||
<% const lessons = filteredSchedule[d] || []; %>
|
<% const lessons = filteredSchedule[d] || []; %>
|
||||||
<% if (lessons.length === 0) { %>
|
<% if (lessons.length === 0) { %>
|
||||||
<div class="empty-state">
|
<div class="empty-state">
|
||||||
<p>No lessons found for <%= DAY_NAMES[d] %>. Click "Sync Syllabus" to fetch from portal.</p>
|
<p><%= t('syllabus.noLessonsDay', { day: DAY_NAMES[d] }) %></p>
|
||||||
</div>
|
</div>
|
||||||
<% } else { %>
|
<% } else { %>
|
||||||
<div class="timetable-list">
|
<div class="timetable-list">
|
||||||
|
|
@ -119,7 +119,7 @@
|
||||||
<% if (l.station) { %>
|
<% if (l.station) { %>
|
||||||
<span class="station-badge"><%= l.station %></span>
|
<span class="station-badge"><%= l.station %></span>
|
||||||
<% } else { %>
|
<% } else { %>
|
||||||
<span class="class-badge">Class</span>
|
<span class="class-badge"><%= t('syllabus.classBadge') %></span>
|
||||||
<% } %>
|
<% } %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -136,12 +136,12 @@
|
||||||
<table class="week-grid-table">
|
<table class="week-grid-table">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="grid-time-th">Period</th>
|
<th class="grid-time-th"><%= t('syllabus.periodHeader') %></th>
|
||||||
<% [1, 2, 3, 4, 5].forEach(function(d) { %>
|
<% [1, 2, 3, 4, 5].forEach(function(d) { %>
|
||||||
<% const isToday = (new Date().getDay() === d); %>
|
<% const isToday = (new Date().getDay() === d); %>
|
||||||
<th class="<%= isToday ? 'grid-today-th' : '' %>">
|
<th class="<%= isToday ? 'grid-today-th' : '' %>">
|
||||||
<%= DAY_NAMES[d] %>
|
<%= DAY_NAMES[d] %>
|
||||||
<% if (isToday) { %><span class="grid-today-pill">Today</span><% } %>
|
<% if (isToday) { %><span class="grid-today-pill"><%= t('syllabus.todayBadge') %></span><% } %>
|
||||||
</th>
|
</th>
|
||||||
<% }); %>
|
<% }); %>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue