feat: do not track in settings

This commit is contained in:
Andras Bacsai 2022-11-28 13:55:49 +01:00
parent a768ed718a
commit 5789aadb5c
7 changed files with 117 additions and 14 deletions

View File

@ -1,7 +1,11 @@
{
"watch": ["src"],
"ignore": ["src/**/*.test.ts"],
"watch": [
"src"
],
"ignore": [
"src/**/*.test.ts"
],
"ext": "ts,mjs,json,graphql",
"exec": "rimraf build && esbuild `find src \\( -name '*.ts' \\)` --minify=true --platform=node --outdir=build --format=cjs && node build",
"exec": "rimraf build && esbuild `find src \\( -name '*.ts' \\)` --platform=node --outdir=build --format=cjs && node build",
"legacyWatch": true
}

View File

@ -26,9 +26,11 @@
"@iarna/toml": "2.2.5",
"@ladjs/graceful": "3.0.2",
"@prisma/client": "4.6.1",
"@sentry/node": "7.21.1",
"@sentry/tracing": "7.21.1",
"axe": "11.0.0",
"bcryptjs": "2.4.3",
"bree": "9.1.2",
"axe":"11.0.0",
"cabin": "11.0.1",
"compare-versions": "5.0.1",
"csv-parse": "5.3.2",

View File

@ -19,7 +19,7 @@ import { verifyRemoteDockerEngineFn } from './routes/api/v1/destinations/handler
import { checkContainer } from './lib/docker';
import { migrateApplicationPersistentStorage, migrateServicesToNewTemplate } from './lib';
import { refreshTags, refreshTemplates } from './routes/api/v1/handlers';
import * as Sentry from '@sentry/node';
declare module 'fastify' {
interface FastifyInstance {
config: {
@ -36,7 +36,7 @@ declare module 'fastify' {
const port = isDev ? 3001 : 3000;
const host = '0.0.0.0';
const sentryDSN = 'https://409f09bcb7af47928d3e0f46b78987f3@o1082494.ingest.sentry.io/4504236622217216';
const sentryDSN = 'http://5c32291aa76244988b7a327c77f7588f@glitchtip.example.coolify.io/1';
(async () => {
const settings = await prisma.setting.findFirst()
@ -111,7 +111,6 @@ const sentryDSN = 'https://409f09bcb7af47928d3e0f46b78987f3@o1082494.ingest.sent
origin: isDev ? "*" : ''
}
})
// To detect allowed origins
// fastify.addHook('onRequest', async (request, reply) => {
// console.log(request.headers.host)
@ -259,12 +258,21 @@ async function initServer() {
} else {
await prisma.setting.update({ where: { id: '0' }, data: { sentryDSN } })
}
} else {
if (settings.sentryDSN !== sentryDSN) {
await prisma.setting.update({ where: { id: '0' }, data: { sentryDSN } })
}
}
// Initialize Sentry
Sentry.init({
dsn: sentryDSN,
environment: isDev ? 'development' : 'production',
release: version
});
} catch (error) {
console.log(error)
console.error(error)
}
try {
console.log(`[001] Initializing server...`);
await asyncExecShell(`docker network create --attachable coolify`);

View File

@ -54,6 +54,7 @@ export async function listAllSettings(request: FastifyRequest) {
export async function saveSettings(request: FastifyRequest<SaveSettings>, reply: FastifyReply) {
try {
const {
doNotTrack,
fqdn,
isAPIDebuggingEnabled,
isRegistrationEnabled,
@ -68,7 +69,7 @@ export async function saveSettings(request: FastifyRequest<SaveSettings>, reply:
const { id } = await listSettings();
await prisma.setting.update({
where: { id },
data: { isRegistrationEnabled, dualCerts, isAutoUpdateEnabled, isDNSCheckEnabled, DNSServers, isAPIDebuggingEnabled, }
data: { doNotTrack, isRegistrationEnabled, dualCerts, isAutoUpdateEnabled, isDNSCheckEnabled, DNSServers, isAPIDebuggingEnabled, }
});
if (fqdn) {
await prisma.setting.update({ where: { id }, data: { fqdn } });

View File

@ -2,6 +2,7 @@ import { OnlyId } from "../../../../types"
export interface SaveSettings {
Body: {
doNotTrack: boolean,
fqdn: string,
isAPIDebuggingEnabled: boolean,
isRegistrationEnabled: boolean,

View File

@ -35,6 +35,7 @@
let minPort = settings.minPort;
let maxPort = settings.maxPort;
let proxyDefaultRedirect = settings.proxyDefaultRedirect;
let doNotTrack = settings.doNotTrack;
let forceSave = false;
let fqdn = settings.fqdn;
@ -117,6 +118,9 @@
async function changeSettings(name: any) {
try {
resetView();
if (name === 'doNotTrack') {
doNotTrack = !doNotTrack;
}
if (name === 'isRegistrationEnabled') {
isRegistrationEnabled = !isRegistrationEnabled;
}
@ -133,6 +137,7 @@
isAPIDebuggingEnabled = !isAPIDebuggingEnabled;
}
await post(`/settings`, {
doNotTrack,
isAPIDebuggingEnabled,
isRegistrationEnabled,
dualCerts,
@ -458,6 +463,15 @@
on:click={() => changeSettings('isAutoUpdateEnabled')}
/>
</div>
<div class="grid grid-cols-2 items-center">
<Setting
id="doNotTrack"
bind:setting={doNotTrack}
title="Do Not Track"
description="Do not send error reports to Coolify developers or any telemetry."
on:click={() => changeSettings('doNotTrack')}
/>
</div>
</div>
</div>
</form>

View File

@ -25,6 +25,8 @@ importers:
'@iarna/toml': 2.2.5
'@ladjs/graceful': 3.0.2
'@prisma/client': 4.6.1
'@sentry/node': 7.21.1
'@sentry/tracing': ^7.21.1
'@types/node': 18.11.9
'@types/node-os-utils': 1.3.0
'@typescript-eslint/eslint-plugin': 5.44.0
@ -83,6 +85,8 @@ importers:
'@iarna/toml': 2.2.5
'@ladjs/graceful': 3.0.2
'@prisma/client': 4.6.1_prisma@4.6.1
'@sentry/node': 7.21.1
'@sentry/tracing': 7.21.1
axe: 11.0.0
bcryptjs: 2.4.3
bree: 9.1.2
@ -538,6 +542,53 @@ packages:
requiresBuild: true
dev: false
/@sentry/core/7.21.1:
resolution: {integrity: sha512-Og5wEEsy24fNvT/T7IKjcV4EvVK5ryY2kxbJzKY6GU2eX+i+aBl+n/vp7U0Es351C/AlTkS+0NOUsp2TQQFxZA==}
engines: {node: '>=8'}
dependencies:
'@sentry/types': 7.21.1
'@sentry/utils': 7.21.1
tslib: 1.14.1
dev: false
/@sentry/node/7.21.1:
resolution: {integrity: sha512-B+p1nQHaFWdCCRVmvqlr/+vdQCI3mGLObucNfK2YC22IQZg7+3u6tEbxJ7umITIjeSSKgf7ZoZwCxL9VfkrNXg==}
engines: {node: '>=8'}
dependencies:
'@sentry/core': 7.21.1
'@sentry/types': 7.21.1
'@sentry/utils': 7.21.1
cookie: 0.4.2
https-proxy-agent: 5.0.1
lru_map: 0.3.3
tslib: 1.14.1
transitivePeerDependencies:
- supports-color
dev: false
/@sentry/tracing/7.21.1:
resolution: {integrity: sha512-b1BTPsRaNQpohzegoz59KGuBl+To651vEq0vMS4tCzSyIdxkYso3JCrjDdEqW/2MliQYANNVrUai2bmwmU9h1g==}
engines: {node: '>=8'}
dependencies:
'@sentry/core': 7.21.1
'@sentry/types': 7.21.1
'@sentry/utils': 7.21.1
tslib: 1.14.1
dev: false
/@sentry/types/7.21.1:
resolution: {integrity: sha512-3/IKnd52Ol21amQvI+kz+WB76s8/LR5YvFJzMgIoI2S8d82smIr253zGijRXxHPEif8kMLX4Yt+36VzrLxg6+A==}
engines: {node: '>=8'}
dev: false
/@sentry/utils/7.21.1:
resolution: {integrity: sha512-F0W0AAi8tgtTx6ApZRI2S9HbXEA9ENX1phTZgdNNWcMFm1BNbc21XEwLqwXBNjub5nlA6CE8xnjXRgdZKx4kzQ==}
engines: {node: '>=8'}
dependencies:
'@sentry/types': 7.21.1
tslib: 1.14.1
dev: false
/@sindresorhus/is/5.3.0:
resolution: {integrity: sha512-CX6t4SYQ37lzxicAqsBtxA3OseeoVrh9cSJ5PFYam0GksYlupRfy1A+Q4aYD3zvcfECLc0zO2u+ZnR2UYKvCrw==}
engines: {node: '>=14.16'}
@ -916,6 +967,15 @@ packages:
engines: {node: '>=0.4.0'}
hasBin: true
/agent-base/6.0.2:
resolution: {integrity: sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==}
engines: {node: '>= 6.0.0'}
dependencies:
debug: 4.3.4
transitivePeerDependencies:
- supports-color
dev: false
/aggregate-error/4.0.1:
resolution: {integrity: sha512-0poP0T7el6Vq3rstR8Mn4V/IQrpBLO6POkUSrN7RhyY+GF/InCFShQzsQ39T25gkHhLgSLByyAz+Kjb+c2L98w==}
engines: {node: '>=12'}
@ -3613,6 +3673,16 @@ packages:
resolve-alpn: 1.2.1
dev: false
/https-proxy-agent/5.0.1:
resolution: {integrity: sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==}
engines: {node: '>= 6'}
dependencies:
agent-base: 6.0.2
debug: 4.3.4
transitivePeerDependencies:
- supports-color
dev: false
/human-interval/2.0.1:
resolution: {integrity: sha512-r4Aotzf+OtKIGQCB3odUowy4GfUDTy3aTWTfLd7ZF2gBCy3XW3v/dJLRefZnOFFnjqs5B1TypvS8WarpBkYUNQ==}
dependencies:
@ -4261,6 +4331,10 @@ packages:
dependencies:
yallist: 4.0.0
/lru_map/0.3.3:
resolution: {integrity: sha512-Pn9cox5CsMYngeDbmChANltQl+5pi6XmTrraMSzhPmMBbmgcxmqWry0U3PGapCU1yB4/LqCcom7qhHZiF/jGfQ==}
dev: false
/magic-string/0.25.9:
resolution: {integrity: sha512-RmF0AsMzgt25qzqqLc1+MbHmhdx0ojF2Fvs4XnOqz2ZOBXzzkEwc/dJQZCYHAn7v1jbVOjAZfK8msRn4BxO4VQ==}
dependencies:
@ -6050,7 +6124,6 @@ packages:
/tslib/1.14.1:
resolution: {integrity: sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==}
dev: true
/tslib/2.4.1:
resolution: {integrity: sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA==}