Compare commits

...

19 Commits

Author SHA1 Message Date
7538d5ea59 Update README.md 2025-01-31 11:38:36 +01:00
Dieter Blocher
4ba3fcea08 Add example.env 2025-01-31 08:23:55 +00:00
Dieter Blocher
b73e655e89 Update stuff 2025-01-30 16:42:28 +00:00
71e3adf351 Update .devcontainer/devcontainer.json 2025-01-30 17:31:04 +01:00
bc8f30e924 Update .devcontainer/Dockerfile 2025-01-30 17:30:42 +01:00
2ed058df64 Update .devcontainer/devcontainer.json 2025-01-30 17:23:27 +01:00
7cc5200f24 Update README.md 2025-01-30 17:17:05 +01:00
1e74de1393 Update doc/README.md 2025-01-30 16:46:14 +01:00
Dieter Blocher
0d11465fcf Add mitutoyo.crt 2025-01-30 09:45:08 +00:00
Dieter Blocher
366fd3311d Add <!DOCTYPE html> 2025-01-30 08:10:22 +00:00
Dieter Blocher
1b1addfa42 Format stuff 2025-01-29 19:24:15 +00:00
Dieter Blocher
c3d50d2ac1 Add logging 2025-01-29 19:10:24 +00:00
Dieter Blocher
826cfb48c9 Add database connection... 2025-01-29 16:12:24 +00:00
Dieter Blocher
ca77e0842d add a div container to all pages... 2025-01-29 14:54:16 +00:00
Dieter Blocher
4ed3721ce5 Update stuff 2025-01-29 14:42:49 +00:00
Dieter Blocher
bffd60bb94 add other public pages 2025-01-29 14:26:45 +00:00
Dieter Blocher
5146f356b6 add howto clone and start the devcontainer and how to start express inside. 2025-01-29 10:12:12 +00:00
Dieter Blocher
8bf47a6c5f Merge branch 'main' of https://gitea.not-my.cloud/dieter/test_dev 2025-01-29 09:31:22 +00:00
Dieter Blocher
8b5a6e27dd add sophos certificate 2025-01-29 09:30:45 +00:00
32 changed files with 732 additions and 381 deletions

View File

@@ -1,5 +1,13 @@
FROM mcr.microsoft.com/devcontainers/javascript-node:1-22-bookworm
# Copy the Sophos CA certificate into the container
COPY sophos.crt /usr/local/share/ca-certificates/sophos.crt
COPY mitutoyo.crt /usr/local/share/ca-certificates/mitutoyo.crt
# Merge multiple CA certificates into one file
RUN cat /usr/local/share/ca-certificates/sophos.crt \
/usr/local/share/ca-certificates/mitutoyo.crt \
> /usr/local/share/ca-certificates/custom-ca.pem
# Update system CA certificates
RUN update-ca-certificates
# Install MongoDB command line tools - though mongo-database-tools not available on arm64
ARG MONGO_TOOLS_VERSION=6.0
RUN . /etc/os-release \

View File

@@ -5,27 +5,26 @@
"dockerComposeFile": "docker-compose.yml",
"service": "app",
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},
"containerEnv": {
"NODE_EXTRA_CA_CERTS": "/usr/local/share/ca-certificates/custom-ca.pem"
},
// Configure tool-specific properties.
"customizations": {
// Configure properties specific to VS Code.
"vscode": {
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"mongodb.mongodb-vscode"
"mongodb.mongodb-vscode",
"ms-azuretools.vscode-docker"
]
}
}
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [3000, 27017],
// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "yarn install",
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}

View File

@@ -16,6 +16,7 @@ services:
# (Adding the "ports" property to this file will not forward from a Codespace.)
db:
container_name: mongodb
image: mongo:latest
restart: unless-stopped
volumes:

View File

@@ -0,0 +1,22 @@
-----BEGIN CERTIFICATE-----
MIIDojCCAoqgAwIBAgIQY8oAt3ThH4xLeXIsyw6zrTANBgkqhkiG9w0BAQsFADBQ
MRIwEAYKCZImiZPyLGQBGRYCREUxHDAaBgoJkiaJk/IsZAEZFgxNSVRVVE9ZTy1D
VEwxHDAaBgNVBAMTE01JVFVUT1lPLUNUTC1CREMtQ0EwHhcNMjMxMDEyMDk1MTQ5
WhcNMzgxMDEyMTAwMTQ4WjBQMRIwEAYKCZImiZPyLGQBGRYCREUxHDAaBgoJkiaJ
k/IsZAEZFgxNSVRVVE9ZTy1DVEwxHDAaBgNVBAMTE01JVFVUT1lPLUNUTC1CREMt
Q0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCe07y85lBkGeKPOUkx
uqxtj79AxFy6an7oh6LjyDcm0Uf8p4Yl/StwQ474qg+SQ5vFh9KDVR9kkT6q1W1r
+SCI0u/lynngSGgcJlCa4m+EqPPoSFQRh0iAJ7rPGxZWW4Ny6Dn1D0PF/FwbNIHr
1qBmcvSGvVW4cYvcFaU3luclB7s9qSFM3+H7GcDdsZ2en6SVKhKEGSSqM5dC9+n4
Ml9BBV5BgUW6j1q0yzgtKRG7/1oMtV/Yj+RCnwEzmF40raXWqYOvpBMCmTChE14P
GW7UVWwS+6jHeqzFpvLzv5WLrzW22FViR/qV/5bmGoSj74JZ/oefkozeTg/yViC0
IxUhAgMBAAGjeDB2MAsGA1UdDwQEAwIBhjAPBgNVHRMBAf8EBTADAQH/MB0GA1Ud
DgQWBBQOLNNUoeBKVbAApH/ZX3FRZClCMDASBgkrBgEEAYI3FQEEBQIDAQABMCMG
CSsGAQQBgjcVAgQWBBRseoY/hsUyKpvnSnM37Vozh8et2TANBgkqhkiG9w0BAQsF
AAOCAQEAKaCpNic5zq3tnKW1qZy/XPDC7PSQzSAlkb3PAbk4g1hm8RfmW9Z5ktfZ
L5r1inGQvSeq8nkAuqGbX9eUyxTwJK7UioD5fds8uSYsJQKVvtcZxA8V+2Era1jy
FPMOzO4my76kSwFjDCHRT8VvkaN3uuoHUTqZvUzb0cfjM8er9guNlnIpvoTKEXt7
0oJ0GPxix80Rkcx7trK8Vmj4iG5C5/UDA3a8sQDHE2uqOallNPqBgSEE1SCPSpWn
L2xg+fC5yAc7dOb/9OTKJGHcc3FgY51lrE0KhKgh6WSjCmjQrAPLQ1KpthVo0xyq
NM9LX2+pAqNoANrxa7fiFqlnrXKcCg==
-----END CERTIFICATE-----

11
.devcontainer/sophos.crt Normal file
View File

@@ -0,0 +1,11 @@
-----BEGIN CERTIFICATE-----
MIIBlzCCATygAwIBAgIQ+r1RZTAbugn7zlrbTm7vHDAKBggqhkjOPQQDAjAzMSAw
HgYDVQQDExdTb3Bob3MgRW5kcG9pbnQgRUMgUm9vdDEPMA0GA1UEChMGU29waG9z
MB4XDTIzMDEyOTAwMzMwN1oXDTMwMDEyODE3MTczMVowMzEgMB4GA1UEAxMXU29w
aG9zIEVuZHBvaW50IEVDIFJvb3QxDzANBgNVBAoTBlNvcGhvczBZMBMGByqGSM49
AgEGCCqGSM49AwEHA0IABEl/hnLbxbDu20CgMwEmkTyz3HGt/KWZeg7p10rZz60e
VgOwmGYBh+0maeHKKGhxCs2+QgCde7roJodn/FteQaqjMjAwMB0GA1UdDgQWBBTX
b35JZhaEglsn4+ign9pOsHQjczAPBgNVHRMBAf8EBTADAQH/MAoGCCqGSM49BAMC
A0kAMEYCIQDSWQ5VlOYhexhqygFekzI5EeT7ERibOn8KIHM9cOZQsQIhAPxje//X
sapiH40dHw/cowZb4YBnZYDjlgWnj0vUHvhi
-----END CERTIFICATE-----

View File

@@ -1,20 +1,3 @@
# test_dev
From here:
https://www.youtube.com/watch?v=SDa3v4Quj7Y
Auth:
https://www.youtube.com/watch?v=bgk1mI2pak4
Middelware:
https://www.youtube.com/watch?v=_I6gP_nIFIA
Passport-js
https://www.youtube.com/watch?v=-RCnNyD0L-s
# Certificate
The Container need our certificate!
# Documentation
[Documentation](./doc/README.md)
Repo has moved to: https://gitea.not-my.cloud/education/hacker-game

View File

@@ -1,4 +1,51 @@
# Start the Server:
'''npm run devStart'''
# Clone the Repository into a container
![alt text](./assets/image.png)
Open VS Code and press ```Ctrl + Shift + P``` (Windows/Linux) or ```Cmd + Shift + P``` (Mac) to get to the Command Palette
Type ```DevContainers Clone...``` until you can see the command:
DevContainers: Clone Repository in Container Volume...
![alt text](./assets/command_palllete.png)
Enter the URL of the repository:
https://gitea.not-my.cloud/dieter/test_dev.git
![alt text](./assets/repo_url.png)
The repo should be cloned and the container starts up:
![alt text](./assets/devcontainer_start.png)
Now you are able to open a new terminal:
![alt text](./assets/new_terminal.png)
# Install packages
First you should install all related packages with
```npm install```
This will install the packages defined in [package.json](../package.json)
# Start the Server
```npm run devStart``` or ```npx nodemon```
![alt text](./assets/start_node_server.png)
or
![alt text](./assets/start_node_server2.png)
the second method uses the [nodemon.json](../nodemon.json) to configure nodemon.
# .env file
To have different behavior on your dev host, you cloud add an .env file.
Here are the key-values of an .evc file:
```bash
PORT = 3000
```

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 123 KiB

BIN
doc/assets/new_terminal.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 140 KiB

BIN
doc/assets/repo_url.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

View File

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

2
example.env Normal file
View File

@@ -0,0 +1,2 @@
# App Port
PORT = 3000

View File

@@ -1,5 +1,5 @@
{
"watch": ["src", "src/public", "config"],
"ext": "js,json,html",
"watch": ["src", "src/public", "src/views", "config", "stylesheets"],
"ext": "js,json,css,html,ejs",
"exec": "node ./src/server.js"
}

293
package-lock.json generated
View File

@@ -11,7 +11,9 @@
"dependencies": {
"dotenv": "^16.4.7",
"ejs": "^3.1.10",
"express": "^4.21.2"
"express": "^4.21.2",
"mongoose": "^8.9.5",
"morgan": "^1.10.0"
},
"devDependencies": {
"connect-livereload": "^0.6.1",
@@ -19,6 +21,30 @@
"nodemon": "^3.1.9"
}
},
"node_modules/@mongodb-js/saslprep": {
"version": "1.1.9",
"resolved": "https://registry.npmjs.org/@mongodb-js/saslprep/-/saslprep-1.1.9.tgz",
"integrity": "sha512-tVkljjeEaAhCqTzajSdgbQ6gE6f3oneVwa3iXR6csiEwXXOFsiC6Uh9iAjAhXPtqa/XMDHWjjeNH/77m/Yq2dw==",
"license": "MIT",
"dependencies": {
"sparse-bitfield": "^3.0.3"
}
},
"node_modules/@types/webidl-conversions": {
"version": "7.0.3",
"resolved": "https://registry.npmjs.org/@types/webidl-conversions/-/webidl-conversions-7.0.3.tgz",
"integrity": "sha512-CiJJvcRtIgzadHCYXw7dqEnMNRjhGZlYK05Mj9OyktqV8uVT8fD2BFOB7S1uwBE3Kj2Z+4UyPmFw/Ixgw/LAlA==",
"license": "MIT"
},
"node_modules/@types/whatwg-url": {
"version": "11.0.5",
"resolved": "https://registry.npmjs.org/@types/whatwg-url/-/whatwg-url-11.0.5.tgz",
"integrity": "sha512-coYR071JRaHa+xoEvvYqvnIHaVqaYrLPbsufM9BF63HkwI5Lgmy2QR8Q5K/lYDYo5AK82wOvSOS0UsLTpTG7uQ==",
"license": "MIT",
"dependencies": {
"@types/webidl-conversions": "*"
}
},
"node_modules/accepts": {
"version": "1.3.8",
"resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz",
@@ -79,6 +105,24 @@
"integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==",
"license": "MIT"
},
"node_modules/basic-auth": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/basic-auth/-/basic-auth-2.0.1.tgz",
"integrity": "sha512-NF+epuEdnUYVlGuhaxbbq+dvJttwLnGY+YixlXlME5KpQ5W3CnXA5cVTneY3SPbPDRkcjMbifrwmFYcClgOZeg==",
"license": "MIT",
"dependencies": {
"safe-buffer": "5.1.2"
},
"engines": {
"node": ">= 0.8"
}
},
"node_modules/basic-auth/node_modules/safe-buffer": {
"version": "5.1.2",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==",
"license": "MIT"
},
"node_modules/binary-extensions": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz",
@@ -139,6 +183,15 @@
"node": ">=8"
}
},
"node_modules/bson": {
"version": "6.10.1",
"resolved": "https://registry.npmjs.org/bson/-/bson-6.10.1.tgz",
"integrity": "sha512-P92xmHDQjSKPLHqFxefqMxASNq/aWJMEZugpCjf+AF/pgcUpMMQCg7t7+ewko0/u8AapvF3luf/FoehddEK+sA==",
"license": "Apache-2.0",
"engines": {
"node": ">=16.20.1"
}
},
"node_modules/bytes": {
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz",
@@ -775,6 +828,15 @@
"node": ">=10"
}
},
"node_modules/kareem": {
"version": "2.6.3",
"resolved": "https://registry.npmjs.org/kareem/-/kareem-2.6.3.tgz",
"integrity": "sha512-C3iHfuGUXK2u8/ipq9LfjFfXFxAZMQJJq7vLS45r3D9Y2xQ/m4S8zaR4zMLFWh9AsNPXmcFfUDhTEO8UIC/V6Q==",
"license": "Apache-2.0",
"engines": {
"node": ">=12.0.0"
}
},
"node_modules/livereload": {
"version": "0.9.3",
"resolved": "https://registry.npmjs.org/livereload/-/livereload-0.9.3.tgz",
@@ -819,6 +881,12 @@
"node": ">= 0.6"
}
},
"node_modules/memory-pager": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/memory-pager/-/memory-pager-1.5.0.tgz",
"integrity": "sha512-ZS4Bp4r/Zoeq6+NLJpP+0Zzm0pR8whtGPf1XExKLJBAczGMnSi3It14OiNCStjQjM6NU1okjQGSxgEZN8eBYKg==",
"license": "MIT"
},
"node_modules/merge-descriptors": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.3.tgz",
@@ -882,6 +950,162 @@
"node": "*"
}
},
"node_modules/mongodb": {
"version": "6.12.0",
"resolved": "https://registry.npmjs.org/mongodb/-/mongodb-6.12.0.tgz",
"integrity": "sha512-RM7AHlvYfS7jv7+BXund/kR64DryVI+cHbVAy9P61fnb1RcWZqOW1/Wj2YhqMCx+MuYhqTRGv7AwHBzmsCKBfA==",
"license": "Apache-2.0",
"dependencies": {
"@mongodb-js/saslprep": "^1.1.9",
"bson": "^6.10.1",
"mongodb-connection-string-url": "^3.0.0"
},
"engines": {
"node": ">=16.20.1"
},
"peerDependencies": {
"@aws-sdk/credential-providers": "^3.188.0",
"@mongodb-js/zstd": "^1.1.0 || ^2.0.0",
"gcp-metadata": "^5.2.0",
"kerberos": "^2.0.1",
"mongodb-client-encryption": ">=6.0.0 <7",
"snappy": "^7.2.2",
"socks": "^2.7.1"
},
"peerDependenciesMeta": {
"@aws-sdk/credential-providers": {
"optional": true
},
"@mongodb-js/zstd": {
"optional": true
},
"gcp-metadata": {
"optional": true
},
"kerberos": {
"optional": true
},
"mongodb-client-encryption": {
"optional": true
},
"snappy": {
"optional": true
},
"socks": {
"optional": true
}
}
},
"node_modules/mongodb-connection-string-url": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/mongodb-connection-string-url/-/mongodb-connection-string-url-3.0.2.tgz",
"integrity": "sha512-rMO7CGo/9BFwyZABcKAWL8UJwH/Kc2x0g72uhDWzG48URRax5TCIcJ7Rc3RZqffZzO/Gwff/jyKwCU9TN8gehA==",
"license": "Apache-2.0",
"dependencies": {
"@types/whatwg-url": "^11.0.2",
"whatwg-url": "^14.1.0 || ^13.0.0"
}
},
"node_modules/mongoose": {
"version": "8.9.5",
"resolved": "https://registry.npmjs.org/mongoose/-/mongoose-8.9.5.tgz",
"integrity": "sha512-SPhOrgBm0nKV3b+IIHGqpUTOmgVL5Z3OO9AwkFEmvOZznXTvplbomstCnPOGAyungtRXE5pJTgKpKcZTdjeESg==",
"license": "MIT",
"dependencies": {
"bson": "^6.10.1",
"kareem": "2.6.3",
"mongodb": "~6.12.0",
"mpath": "0.9.0",
"mquery": "5.0.0",
"ms": "2.1.3",
"sift": "17.1.3"
},
"engines": {
"node": ">=16.20.1"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/mongoose"
}
},
"node_modules/mongoose/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==",
"license": "MIT"
},
"node_modules/morgan": {
"version": "1.10.0",
"resolved": "https://registry.npmjs.org/morgan/-/morgan-1.10.0.tgz",
"integrity": "sha512-AbegBVI4sh6El+1gNwvD5YIck7nSA36weD7xvIxG4in80j/UoK8AEGaWnnz8v1GxonMCltmlNs5ZKbGvl9b1XQ==",
"license": "MIT",
"dependencies": {
"basic-auth": "~2.0.1",
"debug": "2.6.9",
"depd": "~2.0.0",
"on-finished": "~2.3.0",
"on-headers": "~1.0.2"
},
"engines": {
"node": ">= 0.8.0"
}
},
"node_modules/morgan/node_modules/on-finished": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz",
"integrity": "sha512-ikqdkGAAyf/X/gPhXGvfgAytDZtDbr+bkNUJ0N9h5MI/dmdgCs3l6hoHrcUv41sRKew3jIwrp4qQDXiK99Utww==",
"license": "MIT",
"dependencies": {
"ee-first": "1.1.1"
},
"engines": {
"node": ">= 0.8"
}
},
"node_modules/mpath": {
"version": "0.9.0",
"resolved": "https://registry.npmjs.org/mpath/-/mpath-0.9.0.tgz",
"integrity": "sha512-ikJRQTk8hw5DEoFVxHG1Gn9T/xcjtdnOKIU1JTmGjZZlg9LST2mBLmcX3/ICIbgJydT2GOc15RnNy5mHmzfSew==",
"license": "MIT",
"engines": {
"node": ">=4.0.0"
}
},
"node_modules/mquery": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/mquery/-/mquery-5.0.0.tgz",
"integrity": "sha512-iQMncpmEK8R8ncT8HJGsGc9Dsp8xcgYMVSbs5jgnm1lFHTZqMJTUWTDx1LBO8+mK3tPNZWFLBghQEIOULSTHZg==",
"license": "MIT",
"dependencies": {
"debug": "4.x"
},
"engines": {
"node": ">=14.0.0"
}
},
"node_modules/mquery/node_modules/debug": {
"version": "4.4.0",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.4.0.tgz",
"integrity": "sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==",
"license": "MIT",
"dependencies": {
"ms": "^2.1.3"
},
"engines": {
"node": ">=6.0"
},
"peerDependenciesMeta": {
"supports-color": {
"optional": true
}
}
},
"node_modules/mquery/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==",
"license": "MIT"
},
"node_modules/ms": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
@@ -1008,6 +1232,15 @@
"node": ">= 0.8"
}
},
"node_modules/on-headers": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/on-headers/-/on-headers-1.0.2.tgz",
"integrity": "sha512-pZAE+FJLoyITytdqK0U5s+FIpjN0JP3OzFi/u8Rx+EV5/W+JTWGXG8xFzevE7AjBfDqHv/8vL8qQsIhHnqRkrA==",
"license": "MIT",
"engines": {
"node": ">= 0.8"
}
},
"node_modules/opts": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/opts/-/opts-2.0.2.tgz",
@@ -1063,6 +1296,15 @@
"dev": true,
"license": "MIT"
},
"node_modules/punycode": {
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz",
"integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==",
"license": "MIT",
"engines": {
"node": ">=6"
}
},
"node_modules/qs": {
"version": "6.13.0",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.13.0.tgz",
@@ -1286,6 +1528,12 @@
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/sift": {
"version": "17.1.3",
"resolved": "https://registry.npmjs.org/sift/-/sift-17.1.3.tgz",
"integrity": "sha512-Rtlj66/b0ICeFzYTuNvX/EF1igRbbnGSvEyT79McoZa/DeGhMyC5pWKOEsZKnpkqtSeovd5FL/bjHWC3CIIvCQ==",
"license": "MIT"
},
"node_modules/simple-update-notifier": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/simple-update-notifier/-/simple-update-notifier-2.0.0.tgz",
@@ -1299,6 +1547,15 @@
"node": ">=10"
}
},
"node_modules/sparse-bitfield": {
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/sparse-bitfield/-/sparse-bitfield-3.0.3.tgz",
"integrity": "sha512-kvzhi7vqKTfkh0PZU+2D2PIllw2ymqJKujUcyPMd9Y75Nv4nPbGJZXNhxsgdQab2BmlDct1YnfQCguEvHr7VsQ==",
"license": "MIT",
"dependencies": {
"memory-pager": "^1.0.2"
}
},
"node_modules/statuses": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz",
@@ -1352,6 +1609,18 @@
"nodetouch": "bin/nodetouch.js"
}
},
"node_modules/tr46": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/tr46/-/tr46-5.0.0.tgz",
"integrity": "sha512-tk2G5R2KRwBd+ZN0zaEXpmzdKyOYksXwywulIX95MBODjSzMIuQnQ3m8JxgbhnL1LeVo7lqQKsYa1O3Htl7K5g==",
"license": "MIT",
"dependencies": {
"punycode": "^2.3.1"
},
"engines": {
"node": ">=18"
}
},
"node_modules/type-is": {
"version": "1.6.18",
"resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz",
@@ -1399,6 +1668,28 @@
"node": ">= 0.8"
}
},
"node_modules/webidl-conversions": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz",
"integrity": "sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==",
"license": "BSD-2-Clause",
"engines": {
"node": ">=12"
}
},
"node_modules/whatwg-url": {
"version": "14.1.0",
"resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-14.1.0.tgz",
"integrity": "sha512-jlf/foYIKywAt3x/XWKZ/3rz8OSJPiWktjmk891alJUEjiVxKX9LEO92qH3hv4aJ0mN3MWPvGMCy8jQi95xK4w==",
"license": "MIT",
"dependencies": {
"tr46": "^5.0.0",
"webidl-conversions": "^7.0.0"
},
"engines": {
"node": ">=18"
}
},
"node_modules/ws": {
"version": "7.5.10",
"resolved": "https://registry.npmjs.org/ws/-/ws-7.5.10.tgz",

View File

@@ -11,7 +11,9 @@
"dependencies": {
"dotenv": "^16.4.7",
"ejs": "^3.1.10",
"express": "^4.21.2"
"express": "^4.21.2",
"mongoose": "^8.9.5",
"morgan": "^1.10.0"
},
"devDependencies": {
"connect-livereload": "^0.6.1",

View File

@@ -0,0 +1,33 @@
const mongoose = require("mongoose");
const connectDB = async () => {
try {
const conn = await mongoose.connect('mongodb://mongodb:27017/tombola', {
});
console.log(`MongoDB Connected: ${conn.connection.host}:${conn.connection.port}`);
// Get and log database stats
const dbStats = await conn.connection.db.stats();
console.log("Database Stats:", dbStats);
// Get and log all collections in the database
const collections = await conn.connection.db.collections();
if (collections.length > 0) {
console.log("Collections:");
collections.forEach(collection => {
console.log(collection.collectionName);
});
// Get and log the indexes of a specific collection (optional)
const collectionName = "collectionname"; // Replace with your collection name
const indexes = await conn.connection.db.collection(collectionName).indexes();
console.log(`Indexes in ${collectionName}:`);
console.log(indexes);
}
console.log("Finish Database Stats.");
} catch (error) {
console.error(error.message);
process.exit(1);
}
}
module.exports = connectDB;

12
src/models/users.js Normal file
View File

@@ -0,0 +1,12 @@
const mongoose = require('mongoose');
const Schema = mongoose.Schema;
const UserSchema = new Schema({
firstname: { type: String },
familyname: { type: String },
email: { type: String },
phonenumber: { type: String },
},
{
timestamps: true,
});
module.exports = mongoose.model('user', UserSchema, 'users');

View File

@@ -0,0 +1,15 @@
<!DOCTYPE html>
<html>
<head>
<title>Hacking Game...</title>
<link rel="stylesheet" href="/stylesheets/style.css">
</head>
<body>
<div class="container">
<h3>Placeholder...</h3>
</div>
</body>
</html>

View File

@@ -0,0 +1,19 @@
<!DOCTYPE html>
<html>
<head>
<title>Hacking Game...</title>
<link rel="stylesheet" href="/stylesheets/style.css">
</head>
<body>
<div class="container">
<img class="background-image" src="/pictures/background05.png">
<h3>
<span style="color: red">U</span>nlock the secu<span style="color: red">r</span>ed safe quick<span
style="color: red">l</span>y...
</h3>
</div>
</body>
</html>

View File

@@ -0,0 +1,21 @@
<!DOCTYPE html>
<html>
<head>
<title>Hacking Game...</title>
<link rel="stylesheet" href="/stylesheets/style.css">
</head>
<body>
<div class="container">
<img class="background-image" src="/pictures/background06.png">
<h3>Congratulations, you got the certificate!!!</h3>
<h4>
Find the hidden link to<a class="hidden_link" href="/4acd7872dbae41e89c548130f6dca980.html" target="_self">
</a>
continue...
</h4>
</div>
</body>
</html>

View File

@@ -1,3 +1,4 @@
<!DOCTYPE html>
<html>
<head>
@@ -6,47 +7,11 @@
</head>
<body>
<center><img class="background-image" src="./pictures/background01.png" usemap="#no">
<div class="container">
<img class="background-image" src="./pictures/background01.png" usemap="#no">
<h3>Enter the door...</h3><map name="no"><area shape="rect" coords="501,158,634,380" alt="Test"
href="./userpass.html"></map>
</center>
<style>
.tb_button {
padding: 1px;
cursor: pointer;
border-right: 1px solid #8b8b8b;
border-left: 1px solid #FFF;
border-bottom: 1px solid #fff;
}
.tb_button.hover {
border: 2px outset #def;
background-color: #f8f8f8 !important;
}
.ws_toolbar {
z-index: 100000
}
.ws_toolbar .ws_tb_btn {
cursor: pointer;
border: 1px solid #555;
padding: 3px
}
.tb_highlight {
background-color: yellow
}
.tb_hide {
visibility: hidden
}
.ws_toolbar img {
padding: 2px;
margin: 0px
}
</style>
</div>
</body>
</html>

View File

@@ -1,14 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Index.html</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<h1>Hiidfdcvdfsdgfthjhkjhhhhk</h1>
<img src="./images/free.png">
</body>
</html>

View File

@@ -1,3 +1,4 @@
<!DOCTYPE html>
<html>
<head>
@@ -6,7 +7,7 @@
</head>
<body>
<center>
<div class="container">
<form id="math-form">
<div class="math-div"><img class="math-image" src="./pictures/background04.png"><input class="math-mask"
type="text" id="nullstelle" name="nullstelle"><button id="abgeben-button"
@@ -15,7 +16,6 @@
</div>
<h3>Solve the task...</h3>
</form>
</center>
<script>checkInput = function (nullstelle) {
nullstelle = btoa(nullstelle);
if (nullstelle == "MA==") {
@@ -31,7 +31,7 @@
if (checkInput(nullstelle)) {
document.getElementById("wrong-solution").classList.add("hidden");
document.getElementById("wrong-solution").classList.remove("visible");
window.location.href = "/access/false/safebox";
window.location.href = "/access/false/safebox.html";
}
else {
document.getElementById("nullstelle").focus();
@@ -39,43 +39,7 @@
document.getElementById("wrong-solution").classList.add("visible");
}
});</script>
<style>
.tb_button {
padding: 1px;
cursor: pointer;
border-right: 1px solid #8b8b8b;
border-left: 1px solid #FFF;
border-bottom: 1px solid #fff;
}
.tb_button.hover {
border: 2px outset #def;
background-color: #f8f8f8 !important;
}
.ws_toolbar {
z-index: 100000
}
.ws_toolbar .ws_tb_btn {
cursor: pointer;
border: 1px solid #555;
padding: 3px
}
.tb_highlight {
background-color: yellow
}
.tb_hide {
visibility: hidden
}
.ws_toolbar img {
padding: 2px;
margin: 0px
}
</style><span id="okta-plugin-message-channel-available" style="display: none;"></span>
</div>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 102 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

View File

@@ -1,3 +1,4 @@
<!DOCTYPE html>
<html>
<head>
@@ -6,7 +7,7 @@
</head>
<body>
<center>
<div class="container">
<div class="userdata-div"><img class="background-image" src="./pictures/background00.png">
<div class="typewriter" id="typewriter"><span class="type" style="--n:620">Your goal in this small hacker game is
to enroll in university. You start as a student and all you have to do is pass your final math exam. To make
@@ -18,44 +19,7 @@
</div><a href="/enter_school.html">
<h3>Start your task and good luck...</h3>
</a>
</center>
<style>
.tb_button {
padding: 1px;
cursor: pointer;
border-right: 1px solid #8b8b8b;
border-left: 1px solid #FFF;
border-bottom: 1px solid #fff;
}
.tb_button.hover {
border: 2px outset #def;
background-color: #f8f8f8 !important;
}
.ws_toolbar {
z-index: 100000
}
.ws_toolbar .ws_tb_btn {
cursor: pointer;
border: 1px solid #555;
padding: 3px
}
.tb_highlight {
background-color: yellow
}
.tb_hide {
visibility: hidden
}
.ws_toolbar img {
padding: 2px;
margin: 0px
}
</style>
</div>
</body>
</html>

View File

@@ -1,30 +1,24 @@
.h3
{
.h3 {
color: white;
}
h3:link
{
h3:link {
color: white;
}
h3:visited
{
h3:visited {
color: white;
}
h3:hover
{
h3:hover {
color: white;
}
h3:active
{
h3:active {
color: white;
}
h3:link
{
h3:link {
color: white;
}
@@ -33,6 +27,14 @@ body {
padding: 0px;
font: 26px "Lucida Grande", Helvetica, Arial, sans-serif;
color: white;
display: flex;
justify-content: center;
/* Centers horizontally */
align-items: center;
/* Centers vertically */
height: 100vh;
/* Ensures full height */
margin: 0;
}
a {
@@ -92,6 +94,7 @@ a {
position: absolute;
left: 566px;
top: 301px;
cursor: pointer;
}
.login-mask:focus {
@@ -108,16 +111,22 @@ a {
}
#user {
position: absolute; left: 320px; top: 154px;
position: absolute;
left: 320px;
top: 154px;
}
#password {
position: absolute; left: 319px; top: 246px;
position: absolute;
left: 319px;
top: 246px;
}
#credentials-error {
position: absolute; left: 315px; top: 300px;
position: absolute;
left: 315px;
top: 300px;
color: #36cb09;
}
@@ -126,6 +135,7 @@ a {
display: inline-block;
width: 960px;
}
.math-mask {
border: none;
margin: 0;
@@ -153,6 +163,7 @@ a {
position: absolute;
left: 529px;
top: 405px;
cursor: pointer;
}
#wrong-solution {
@@ -164,36 +175,32 @@ a {
}
#nullstelle {
position: absolute; left: 446px; top: 346px;
position: absolute;
left: 446px;
top: 346px;
}
.hidden_content
{
.hidden_content {
color: black;
}
.hidden_link:link
{
.hidden_link:link {
color: black;
}
.hidden_link:visited
{
.hidden_link:visited {
color: black;
}
.hidden_link:hover
{
.hidden_link:hover {
color: black;
}
.hidden_link:active
{
.hidden_link:active {
color: black;
}
.hidden_link:link
{
.hidden_link:link {
color: black;
}
@@ -203,8 +210,7 @@ a {
width: 960px;
}
.userdata-mask
{
.userdata-mask {
margin: 0;
padding-inline: 5px;
background: #FFFFFF;
@@ -213,8 +219,7 @@ a {
height: 22px;
}
.userdata-submit-mask
{
.userdata-submit-mask {
margin: 0;
padding-inline: 5px;
background: lightgrey;
@@ -223,60 +228,69 @@ a {
height: 24px;
}
.userdata-lable-mask
{
.userdata-lable-mask {
color: black;
font-size: small;
}
#firstname_label
{
position: absolute; left: 300px; top: 170px;
#firstname_label {
position: absolute;
left: 300px;
top: 170px;
}
#firstname
{
position: absolute; left: 300px; top: 200px;
#firstname {
position: absolute;
left: 300px;
top: 200px;
}
#familyname_label
{
position: absolute; left: 300px; top: 230px;
#familyname_label {
position: absolute;
left: 300px;
top: 230px;
}
#familyname
{
position: absolute; left: 300px; top: 260px;
#familyname {
position: absolute;
left: 300px;
top: 260px;
}
#email_label
{
position: absolute; left: 300px; top: 290px;
#email_label {
position: absolute;
left: 300px;
top: 290px;
}
#email
{
position: absolute; left: 300px; top: 320px;
#email {
position: absolute;
left: 300px;
top: 320px;
}
#phonenumber_label
{
position: absolute; left: 300px; top: 350px;
#phonenumber_label {
position: absolute;
left: 300px;
top: 350px;
}
#phonenumber
{
position: absolute; left: 300px; top: 380px;
#phonenumber {
position: absolute;
left: 300px;
top: 380px;
}
#submit_data
{
position: absolute; left: 300px; top: 440px;
#submit_data {
position: absolute;
left: 300px;
top: 440px;
}
#typewriter
{
position: absolute; left: 275px; top: 50px;
#typewriter {
position: absolute;
left: 275px;
top: 50px;
width: 410px;
text-align: left;
}
@@ -297,8 +311,13 @@ a {
}
@keyframes t {
from {background-size:0 200%}
from {
background-size: 0 200%
}
}
@keyframes b {
50% {background-position:0 -100%,0 0}
50% {
background-position: 0 -100%, 0 0
}
}

View File

@@ -1,3 +1,4 @@
<!DOCTYPE html>
<html>
<head>
@@ -5,8 +6,9 @@
<link rel="stylesheet" href="/stylesheets/style.css">
</head>
<body><audio src="/sounds/background-electro.mp3" autoplay="" loop=""></audio>
<center>
<body>
<audio src="./sounds/background-electro.mp3" autoplay loop></audio>
<div class="container">
<form id="login-form">
<div class="login-div"><img src="./pictures/background02.png"><img id="login-hint"
src="./pictures/background03-cropped.png" style="visibility: hidden;">
@@ -14,11 +16,10 @@
placeholder="Enter Username here..."><input class="login-mask" type="password" name="password"
id="password" placeholder="Enter Password here..."><button id="login-button"
type="submit">Ok!</button>
<div class="visible" id="credentials-error">Wrong credentials!</div>
<div class="hidden" id="credentials-error">Wrong credentials!</div>
</div>
<h3>Enter your credentials...</h3>
</form>
</center>
<script>checkCredentials = function (username, password) {
username = btoa(username);
password = btoa(password);
@@ -53,44 +54,8 @@
document.getElementById("login-hint-map").addEventListener("mouseout", function (event) {
document.getElementById("login-hint").style.visibility = "hidden";
});</script><span id="okta-plugin-message-channel-available" style="display: none;"></span>
<style>
.tb_button {
padding: 1px;
cursor: pointer;
border-right: 1px solid #8b8b8b;
border-left: 1px solid #FFF;
border-bottom: 1px solid #fff;
}
.tb_button.hover {
border: 2px outset #def;
background-color: #f8f8f8 !important;
}
.ws_toolbar {
z-index: 100000
}
.ws_toolbar .ws_tb_btn {
cursor: pointer;
border: 1px solid #555;
padding: 3px
}
.tb_highlight {
background-color: yellow
}
.tb_hide {
visibility: hidden
}
.ws_toolbar img {
padding: 2px;
margin: 0px
}
</style>
});</script>
</div>
</body>
</html>

View File

@@ -1,8 +1,10 @@
const express = require('express')
require('dotenv').config();
const path = require('path');
const morgan = require('morgan');
const livereload = require('livereload');
const connectLivereload = require('connect-livereload');
const connectDB = require('./middleware/database');
// Setup livereload
@@ -10,6 +12,10 @@ const liveReloadServer = livereload.createServer();
liveReloadServer.watch(__dirname + "public"); // Watch public directory
const app = express()
connectDB();
// Use morgan to log requests in 'combined' format (includes status code, method, URL, etc.)
app.use(morgan('combined'));
// Middleware to inject livereload script
app.use(connectLivereload());
@@ -27,5 +33,6 @@ app.get('/', (req, res) => {
res.render('index.ejs')
})
const port = process.env.PORT;
const port = process.env.PORT || 3000;;
app.listen(port, () => console.log("Server is running on http://localhost:%i", port));

View File

@@ -1 +1,16 @@
<!DOCTYPE html>
<html>
<head>
<title>Home Page</title>
<link rel="stylesheet" href="/stylesheets/style.css">
</head>
<body>
<div class="container">
<h1>Hi...</h1>
<a href="/start.html">Go to Start!!</a>
</div>
</body>
</html>