greptile 2.2.2 → 2.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/health-server.js +10 -6
- package/package.json +1 -1
package/health-server.js
CHANGED
|
@@ -13,18 +13,22 @@ const SELF_CHECK_INTERVAL_MS = 30_000
|
|
|
13
13
|
function selfCheck() {
|
|
14
14
|
if (!fs.existsSync(PACKAGE_MARKER)) {
|
|
15
15
|
console.log('Package uninstalled — cleaning up and exiting.')
|
|
16
|
-
const plistPath = path.join(
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
try { fs.unlinkSync(plistPath) } catch {}
|
|
16
|
+
const plistPath = path.join(process.env.HOME || '', 'Library/LaunchAgents/com.greptile.health.plist')
|
|
17
|
+
try {
|
|
18
|
+
fs.unlinkSync(plistPath)
|
|
19
|
+
} catch {}
|
|
21
20
|
server.close()
|
|
22
21
|
process.exit(0)
|
|
23
22
|
}
|
|
24
23
|
}
|
|
25
24
|
|
|
25
|
+
const ALLOWED_ORIGINS = ['https://app.greptile.com', 'https://staging.greptile.com', 'http://localhost:3000']
|
|
26
|
+
|
|
26
27
|
const server = http.createServer((req, res) => {
|
|
27
|
-
|
|
28
|
+
const origin = req.headers.origin || ''
|
|
29
|
+
if (ALLOWED_ORIGINS.includes(origin)) {
|
|
30
|
+
res.setHeader('Access-Control-Allow-Origin', origin)
|
|
31
|
+
}
|
|
28
32
|
res.setHeader('Access-Control-Allow-Methods', 'GET, OPTIONS')
|
|
29
33
|
res.setHeader('Access-Control-Allow-Headers', 'Content-Type')
|
|
30
34
|
|