Merge branch 'main' into configuration-checking

This commit is contained in:
James Read 2024-09-12 23:20:38 +01:00 committed by GitHub
commit 73be4e9bc4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
24 changed files with 6891 additions and 6437 deletions

View File

@ -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?

View File

@ -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
.gitignore vendored
View File

@ -39,6 +39,7 @@ testem.log
Thumbs.db
.nx/cache
.nx/workspace-data
# Next.js
.next

View File

@ -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

View File

@ -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>

View File

@ -37,7 +37,8 @@
"executor": "@nx/js:node",
"defaultConfiguration": "development",
"options": {
"buildTarget": "backend:build"
"buildTarget": "backend:build",
"inspect": false
},
"configurations": {
"development": {

View File

@ -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(
@ -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 [];
}
}

View File

@ -26,6 +26,7 @@
"defaultConfiguration": "development",
"options": {
"buildTarget": "commands:build",
"inspect": false,
"command": "cd dist/apps/commands && node main.js"
},
"configurations": {

View File

@ -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}"]

View File

@ -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';
@ -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;
@ -319,7 +319,7 @@ export const AddEditModal: FC<{
}),
});
existingData.group = uuidv4();
existingData.group = makeId(10);
mutate();
toaster.show(

View File

@ -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()}
@ -433,6 +433,7 @@ const CalendarItem: FC<{
);
return (
<div
// @ts-ignore
ref={dragRef}
onClick={editPost}
className={clsx(

View File

@ -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}>

View File

@ -17,7 +17,6 @@
}
],
"types": [
"jest",
"node"
]
},

View File

@ -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"
]
}

View File

@ -25,7 +25,8 @@
"executor": "@nx/js:node",
"defaultConfiguration": "development",
"options": {
"buildTarget": "workers:build"
"buildTarget": "workers:build",
"inspect": false
},
"configurations": {
"development": {

View File

@ -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});
}, []);
}

View File

@ -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
);
}
@ -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,
@ -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()

View File

@ -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();

View File

@ -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: {
@ -68,6 +68,7 @@ export class LinkedinPageProvider
id,
accessToken,
refreshToken,
expiresIn: expires_in,
name,
picture,
username: vanityName,

View File

@ -1,5 +1,4 @@
import {
AnalyticsData,
AuthTokenDetails,
PostDetails,
PostResponse,
@ -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: {
@ -58,6 +57,7 @@ export class LinkedinProvider extends SocialAbstract implements SocialProvider {
id,
accessToken,
refreshToken,
expiresIn: expires_in,
name,
picture,
username: vanityName,

View File

@ -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(
'𝔫𝔢𝔴𝔩𝔦𝔫𝔢',

90
migrations.json Normal file
View File

@ -0,0 +1,90 @@
{
"migrations": [
{
"version": "18.1.0-beta.3",
"description": "Moves affected.defaultBase to defaultBase in `nx.json`",
"implementation": "./src/migrations/update-17-2-0/move-default-base",
"package": "nx",
"name": "move-default-base-to-nx-json-root"
},
{
"cli": "nx",
"version": "19.2.0-beta.2",
"description": "Updates the default workspace data directory to .nx/workspace-data",
"implementation": "./src/migrations/update-19-2-0/move-workspace-data-directory",
"package": "nx",
"name": "19-2-0-move-graph-cache-directory"
},
{
"cli": "nx",
"version": "19.2.2-beta.0",
"description": "Updates the nx wrapper.",
"implementation": "./src/migrations/update-17-3-0/update-nxw",
"package": "nx",
"name": "19-2-2-update-nx-wrapper"
},
{
"version": "19.2.4-beta.0",
"description": "Set project name in nx.json explicitly",
"implementation": "./src/migrations/update-19-2-4/set-project-name",
"x-repair-skip": true,
"package": "nx",
"name": "19-2-4-set-project-name"
},
{
"cli": "nx",
"version": "19.1.0-beta.6",
"description": "Migrate no-extra-semi rules into user config, out of nx extendable configs",
"implementation": "./src/migrations/update-19-1-0-migrate-no-extra-semi/migrate-no-extra-semi",
"package": "@nx/eslint-plugin",
"name": "update-19-1-0-rename-no-extra-semi"
},
{
"cli": "nx",
"version": "19.6.3-beta.0",
"description": "Migrate proxy config files to match new format from webpack-dev-server v5.",
"implementation": "./src/migrations/update-19-6-3/proxy-config",
"package": "@nx/webpack",
"name": "update-19-6-3-proxy-config"
},
{
"version": "19.6.0-beta.0",
"description": "Add dependsOn: [build] to preview targets using preview-server",
"implementation": "./src/migrations/update-19-6-0/add-depends-on-for-preview",
"package": "@nx/vite",
"name": "update-19-6-0-add-depends-on-for-preview-server"
},
{
"cli": "nx",
"version": "18.1.1-beta.0",
"description": "Ensure targetDefaults inputs for task hashing when '@nx/webpack:webpack' is used are correct for Module Federation.",
"factory": "./src/migrations/update-18-1-1/fix-target-defaults-inputs",
"package": "@nx/react",
"name": "fix-target-defaults-for-webpack"
},
{
"cli": "nx",
"version": "19.6.0-beta.4",
"description": "Ensure Module Federation DTS is turned off by default.",
"factory": "./src/migrations/update-19-6-0/turn-off-dts-by-default",
"package": "@nx/react",
"name": "update-19-6-0-turn-module-federation-dts-off"
},
{
"cli": "nx",
"version": "19.6.0-beta.4",
"description": "Update the server file for Module Federation SSR port value to be the same as the 'serve' target port value.",
"factory": "./src/migrations/update-19-6-0/update-ssr-server-port",
"package": "@nx/react",
"name": "update-module-federation-ssr-server-file"
},
{
"cli": "nx",
"version": "19.6.1-beta.0",
"description": "Ensure Target Defaults are set correctly for Module Federation.",
"factory": "./src/migrations/update-19-6-1/ensure-depends-on-for-mf",
"package": "@nx/react",
"name": "update-19-6-1-ensure-module-federation-target-defaults"
}
]
}

13021
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -9,6 +9,7 @@
"dev": "npx nx run-many --target=serve --projects=frontend,backend,workers --parallel=4",
"dev:stripe": "npx concurrently \"stripe listen --forward-to localhost:3000/stripe\" \"npm run dev\"",
"build": "npx nx run-many --target=build --projects=frontend,backend,workers,cron",
"build:frontend": "npx nx run frontend:build:production",
"start:prod": "node dist/apps/backend/main.js",
"start:prod:frontend": "nx run frontend:serve:production",
"start:prod:workers": "node dist/apps/workers/main.js",
@ -38,7 +39,6 @@
"@mantine/dates": "^5.10.5",
"@mantine/hooks": "^5.10.5",
"@mantine/modals": "^5.10.5",
"@nestjs/cache-manager": "^2.2.1",
"@nestjs/common": "^10.0.2",
"@nestjs/core": "^10.0.2",
"@nestjs/microservices": "^10.3.1",
@ -46,10 +46,20 @@
"@nestjs/schedule": "^4.0.0",
"@nestjs/serve-static": "^4.0.1",
"@nestjs/swagger": "^7.3.0",
"@nx/eslint": "19.7.2",
"@nx/eslint-plugin": "19.7.2",
"@nx/jest": "19.7.2",
"@nx/js": "19.7.2",
"@nx/nest": "19.7.2",
"@nx/next": "19.7.2",
"@nx/node": "19.7.2",
"@nx/react": "19.7.2",
"@nx/vite": "19.7.2",
"@nx/webpack": "19.7.2",
"@nx/workspace": "19.7.2",
"@prisma/client": "^5.8.1",
"@swc/helpers": "~0.5.2",
"@swc/helpers": "0.5.13",
"@sweetalert2/theme-dark": "^5.0.16",
"@tanstack/react-virtual": "^3.1.3",
"@types/bcrypt": "^5.0.2",
"@types/concat-stream": "^2.0.3",
"@types/jsonwebtoken": "^9.0.5",
@ -63,7 +73,6 @@
"@types/yup": "^0.32.0",
"@uidotdev/usehooks": "^2.4.1",
"@uiw/react-md-editor": "^4.0.3",
"@uppy/aws-s3": "^3.3.0",
"@uppy/aws-s3-multipart": "^3.6.0",
"@uppy/core": "^3.5.0",
"@uppy/dashboard": "^3.5.2",
@ -71,13 +80,12 @@
"@uppy/file-input": "^3.0.3",
"@uppy/progress-bar": "^3.0.3",
"@uppy/react": "^3.1.3",
"@virtual-grid/react": "^2.0.2",
"array-move": "^4.0.0",
"axios": "1.6.7",
"bcrypt": "^5.1.1",
"bufferutil": "^4.0.8",
"bullmq": "^5.12.12",
"cache-manager-redis-store": "^2.0.0",
"canvas": "^2.11.2",
"chart.js": "^4.4.1",
"class-transformer": "^0.5.1",
"class-validator": "^0.14.1",
@ -93,26 +101,22 @@
"json-to-graphql-query": "^2.2.5",
"jsonwebtoken": "^9.0.2",
"lodash": "^4.17.21",
"lucide-react": "^0.436.0",
"md5": "^2.3.0",
"mime-types": "^2.1.35",
"multer": "^1.4.5-lts.1",
"nestjs-command": "^3.1.4",
"next": "^14.2.4",
"next": "14.2.3",
"next-plausible": "^3.12.0",
"nx": "19.7.2",
"openai": "^4.47.1",
"polotno": "^2.10.5",
"prisma-paginate": "^5.2.1",
"react": "18.2.0",
"react": "18.3.1",
"react-colorful": "^5.6.1",
"react-dnd": "^16.0.1",
"react-dnd-html5-backend": "^16.0.1",
"react-dom": "18.2.0",
"react-dom": "18.3.1",
"react-hook-form": "^7.50.1",
"react-loading": "^2.0.3",
"react-query": "^3.39.3",
"react-router-dom": "6.11.2",
"react-slider": "^2.0.6",
"react-tag-autocomplete": "^7.2.0",
"react-tooltip": "^5.26.2",
"react-use-keypress": "^1.3.1",
@ -127,10 +131,13 @@
"stripe": "^15.5.0",
"sweetalert2": "^11.6.13",
"swr": "^2.2.5",
"tailwind-scrollbar": "^3.1.0",
"tailwindcss": "3.4.3",
"tslib": "^2.3.0",
"twitter-api-v2": "^1.16.0",
"use-debounce": "^10.0.0",
"utf-8-validate": "^5.0.10",
"uuid": "^10.0.0",
"yargs": "^17.7.2",
"yup": "^1.4.0"
},
@ -138,67 +145,47 @@
"@mintlify/scraping": "^3.0.90",
"@nestjs/schematics": "^10.0.1",
"@nestjs/testing": "^10.0.2",
"@nx/eslint": "18.0.8",
"@nx/eslint-plugin": "18.0.8",
"@nx/jest": "18.0.8",
"@nx/js": "18.0.8",
"@nx/nest": "18.0.8",
"@nx/next": "18.0.8",
"@nx/node": "18.0.8",
"@nx/react": "18.0.8",
"@nx/vite": "18.0.8",
"@nx/webpack": "18.0.8",
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.7",
"@svgr/webpack": "^8.0.1",
"@swc-node/register": "~1.8.0",
"@swc/cli": "~0.1.62",
"@swc/core": "~1.3.85",
"@testing-library/react": "14.0.0",
"@swc-node/register": "1.9.2",
"@swc/cli": "0.3.14",
"@swc/core": "1.5.7",
"@testing-library/react": "15.0.6",
"@types/cache-manager-redis-store": "^2.0.4",
"@types/cookie-parser": "^1.4.6",
"@types/jest": "^29.4.0",
"@types/jest": "29.5.12",
"@types/node": "18.16.9",
"@types/react": "18.2.33",
"@types/react-dom": "18.2.14",
"@types/react": "18.3.1",
"@types/react-dom": "18.3.0",
"@types/uuid": "^9.0.8",
"@types/yargs": "^17.0.32",
"@typescript-eslint/eslint-plugin": "^6.13.2",
"@typescript-eslint/parser": "^6.13.2",
"@typescript-eslint/eslint-plugin": "7.18.0",
"@typescript-eslint/parser": "7.18.0",
"@vitejs/plugin-react": "^4.2.0",
"@vitest/coverage-v8": "1.3.1",
"@vitest/ui": "1.3.1",
"@vitest/coverage-v8": "1.6.0",
"@vitest/ui": "1.6.0",
"autoprefixer": "^10.4.17",
"babel-jest": "^29.4.1",
"eslint": "~8.48.0",
"eslint-config-next": "14.0.4",
"babel-jest": "29.7.0",
"eslint": "8.57.0",
"eslint-config-next": "14.2.3",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-import": "2.27.5",
"eslint-plugin-jsx-a11y": "6.7.1",
"eslint-plugin-react": "7.32.2",
"eslint-plugin-react-hooks": "4.6.0",
"jest": "^29.4.1",
"jest-environment-jsdom": "^29.4.1",
"jest": "29.7.0",
"jest-environment-jsdom": "29.7.0",
"jest-environment-node": "^29.4.1",
"jsdom": "~22.1.0",
"nx": "18.0.8",
"postcss": "^8.4.33",
"postcss": "8.4.38",
"prettier": "^2.6.2",
"prisma": "^5.8.1",
"react-refresh": "^0.10.0",
"sass": "1.62.1",
"tailwind-scrollbar": "^3.1.0",
"tailwindcss": "^3.4.1",
"ts-jest": "^29.1.0",
"ts-node": "10.9.1",
"typescript": "~5.3.2",
"url-loader": "^4.1.1",
"typescript": "5.5.4",
"vite": "^5.0.0",
"vitest": "1.3.1"
},
"nx": {
"includedScripts": []
},
"workspaces": [
"apps/*"
]
"vitest": "1.6.0"
}
}