Skip to content

Commit

Permalink
Merge branch 'main' into configuration-checking
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesread authored Sep 12, 2024
2 parents cd97d5a + 18f84df commit b7f8fac
Show file tree
Hide file tree
Showing 24 changed files with 6,898 additions and 6,444 deletions.
12 changes: 9 additions & 3 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
- **What kind of change does this PR introduce?** (Bug fix, feature, docs update, ...)
# What kind of change does this PR introduce?

- **Why was this change needed?** (You can also link to an open issue here)
eg: Bug fix, feature, docs update, ...

- **Other information**:
# Why was this change needed?

Please link to related issues when possible.

# Other information:

eg: Did you discuss this change with anybody before working on it (not required, but can be a good idea for bigger changes). Any plans for the future, etc?
6 changes: 6 additions & 0 deletions .github/workflows/build-containers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,11 @@ jobs:
docker tag localhost/postiz ghcr.io/gitroomhq/postiz-app:${{ env.DATE }}
docker push ghcr.io/gitroomhq/postiz-app:${{ env.DATE }}
docker tag ghcr.io/gitroomhq/postiz-app:${{ env.DATE }} ghcr.io/gitroomhq/postiz-app:latest
docker push ghcr.io/gitroomhq/postiz-app:latest
docker tag localhost/postiz-devcontainer ghcr.io/gitroomhq/postiz-devcontainer:${{ env.DATE }}
docker push ghcr.io/gitroomhq/postiz-devcontainer:${{ env.DATE }}
docker tag ghcr.io/gitroomhq/postiz-devcontainer:${{ env.DATE }} ghcr.io/gitroomhq/postiz-devcontainer:latest
docker push ghcr.io/gitroomhq/postiz-devcontainer:latest
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ testem.log
Thumbs.db

.nx/cache
.nx/workspace-data

# Next.js
.next
Expand Down
5 changes: 5 additions & 0 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ ENV NEXT_TELEMETRY_DISABLED=1
RUN apk add --no-cache \
bash=5.2.21-r0 \
supervisor=4.2.5-r4 \
pkgconfig \
gcc \
pixman-dev \
cairo-dev \
pango-dev \
make \
build-base

Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
<a href="https://x.com/intent/follow?screen_name=nevodavid" target="_blank">
<img alt="Follow me" src="https://github.com/user-attachments/assets/1562c93f-95c6-4307-8a85-e62003e26348" />
</a>
<br />

<a href="https://devfest.ai" target="_blank">
<img alt="DevFest" src="https://github.com/user-attachments/assets/cab9a4e5-e88e-4a28-be7d-28ed749e537a" width="850" />
</a>

<br /><br />
</p>

Expand Down
3 changes: 2 additions & 1 deletion apps/backend/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@
"executor": "@nx/js:node",
"defaultConfiguration": "development",
"options": {
"buildTarget": "backend:build"
"buildTarget": "backend:build",
"inspect": false
},
"configurations": {
"development": {
Expand Down
31 changes: 18 additions & 13 deletions apps/backend/src/api/routes/analytics.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,19 +82,21 @@ export class AnalyticsController {
const { accessToken, expiresIn, refreshToken } =
await integrationProvider.refreshToken(getIntegration.refreshToken!);

await this._integrationService.createOrUpdateIntegration(
getIntegration.organizationId,
getIntegration.name,
getIntegration.picture!,
'social',
getIntegration.internalId,
getIntegration.providerIdentifier,
accessToken,
refreshToken,
expiresIn
);
if (accessToken) {
await this._integrationService.createOrUpdateIntegration(
getIntegration.organizationId,
getIntegration.name,
getIntegration.picture!,
'social',
getIntegration.internalId,
getIntegration.providerIdentifier,
accessToken,
refreshToken,
expiresIn
);

getIntegration.token = accessToken;
getIntegration.token = accessToken;
}
}

const getIntegrationData = await ioRedis.get(
Expand Down Expand Up @@ -122,7 +124,10 @@ export class AnalyticsController {
return loadAnalytics;
} catch (e) {
if (e instanceof RefreshToken) {
await this._integrationService.disconnectChannel(org.id, getIntegration);
await this._integrationService.disconnectChannel(
org.id,
getIntegration
);
return [];
}
}
Expand Down
1 change: 1 addition & 0 deletions apps/commands/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"defaultConfiguration": "development",
"options": {
"buildTarget": "commands:build",
"inspect": false,
"command": "cd dist/apps/commands && node main.js"
},
"configurations": {
Expand Down
7 changes: 0 additions & 7 deletions apps/frontend/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,6 @@
"buildTarget": "frontend:build:production"
}
},
"test": {
"executor": "@nx/jest:jest",
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
"options": {
"jestConfig": "apps/frontend/jest.config.ts"
}
},
"lint": {
"executor": "@nx/eslint:lint",
"outputs": ["{options.outputFile}"]
Expand Down
4 changes: 2 additions & 2 deletions apps/frontend/src/components/launches/add.edit.model.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import { useExpend } from '@gitroom/frontend/components/launches/helpers/use.exp
import { TopTitle } from '@gitroom/frontend/components/launches/helpers/top.title.component';
import { PickPlatforms } from '@gitroom/frontend/components/launches/helpers/pick.platform.component';
import { ProvidersOptions } from '@gitroom/frontend/components/launches/providers.options';
import { v4 as uuidv4 } from 'uuid';
import useSWR from 'swr';
import { useToaster } from '@gitroom/react/toaster/toaster';
import { UpDownArrow } from '@gitroom/frontend/components/launches/up.down.arrow';
Expand All @@ -48,6 +47,7 @@ import { AddPostButton } from '@gitroom/frontend/components/launches/add.post.bu
import { useStateCallback } from '@gitroom/react/helpers/use.state.callback';
import { CopilotPopup } from '@copilotkit/react-ui';
import { useUser } from '@gitroom/frontend/components/layout/user.context';
import { makeId } from '@gitroom/nestjs-libraries/services/make.is';

export const AddEditModal: FC<{
date: dayjs.Dayjs;
Expand Down Expand Up @@ -319,7 +319,7 @@ export const AddEditModal: FC<{
}),
});

existingData.group = uuidv4();
existingData.group = makeId(10);

mutate();
toaster.show(
Expand Down
3 changes: 2 additions & 1 deletion apps/frontend/src/components/launches/calendar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ export const CalendarColumn: FC<{
const addProvider = useAddProvider();

return (
<div className="flex flex-col w-full min-h-full" ref={drop}>
<div className="flex flex-col w-full min-h-full" ref={drop as any}>
{display === 'month' && (
<div className={clsx('pt-[5px]', isBeforeNow && 'bg-customColor23')}>
{getDate.date()}
Expand Down Expand Up @@ -433,6 +433,7 @@ const CalendarItem: FC<{
);
return (
<div
// @ts-ignore
ref={dragRef}
onClick={editPost}
className={clsx(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ export const DatePicker: FC<{
input:
'bg-sixth h-[40px] border border-tableBorder text-textColor rounded-[4px] outline-none',
}}
placeholder="Pick time"
defaultValue={date.toDate()}
/>
<Button className="mt-[12px]" onClick={changeShow}>
Expand Down
1 change: 0 additions & 1 deletion apps/frontend/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
}
],
"types": [
"jest",
"node"
]
},
Expand Down
10 changes: 0 additions & 10 deletions apps/frontend/tsconfig.spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,5 @@
"jsx": "react"
},
"include": [
"jest.config.ts",
"src/**/*.test.ts",
"src/**/*.spec.ts",
"src/**/*.test.tsx",
"src/**/*.spec.tsx",
"src/**/*.test.js",
"src/**/*.spec.js",
"src/**/*.test.jsx",
"src/**/*.spec.jsx",
"src/**/*.d.ts"
]
}
3 changes: 2 additions & 1 deletion apps/workers/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
"executor": "@nx/js:node",
"defaultConfiguration": "development",
"options": {
"buildTarget": "workers:build"
"buildTarget": "workers:build",
"inspect": false
},
"configurations": {
"development": {
Expand Down
2 changes: 1 addition & 1 deletion libraries/helpers/src/utils/use.fire.events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {useCallback} from "react";

export const useFireEvents = () => {
const plausible = usePlausible();
return useCallback((name: string, props?: object) => {
return useCallback((name: string, props?: any) => {
plausible(name, {props});
}, []);
}
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,11 @@ export class PostsService {
`Error posting on ${firstPost.integration?.providerIdentifier} for ${firstPost?.integration?.name}`,
`An error occurred while posting on ${
firstPost.integration?.providerIdentifier
} ${!process.env.NODE_ENV || process.env.NODE_ENV === 'development' ? err : ''}`,
} ${
!process.env.NODE_ENV || process.env.NODE_ENV === 'development'
? err
: ''
}`,
true
);
}
Expand Down Expand Up @@ -390,8 +394,8 @@ export class PostsService {
}

if (
(body.type === 'schedule' || body.type === 'now') &&
dayjs(body.date).isAfter(dayjs())
body.type === 'now' ||
(body.type === 'schedule' && dayjs(body.date).isAfter(dayjs()))
) {
this._workerServiceProducer.emit('post', {
id: posts[0].id,
Expand Down Expand Up @@ -535,11 +539,7 @@ export class PostsService {
async generatePostsDraft(orgId: string, body: CreateGeneratedPostsDto) {
const getAllIntegrations = (
await this._integrationService.getIntegrationsList(orgId)
).filter(
(f) =>
!f.disabled &&
f.providerIdentifier !== 'reddit'
);
).filter((f) => !f.disabled && f.providerIdentifier !== 'reddit');

// const posts = chunk(body.posts, getAllIntegrations.length);
const allDates = dayjs()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ export class FacebookProvider extends SocialAbstract implements SocialProvider {
const since = dayjs().subtract(date, 'day').format('YYYY-MM-DD');

const { data } = await (
await fetch(
await this.fetch(
`https://graph.facebook.com/v20.0/${id}/insights?metric=page_impressions_unique,page_posts_impressions_unique,page_post_engagements,page_daily_follows,page_video_views&access_token=${accessToken}&period=day&since=${since}&until=${until}`
)
).json();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export class LinkedinPageProvider
override async refreshToken(
refresh_token: string
): Promise<AuthTokenDetails> {
const { access_token: accessToken, refresh_token: refreshToken } = await (
const { access_token: accessToken, expires_in, refresh_token: refreshToken } = await (
await fetch('https://www.linkedin.com/oauth/v2/accessToken', {
method: 'POST',
headers: {
Expand Down Expand Up @@ -68,6 +68,7 @@ export class LinkedinPageProvider
id,
accessToken,
refreshToken,
expiresIn: expires_in,
name,
picture,
username: vanityName,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {
AnalyticsData,
AuthTokenDetails,
PostDetails,
PostResponse,
Expand All @@ -19,7 +18,7 @@ export class LinkedinProvider extends SocialAbstract implements SocialProvider {
scopes = ['openid', 'profile', 'w_member_social', 'r_basicprofile'];

async refreshToken(refresh_token: string): Promise<AuthTokenDetails> {
const { access_token: accessToken, refresh_token: refreshToken } = await (
const { access_token: accessToken, refresh_token: refreshToken, expires_in } = await (
await this.fetch('https://www.linkedin.com/oauth/v2/accessToken', {
method: 'POST',
headers: {
Expand Down Expand Up @@ -58,6 +57,7 @@ export class LinkedinProvider extends SocialAbstract implements SocialProvider {
id,
accessToken,
refreshToken,
expiresIn: expires_in,
name,
picture,
username: vanityName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ export class XProvider extends SocialAbstract implements SocialProvider {
for (const post of postDetails) {
const media_ids = (uploadAll[post.id] || []).filter((f) => f);

// @ts-ignore
const { data }: { data: { id: string } } = await client.v2.tweet({
text: removeMd(post.message.replace('\n', '𝔫𝔢𝔴𝔩𝔦𝔫𝔢')).replace(
'𝔫𝔢𝔴𝔩𝔦𝔫𝔢',
Expand Down
Loading

0 comments on commit b7f8fac

Please sign in to comment.