forehalo
41bc683eed
fix(server): should update stripe customer email if changed ( #7181 )
2024-06-08 15:52:23 +00:00
forehalo
01fc1ea835
fix(server): selfhost fixes ( #7140 )
...
fixes #6708 , fixes #7139
2024-06-04 08:42:25 +00:00
forehalo
06534bbc06
chore(server): register user management resolver ( #7118 )
2024-06-03 06:52:19 +00:00
forehalo
c96fb46751
feat(core): adjust admin panel style ( #7116 )
2024-05-31 10:43:30 +00:00
forehalo
622239fd41
fix(server): runtime config overrides won't affect static startup ( #7110 )
2024-05-30 09:11:34 +00:00
forehalo
d853fc879d
fix(server): deal with nested optional modules ( #7101 )
2024-05-29 08:12:59 +00:00
forehalo
bffbb1ea9f
feat(server): add users management api ( #7092 )
2024-05-29 08:02:26 +00:00
forehalo
4b30fbc1e2
feat(server): add copilot prompts management api ( #7082 )
2024-05-28 13:14:17 +00:00
forehalo
638fc62601
feat(server): runtime setting support ( #5602 )
...
---
<details open="true"><summary>Generated summary (powered by <a href="https://app.graphite.dev ">Graphite</a>)</summary>
> ## TL;DR
> This pull request adds a new migration file, a new model, and new modules related to runtime settings. It also introduces a new `Runtime` service that allows getting, setting, and updating runtime configurations.
>
> ## What changed
> - Added a new migration file `migration.sql` that creates a table called `application_settings` with columns `key` and `value`.
> - Added a new model `ApplicationSetting` with properties `key` and `value`.
> - Added a new module `RuntimeSettingModule` that exports the `Runtime` service.
> - Added a new service `Runtime` that provides methods for getting, setting, and updating runtime configurations.
> - Modified the `app.module.ts` file to import the `RuntimeSettingModule`.
> - Modified the `index.ts` file in the `fundamentals` directory to export the `Runtime` service.
> - Added a new file `def.ts` in the `runtime` directory that defines the runtime configurations and provides a default implementation.
> - Added a new file `service.ts` in the `runtime` directory that implements the `Runtime` service.
>
> ## How to test
> 1. Run the migration script to create the `application_settings` table.
> 2. Use the `Runtime` service to get, set, and update runtime configurations.
> 3. Verify that the runtime configurations are stored correctly in the database and can be retrieved and modified using the `Runtime` service.
>
> ## Why make this change
> This change introduces a new feature related to runtime settings. The `Runtime` service allows the application to dynamically manage and modify runtime configurations without requiring a restart. This provides flexibility and allows for easier customization and configuration of the application.
</details>
2024-05-28 06:43:53 +00:00
forehalo
aff166a0ef
feat(server): add administrator feature ( #6995 )
2024-05-27 11:17:21 +00:00
forehalo
29e7fa1371
chore(server): cleanup expired sessions ( #7018 )
2024-05-22 03:31:41 +00:00
forehalo
7041991967
fix(server): allow promotion codes if no discount applied ( #6810 )
2024-05-07 07:44:41 +00:00
forehalo
d657f4091a
fix(server): do not allow registration through gql ( #6775 )
2024-05-06 11:11:57 +00:00
forehalo
3ee794a8f2
fix(server): do not throttle healthy checking api ( #6771 )
2024-05-06 06:59:50 +00:00
forehalo
cebb841430
feat(server): add flag to disable new sign ups ( #6752 )
2024-04-30 15:19:30 +00:00
forehalo
f566457dcf
test(server): payment tests ( #6737 )
2024-04-30 06:59:54 +00:00
forehalo
a14194c482
fix(server): blob controller permission ( #6746 )
2024-04-30 03:47:00 +00:00
forehalo
2c228a35f8
fix(server): stripe webhook calls in random order ( #6702 )
2024-04-25 12:22:07 +00:00
forehalo
3297486e31
fix(server): skip throttle for currentUser ( #6700 )
2024-04-25 09:45:31 +00:00
forehalo
a697ebe340
feat(core): orm ( #6536 )
2024-04-25 03:03:45 +00:00
forehalo
94de6f5853
fix(server): always return created timestamp of chat messages ( #6658 )
2024-04-22 08:39:42 +00:00
forehalo
e8bcb75602
fix(server): use post request to consume magic link token ( #6656 )
2024-04-22 07:15:26 +00:00
forehalo
098e717688
chore(server): remove useless free subscription enum ( #6634 )
2024-04-19 13:34:59 +00:00
forehalo
d9e6561762
feat(server): add created timestamp to history ( #6607 )
2024-04-18 07:06:47 +00:00
liuyi
07aeab6ac8
fix(server): app cannot start in graphql only flavor ( #6598 )
2024-04-17 18:29:04 +08:00
liuyi
e53d5e2e3d
chore(server): clean up throttler ( #6326 )
2024-04-17 16:32:26 +08:00
forehalo
651a99a48e
fix(server): avoid store unpaid subscriptions
2024-04-17 16:25:03 +08:00
liuyi
5b315bfc81
fix(server): only returns active subscriptions ( #6590 )
2024-04-17 16:19:34 +08:00
forehalo
ab17a05df3
fix(core): give page reference correct link ( #6587 )
2024-04-17 03:56:24 +00:00
forehalo
66a272fb8b
fix(core): unable to redirect to same origin paths ( #6586 )
2024-04-17 03:25:31 +00:00
forehalo
e1c292b8b5
feat(server): support registering ai early access users ( #6565 )
2024-04-16 13:54:08 +00:00
forehalo
b01a8bb2ab
fix(server): give s3 client a default request timeout ( #6483 )
2024-04-08 08:41:55 +00:00
liuyi
edef9b2735
fix(server): only auto apply coupon in pro subscription ( #6452 )
2024-04-03 17:13:18 +08:00
liuyi
6fa4b7da54
feat(core): avoid popup window being blocked ( #6451 )
2024-04-03 16:50:09 +08:00
forehalo
2dc628eca5
fix(server): doc cache makes publish mode updating failed ( #6444 )
2024-04-03 03:34:01 +00:00
forehalo
f69649c922
ci: separate image build to a standalone workflow ( #6167 )
2024-03-28 04:02:13 +00:00
forehalo
54c06777a6
fix(server): always set new session cookie ( #6323 )
2024-03-26 09:56:39 +00:00
forehalo
5637676222
fix(server): wrong import path ( #6317 )
2024-03-26 09:26:56 +00:00
liuyi
b8e6d7d6cb
chore(server): cache blob list result ( #6297 )
2024-03-26 14:23:47 +08:00
forehalo
1a1af83375
test(server): auth tests ( #6135 )
2024-03-26 02:24:17 +00:00
Brooooooklyn
10af0ab48d
feat(server): support ai plan ( #6216 )
2024-03-22 08:39:18 +00:00
Brooooooklyn
aecc523663
fix(server): avoid error when other prices added but logic is not released ( #6191 )
2024-03-22 08:39:12 +00:00
forehalo
540e456704
ci: set private key from env ( #6239 )
2024-03-21 10:09:26 +00:00
liuyi
4f5907766f
fix(server): decode uri component before verify token ( #6231 )
2024-03-20 18:17:11 +08:00
liuyi
06a5b2e5a5
fix(server): wrong google oauth param ( #6227 )
2024-03-20 17:45:22 +08:00
liuyi
797e3c5b35
fix(server): do not force sign in password length ( #6188 )
...
hotfix
2024-03-19 10:58:34 +08:00
liuyi
bba1a95f9c
chore: bump base version to 0.14.0 ( #6170 )
2024-03-19 02:34:18 +00:00
liuyi
4702c1a9ca
fix(server): inject correct locker to request scope mutex ( #6140 )
2024-03-19 02:16:35 +00:00
liuyi
a4cd8d6ca3
chore(server): organize server configs ( #6169 )
2024-03-19 02:05:56 +00:00
liuyi
a721b3887b
fix(server): hotfix auth & doc push ( #6168 )
2024-03-18 16:32:35 +08:00
liuyi
268ca03f62
fix(server): ensure selfhost admin created after all data migrated ( #6163 )
...
fix #6154
cp to canary
2024-03-18 11:43:12 +08:00
liuyi
e94be8968b
fix(server): hotfix ( #6161 )
2024-03-18 10:41:11 +08:00
liuyi
533c181640
feat(server): cleanup gateway code ( #6118 )
2024-03-15 02:00:40 +00:00
liuyi
79ffca314d
feat(server): allow prefetch doc stats before sync ( #6115 )
2024-03-14 17:34:33 +00:00
liuyi
c5d8c6cc8c
fix(server): blob api should be public ( #6109 )
2024-03-14 02:36:13 +00:00
liuyi
f2ec81b2d0
feat(server): user connected accounts migration ( #6103 )
2024-03-13 09:28:52 +00:00
liuyi
573528be41
fix(server): user can not signup through oauth if ever invited ( #6101 )
2024-03-13 07:50:11 +00:00
liuyi
73801ce864
fix(server): gql schema is outdated ( #6097 )
2024-03-13 04:11:44 +00:00
liuyi
495855cc07
fix(server): server info api should be public ( #6098 )
2024-03-13 03:59:26 +00:00
liuyi
d8f9e357d0
ci: proxy /oauth to server ( #6095 )
2024-03-13 02:33:58 +00:00
liuyi
fb3a0e7b8f
refactor(server): auth ( #5895 )
...
Remove `next-auth` and implement our own Authorization/Authentication system from scratch.
## Server
- [x] tokens
- [x] function
- [x] encryption
- [x] AuthController
- [x] /api/auth/sign-in
- [x] /api/auth/sign-out
- [x] /api/auth/session
- [x] /api/auth/session (WE SUPPORT MULTI-ACCOUNT!)
- [x] OAuthPlugin
- [x] OAuthController
- [x] /oauth/login
- [x] /oauth/callback
- [x] Providers
- [x] Google
- [x] GitHub
## Client
- [x] useSession
- [x] cloudSignIn
- [x] cloudSignOut
## NOTE:
Tests will be adding in the future
2024-03-12 10:00:09 +00:00
liuyi
af49e8cc41
ci: only enable jwst codec in canary ( #6081 )
2024-03-12 09:44:39 +00:00
liuyi
a38f7ee252
fix(server): sender passed to nextauth is never used ( #5938 )
2024-02-28 05:44:25 +00:00
liuyi
540d079308
ci: fix selfhost ( #5920 )
...
## **Type**
enhancement
___
## **Description**
- Introduced a new ESM module resolution setup using `ts-node` to enhance the development and deployment process.
- Implemented a dynamic loader script registration mechanism to facilitate ESM module loading.
- Simplified the predeploy script execution by refining environment variable handling and stdout configuration.
- Updated `package.json` to reflect changes in script commands for better ESM support and added necessary dependencies for `ts-node` and `typescript`.
___
## **Changes walkthrough**
<table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Enhancement</strong></td><td><table>
<tr>
<td>
<details>
<summary><strong>loader.js</strong><dd><code>Introduce ESM Module Resolution via ts-node</code> </dd></summary>
<hr>
packages/backend/server/scripts/loader.js
<li>Introduced <code>ts-node</code> configuration for ESM module resolution.<br> <li> Exported a <code>resolve</code> function for module resolution.<br>
</details>
</td>
<td><a href="https:/toeverything/AFFiNE/pull/5920/files#diff-9ed793897a493633028d510db0742ff38d2d86471c54b17513d4354c51597ef8">+11/-0</a> </td>
</tr>
<tr>
<td>
<details>
<summary><strong>register.js</strong><dd><code>Implement Dynamic Loader Script Registration</code> </dd></summary>
<hr>
packages/backend/server/scripts/register.js
<li>Implemented dynamic registration of the loader script.<br> <li> Utilized <code>node:module</code> and <code>node:url</code> for script registration.<br>
</details>
</td>
<td><a href="https:/toeverything/AFFiNE/pull/5920/files#diff-64831012a09f2bc4bc5a611ddb8e0871b0e83588de6c5d4f2f5cb1dae8fff244">+4/-0</a> </td>
</tr>
<tr>
<td>
<details>
<summary><strong>self-host-predeploy.js</strong><dd><code>Simplify Predeploy Script Execution</code> </dd></summary>
<hr>
packages/backend/server/scripts/self-host-predeploy.js
<li>Simplified environment variable passing to <code>execSync</code>.<br> <li> Changed stdout handling to inherit from the parent process.<br>
</details>
</td>
<td><a href="https:/toeverything/AFFiNE/pull/5920/files#diff-bd7b0be14c198018c21dadda6945a779c57d13e4c8584ee62da4baa99d370664">+3/-5</a> </td>
</tr>
<tr>
<td>
<details>
<summary><strong>package.json</strong><dd><code>Update Scripts and Dependencies for ESM Support</code> </dd></summary>
<hr>
packages/backend/server/package.json
<li>Updated script commands for ESM compatibility.<br> <li> Added <code>ts-node</code> and <code>typescript</code> dependencies.<br> <li> Removed redundant <code>--es-module-specifier-resolution=node</code> flags.<br>
</details>
</td>
<td><a href="https:/toeverything/AFFiNE/pull/5920/files#diff-a6530c6fe539aaa49ff0a7a80bc4362c1d95c419fdd19125415dcc869b31a443">+6/-6</a> </td>
</tr>
</table></td></tr></tr></tbody></table>
___
> ✨ **PR-Agent usage**:
>Comment `/help` on the PR to get a list of all available PR-Agent tools and their descriptions
2024-02-27 07:22:21 +00:00
liuyi
4d421a324f
refactor(server): import prisma from @prisma/client ( #5863 )
2024-02-22 07:46:57 +00:00
liuyi
85be45a79c
fix(core): window.open to a new origin will be blocked by browser ( #5856 )
2024-02-21 12:35:25 +00:00
liuyi
d2bf1451fa
ci: fix canary deployment ( #5851 )
2024-02-21 03:01:33 +00:00
liuyi
df157819dc
feat(server): allow customize mailer server ( #5835 )
2024-02-19 14:37:08 +00:00
liuyi
296d47f102
refactor(server): separate s3 & r2 storage to plugin ( #5805 )
2024-02-05 15:10:09 +00:00
liuyi
d9c2dc8dfb
fix(server): apply env overrides after all config merged ( #5795 )
2024-02-04 06:38:31 +00:00
liuyi
bef266ae3b
refactor(server): reorganize server configs ( #5753 )
2024-02-02 08:32:07 +00:00
liuyi
2f3c6f104e
fix(server): doc upsert without row lock ( #5765 )
2024-02-01 09:49:02 +00:00
liuyi
e3b8d0dba4
feat(server): allow pass coupon to checkout session ( #5749 )
2024-01-31 21:34:22 +08:00
liuyi
f1ccc504b5
fix(server): doc upsert race condition ( #5755 )
2024-01-31 21:13:29 +08:00
liuyi
26db1d436d
refactor(server): server errors ( #5741 )
...
standardize the error raising in both GraphQL Resolvers and Controllers.
Now, All user aware errors should be throwed with `HttpException`'s variants, for example `NotFoundException`.
> Directly throwing `GraphQLError` are forbidden.
The GraphQL errorFormatter will handle it automatically and set `code`, `status` in error extensions.
At the same time, the frontend `GraphQLError` should be imported from `@affine/graphql`, which introduce a better error extensions type.
----
controller example:
```js
@Get('/docs/${id}')
doc() {
// ...
// imported from '@nestjs/common'
throw new NotFoundException('Doc is not found.');
// ...
}
```
the above will response as:
```
status: 404 Not Found
{
"message": "Doc is not found.",
"statusCode": 404,
"error": "Not Found"
}
```
resolver example:
```js
@Mutation()
invite() {
// ...
throw new PayloadTooLargeException('Workspace seats is full.')
// ...
}
```
the above will response as:
```
status: 200 Ok
{
"data": null,
"errors": [
{
"message": "Workspace seats is full.",
"extensions": {
"code": 404,
"status": "Not Found"
}
}
]
}
```
for frontend GraphQLError user-friend, a helper function introduced:
```js
import { findGraphQLError } from '@affine/graphql'
fetch(query)
.catch(errOrArr => {
const e = findGraphQLError(errOrArr, e => e.extensions.code === 404)
if (e) {
// handle
}
})
```
2024-01-31 08:43:03 +00:00
liuyi
72d9cc1e5b
chore(storage): bump y-octo ( #5751 )
2024-01-31 06:54:33 +00:00
liuyi
db8e49b046
refactor(server): throw Unauthorized instead if user is not signed in ( #5746 )
2024-01-31 02:12:22 +00:00
liuyi
0f67c683c9
fix(server): add metrics missing attributes ( #5682 )
2024-01-24 08:06:34 +00:00
liuyi
151a53c575
fix(server): disable payment module requirements temporarily ( #5683 )
2024-01-24 03:17:21 +00:00
liuyi
62169c59c8
fix(server): del staled update count cache if unmatch ( #5674 )
2024-01-23 08:19:29 +00:00
liuyi
e516e0db23
refactor(server): plugin modules ( #5630 )
...
- [x] separates modules into `fundamental`, `core`, `plugins`
- [x] optional modules with `@OptionalModule` decorator to install modules with requirements met(`requires`, `if`)
- [x] `module.contributesTo` defines optional features that will be enabled if module registered
- [x] `AFFiNE.plugins.use('payment', {})` to enable a optional/plugin module
- [x] `PaymentModule` is the first plugin module
- [x] GraphQLSchema will not be generated for non-included modules
- [x] Frontend can use `ServerConfigType` query to detect which features are enabled
- [x] override existing provider globally
2024-01-22 07:40:28 +00:00
liuyi
9fdbb3ac3d
fix(server): should not listen on user defined host ( #5622 )
2024-01-18 04:59:53 +00:00
liuyi
f419867437
chore(server): remove useless log ( #5620 )
2024-01-18 03:19:20 +00:00
liuyi
d9324286d4
chore(server): add port to host if it is 0.0.0.0 ( #5619 )
2024-01-18 03:04:36 +00:00
liuyi
b9f20877d0
feat(core): make password sigin default if user has one ( #5577 )
2024-01-17 11:13:58 +00:00
liuyi
bf88b6edaa
chore(server): remove too verbose logs ( #5555 )
...
chore(server): remove too verbose logs
chore(server): make logs less verbose
2024-01-17 10:37:22 +00:00
liuyi
00acc49342
chore(server): remove octobase storage usage ( #5594 )
...
since all blobs have been successfully migrated to r2, the octobase blob functions are no longer necessary.
2024-01-17 10:22:35 +00:00
liuyi
75fb0a9f1a
fix(server): standalone early access users detection ( #5601 )
2024-01-16 03:27:44 +00:00
liuyi
24e18dd475
fix: improve self-host convenience ( #5582 )
2024-01-15 09:24:53 +00:00
liuyi
4c49b62ab7
fix(server): node imports order ( #5583 )
2024-01-14 05:47:56 +00:00
liuyi
89b5c96d25
refactor(server): folder structure ( #5573 )
2024-01-12 04:18:39 +00:00
liuyi
12fdb18a80
test(server): make server testing utils ( #5544 )
2024-01-11 06:40:55 +00:00
liuyi
9253e522aa
test(server): avoid progress get hold after tests finished ( #5522 )
2024-01-11 06:40:53 +00:00
liuyi
ddbb5e1121
fix(server): better error handling and logging for storage ( #5553 )
2024-01-09 10:37:24 +00:00
liuyi
d7b9462d1c
fix(server): backward compatibility for beta+stable envs ( #5510 )
2024-01-08 05:15:32 +00:00
liuyi
760d900f99
feat(server): blob data migration ( #5461 )
2024-01-03 10:56:57 +00:00
liuyi
0d34805375
refactor(server): use new storage providers ( #5433 )
2024-01-03 10:56:55 +00:00
liuyi
1eefd712dd
feat(server): new storage provider ( #5410 )
2024-01-02 07:21:01 +00:00
liuyi
abcca8b09e
refactor(server): object storages ( #5405 )
2024-01-02 07:01:25 +00:00
liuyi
797cd5c6eb
fix(server): avoid repeatly register providers ( #5265 )
2023-12-13 02:12:38 +00:00