Skip to content

Commit d15f8c5

Browse files
authored
Merge branch 'gitroomhq:main' into main
2 parents f0cc9b5 + 43910d8 commit d15f8c5

File tree

70 files changed

+2829
-895
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+2829
-895
lines changed

.env.example

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
# Configuration reference: http://docs.postiz.com/configuration/reference
22

3-
# === Required Settings
3+
# === Required Settings
44
DATABASE_URL="postgresql://postiz-user:postiz-password@localhost:5432/postiz-db-local"
55
REDIS_URL="redis://localhost:6379"
66
JWT_SECRET="random string for your JWT secret, make it long"
7+
8+
# === This needs to be exactly the URL you're accessing Postiz on.
79
FRONTEND_URL="http://localhost:4200"
810
NEXT_PUBLIC_BACKEND_URL="http://localhost:3000"
911
BACKEND_INTERNAL_URL="http://localhost:3000"
@@ -77,6 +79,7 @@ MASTODON_CLIENT_SECRET=""
7779
OPENAI_API_KEY=""
7880
NEXT_PUBLIC_DISCORD_SUPPORT=""
7981
NEXT_PUBLIC_POLOTNO=""
82+
NOT_SECURED=false
8083

8184
# Payment settings
8285
FEE_AMOUNT=0.05

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ node_modules
1616
*.launch
1717
.settings/
1818
*.sublime-workspace
19+
.vscode/*
1920

2021
# IDE - VSCode
2122
.vscode/*

.vscode/extensions.json

-8
This file was deleted.

SECURITY.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ The Postiz app is committed to ensuring the security and integrity of our users'
99
If you discover a security vulnerability in the Postiz app, please report it to us privately via email to one of the maintainers:
1010

1111
* @nevo-david
12-
* @jamesread ([email](mailto:contact@jread.com))
13-
* @jonathan-irvin ([email](mailto:offendingcommit@gmail.com))
12+
* @egelhaus ([email](mailto:gelhausenno@outlook.de))
1413

1514
When reporting a security vulnerability, please provide as much detail as possible, including:
1615

apps/backend/src/api/api.module.ts

+2
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import { RootController } from '@gitroom/backend/api/routes/root.controller';
2828
import { TrackService } from '@gitroom/nestjs-libraries/track/track.service';
2929
import { ShortLinkService } from '@gitroom/nestjs-libraries/short-linking/short.link.service';
3030
import { Nowpayments } from '@gitroom/nestjs-libraries/crypto/nowpayments';
31+
import { WebhookController } from '@gitroom/backend/api/routes/webhooks.controller';
3132

3233
const authenticatedController = [
3334
UsersController,
@@ -42,6 +43,7 @@ const authenticatedController = [
4243
MessagesController,
4344
CopilotController,
4445
AgenciesController,
46+
WebhookController,
4547
];
4648
@Module({
4749
imports: [

apps/backend/src/api/routes/auth.controller.ts

+72-18
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ export class AuthController {
2828
private _authService: AuthService,
2929
private _emailService: EmailService
3030
) {}
31+
32+
@Get('/can-register')
33+
async canRegister() {
34+
return { register: await this._authService.canRegister() };
35+
}
36+
3137
@Post('/register')
3238
async register(
3339
@Req() req: Request,
@@ -60,20 +66,36 @@ export class AuthController {
6066

6167
response.cookie('auth', jwt, {
6268
domain: getCookieUrlFromDomain(process.env.FRONTEND_URL!),
63-
secure: true,
64-
httpOnly: true,
65-
sameSite: 'none',
69+
...(!process.env.NOT_SECURED
70+
? {
71+
secure: true,
72+
httpOnly: true,
73+
sameSite: 'none',
74+
}
75+
: {}),
6676
expires: new Date(Date.now() + 1000 * 60 * 60 * 24 * 365),
6777
});
6878

79+
if (process.env.NOT_SECURED) {
80+
response.header('auth', jwt);
81+
}
82+
6983
if (typeof addedOrg !== 'boolean' && addedOrg?.organizationId) {
7084
response.cookie('showorg', addedOrg.organizationId, {
7185
domain: getCookieUrlFromDomain(process.env.FRONTEND_URL!),
72-
secure: true,
73-
httpOnly: true,
74-
sameSite: 'none',
86+
...(!process.env.NOT_SECURED
87+
? {
88+
secure: true,
89+
httpOnly: true,
90+
sameSite: 'none',
91+
}
92+
: {}),
7593
expires: new Date(Date.now() + 1000 * 60 * 60 * 24 * 365),
7694
});
95+
96+
if (process.env.NOT_SECURED) {
97+
response.header('showorg', addedOrg.organizationId);
98+
}
7799
}
78100

79101
response.header('onboarding', 'true');
@@ -108,20 +130,36 @@ export class AuthController {
108130

109131
response.cookie('auth', jwt, {
110132
domain: getCookieUrlFromDomain(process.env.FRONTEND_URL!),
111-
secure: true,
112-
httpOnly: true,
113-
sameSite: 'none',
133+
...(!process.env.NOT_SECURED
134+
? {
135+
secure: true,
136+
httpOnly: true,
137+
sameSite: 'none',
138+
}
139+
: {}),
114140
expires: new Date(Date.now() + 1000 * 60 * 60 * 24 * 365),
115141
});
116142

143+
if (process.env.NOT_SECURED) {
144+
response.header('auth', jwt);
145+
}
146+
117147
if (typeof addedOrg !== 'boolean' && addedOrg?.organizationId) {
118148
response.cookie('showorg', addedOrg.organizationId, {
119149
domain: getCookieUrlFromDomain(process.env.FRONTEND_URL!),
120-
secure: true,
121-
httpOnly: true,
122-
sameSite: 'none',
150+
...(!process.env.NOT_SECURED
151+
? {
152+
secure: true,
153+
httpOnly: true,
154+
sameSite: 'none',
155+
}
156+
: {}),
123157
expires: new Date(Date.now() + 1000 * 60 * 60 * 24 * 365),
124158
});
159+
160+
if (process.env.NOT_SECURED) {
161+
response.header('showorg', addedOrg.organizationId);
162+
}
125163
}
126164

127165
response.header('reload', 'true');
@@ -172,12 +210,20 @@ export class AuthController {
172210

173211
response.cookie('auth', activate, {
174212
domain: getCookieUrlFromDomain(process.env.FRONTEND_URL!),
175-
secure: true,
176-
httpOnly: true,
177-
sameSite: 'none',
213+
...(!process.env.NOT_SECURED
214+
? {
215+
secure: true,
216+
httpOnly: true,
217+
sameSite: 'none',
218+
}
219+
: {}),
178220
expires: new Date(Date.now() + 1000 * 60 * 60 * 24 * 365),
179221
});
180222

223+
if (process.env.NOT_SECURED) {
224+
response.header('auth', activate);
225+
}
226+
181227
response.header('onboarding', 'true');
182228
return response.status(200).send({ can: true });
183229
}
@@ -195,12 +241,20 @@ export class AuthController {
195241

196242
response.cookie('auth', jwt, {
197243
domain: getCookieUrlFromDomain(process.env.FRONTEND_URL!),
198-
secure: true,
199-
httpOnly: true,
200-
sameSite: 'none',
244+
...(!process.env.NOT_SECURED
245+
? {
246+
secure: true,
247+
httpOnly: true,
248+
sameSite: 'none',
249+
}
250+
: {}),
201251
expires: new Date(Date.now() + 1000 * 60 * 60 * 24 * 365),
202252
});
203253

254+
if (process.env.NOT_SECURED) {
255+
response.header('auth', jwt);
256+
}
257+
204258
response.header('reload', 'true');
205259

206260
response.status(200).json({

apps/backend/src/api/routes/integrations.controller.ts

+32-27
Original file line numberDiff line numberDiff line change
@@ -86,30 +86,37 @@ export class IntegrationsController {
8686
@Get('/list')
8787
async getIntegrationList(@GetOrgFromRequest() org: Organization) {
8888
return {
89-
integrations: (
90-
await this._integrationService.getIntegrationsList(org.id)
91-
).map((p) => {
92-
const findIntegration = this._integrationManager.getSocialIntegration(
93-
p.providerIdentifier
94-
);
95-
return {
96-
name: p.name,
97-
id: p.id,
98-
internalId: p.internalId,
99-
disabled: p.disabled,
100-
picture: p.picture || '/no-picture.jpg',
101-
identifier: p.providerIdentifier,
102-
inBetweenSteps: p.inBetweenSteps,
103-
refreshNeeded: p.refreshNeeded,
104-
display: p.profile,
105-
type: p.type,
106-
time: JSON.parse(p.postingTimes),
107-
changeProfilePicture: !!findIntegration?.changeProfilePicture,
108-
changeNickName: !!findIntegration?.changeNickname,
109-
customer: p.customer,
110-
additionalSettings: p.additionalSettings || '[]',
111-
};
112-
}),
89+
integrations: await Promise.all(
90+
(await this._integrationService.getIntegrationsList(org.id)).map(
91+
async (p) => {
92+
const findIntegration =
93+
this._integrationManager.getSocialIntegration(
94+
p.providerIdentifier
95+
);
96+
return {
97+
name: p.name,
98+
id: p.id,
99+
internalId: p.internalId,
100+
disabled: p.disabled,
101+
picture: p.picture || '/no-picture.jpg',
102+
identifier: p.providerIdentifier,
103+
inBetweenSteps: p.inBetweenSteps,
104+
refreshNeeded: p.refreshNeeded,
105+
isCustomFields: !!findIntegration.customFields,
106+
...(findIntegration.customFields
107+
? { customFields: await findIntegration.customFields() }
108+
: {}),
109+
display: p.profile,
110+
type: p.type,
111+
time: JSON.parse(p.postingTimes),
112+
changeProfilePicture: !!findIntegration?.changeProfilePicture,
113+
changeNickName: !!findIntegration?.changeNickname,
114+
customer: p.customer,
115+
additionalSettings: p.additionalSettings || '[]',
116+
};
117+
}
118+
)
119+
),
113120
};
114121
}
115122

@@ -612,9 +619,7 @@ export class IntegrationsController {
612619
}
613620

614621
@Get('/telegram/updates')
615-
async getUpdates(
616-
@Query() query: { word: string; id?: number },
617-
) {
622+
async getUpdates(@Query() query: { word: string; id?: number }) {
618623
return new TelegramProvider().getBotId(query);
619624
}
620625
}

apps/backend/src/api/routes/public.controller.ts

+12-4
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,12 @@ export class PublicController {
101101
if (!req.cookies.track) {
102102
res.cookie('track', uniqueId, {
103103
domain: getCookieUrlFromDomain(process.env.FRONTEND_URL!),
104-
secure: true,
105-
httpOnly: true,
104+
...(!process.env.NOT_SECURED
105+
? {
106+
secure: true,
107+
httpOnly: true,
108+
}
109+
: {}),
106110
sameSite: 'none',
107111
expires: new Date(Date.now() + 1000 * 60 * 60 * 24 * 365),
108112
});
@@ -111,8 +115,12 @@ export class PublicController {
111115
if (body.fbclid && !req.cookies.fbclid) {
112116
res.cookie('fbclid', body.fbclid, {
113117
domain: getCookieUrlFromDomain(process.env.FRONTEND_URL!),
114-
secure: true,
115-
httpOnly: true,
118+
...(!process.env.NOT_SECURED
119+
? {
120+
secure: true,
121+
httpOnly: true,
122+
}
123+
: {}),
116124
sameSite: 'none',
117125
expires: new Date(Date.now() + 1000 * 60 * 60 * 24 * 365),
118126
});

0 commit comments

Comments
 (0)