Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions certs/osm.growplus.asia/fullchain.pem
29 changes: 0 additions & 29 deletions certs/osm.growplus.asia/osm.growplus.asia-chain-only.pem

This file was deleted.

61 changes: 0 additions & 61 deletions certs/osm.growplus.asia/osm.growplus.asia-chain.pem

This file was deleted.

32 changes: 0 additions & 32 deletions certs/osm.growplus.asia/osm.growplus.asia-crt.pem

This file was deleted.

39 changes: 0 additions & 39 deletions certs/osm.growplus.asia/osm.growplus.asia-key.pem

This file was deleted.

1 change: 1 addition & 0 deletions certs/osm.growplus.asia/privkey.pem
9 changes: 3 additions & 6 deletions src/Server.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@ function safeReadFileSync(filePath) {
}

// Default certificate for SNI
const sniDefaultCert = safeReadFileSync(path.join(__dirname, '..', 'certs', 'osm.growplus.asia', 'osm.growplus.asia-crt.pem'));
const sniDefaultKey = safeReadFileSync(path.join(__dirname, '..', 'certs', 'osm.growplus.asia', 'osm.growplus.asia-key.pem'));
const sniDefaultChain = safeReadFileSync(path.join(__dirname, '..', 'certs', 'osm.growplus.asia', 'osm.growplus.asia-chain-only.pem'));
const sniDefaultCert = safeReadFileSync(path.join(__dirname, '..', 'certs', 'osm.growplus.asia', 'fullchain.pem'));
const sniDefaultKey = safeReadFileSync(path.join(__dirname, '..', 'certs', 'osm.growplus.asia', 'privkey.pem'));

/**
* SNI callback for dynamic certificate selection
Expand All @@ -26,16 +25,14 @@ const sniCallback = (serverName, callback) => {
console.log(`[SNI] Requested for: ${serverName}`);
let cert = sniDefaultCert;
let key = sniDefaultKey;
let ca = sniDefaultChain;

if (serverName === 'www.growtopia1.com' || serverName === 'www.growtopia2.com') {
cert = safeReadFileSync(path.join(__dirname, '..', 'certs', 'growtopia1.com', 'gt-crt.pem'));
key = safeReadFileSync(path.join(__dirname, '..', 'certs', 'growtopia1.com', 'gt-key.pem'));
ca = undefined;
}

try {
const context = tls.createSecureContext({ cert, key, ca });
const context = tls.createSecureContext({ cert, key });
callback(null, context);
} catch (err) {
console.error(`[SNI] Failed to create secure context for ${serverName}:`, err);
Expand Down
22 changes: 11 additions & 11 deletions src/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
},
"homepage": "https://github.com/GTPSHAX/growtopia-https#readme",
"dependencies": {
"compression": "^1.8.0",
"compression": "^1.8.1",
"ejs": "^3.1.10",
"express": "^4.21.2",
"express-rate-limit": "^7.5.0",
Expand Down