Compare commits

...
Author SHA1 Message Date
StandardNotes CI fd0d08c153 chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].1
2024-03-14 15:03:24 +00:00
Aman Harwara adef74f23f chore: release [skip e2e] 2024-03-14 20:24:30 +05:30
Aman Harwara b90c725f96 chore: remove unused patch [skip e2] 2024-03-14 20:13:15 +05:30
Aman Harwara 74b459cae0 chore: update changelog [skip e2e] 2024-03-14 20:12:23 +05:30
Aman Harwara c1e9a7fe40 chore: revert changes [skip e2e] 2024-03-14 20:11:17 +05:30
Aman Harwara edf8de4468 Revert "chore: sync lexical with patch [skip e2e]"
This reverts commit 45c661c136.
2024-03-14 20:10:55 +05:30
Aman Harwara bb81c8acfc Revert "feat: Markdown text is now parsed correctly when pasted"
This reverts commit c5ca4a9857.
2024-03-14 20:10:35 +05:30
StandardNotes CI 414a2dda0b chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].0
2024-03-14 13:47:55 +00:00
Aman Harwara 45c661c136 chore: sync lexical with patch [skip e2e] 2024-03-14 19:09:00 +05:30
Aman Harwara c5ca4a9857 feat: Markdown text is now parsed correctly when pasted 2024-03-14 19:01:39 +05:30
StandardNotes CI 56813909bb chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].4
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].5
 - @standardnotes/[email protected]
2024-03-14 10:21:01 +00:00
Karol Sójkoandmoughxyz 7a4172ad11 chore: add e2e test for refresh tokens cooldown period - skip e2e (#2860)
* chore: add e2e test for refresh tokens cooldown period

* chore: fix refreshing session in e2e

* chore: fix session refresh cooldown test

* chore: fix e2e test

* Add dropped response simulation test

---------

Co-authored-by: moughxyz <[email protected]>
2024-03-14 11:11:17 +01:00
StandardNotes CI e97e788b5f chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].4
 - @standardnotes/[email protected]
2024-03-13 18:48:39 +00:00
Aman Harwara 20a9ef0dad chore: stable scrollbar gutters on windows [skip e2e] 2024-03-14 00:09:50 +05:30
Aman Harwara 670f27b9cd chore: update changelog [skip ci] 2024-03-12 19:41:34 +05:30
Aman Harwara f45d854006 chore: update changelog [skip e2e] 2024-03-12 19:34:38 +05:30
StandardNotes CI 5043b4c110 chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
2024-03-12 11:30:04 +00:00
Aman Harwara e1981f4eae chore: add "Clear formatting" option to text format menu and make selected options clearer by showing check if selected [skip e2e] 2024-03-12 16:51:08 +05:30
Aman Harwara 3fb6d10a7f chore: fix issue with super toolbar menu items not working on mobile [skip e2e] 2024-03-12 16:33:52 +05:30
StandardNotes CI 498cd1b27c chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
2024-03-11 19:25:47 +00:00
moughxyz 6d872cd45a fix: use API v0 for Android [skip e2e] 2024-03-11 14:15:15 -05:00
StandardNotes CI 9e2d496804 chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
2024-03-11 10:50:23 +00:00
Karol Sójko 7febc1fac6 chore: fix calling subscription settings endpoints - skip e2e 2024-03-11 11:40:58 +01:00
StandardNotes CI 6f571936c3 chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
2024-03-11 10:21:38 +00:00
Karol Sójko 065f3562f4 chore: fix muting sign in emails - skip e2e (#2859)
* chore: fix muting sign in emails - skip e2e

* chore: fix api version for e2e tests
2024-03-11 11:12:23 +01:00
StandardNotes CI 41f542d1c5 chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
2024-03-08 05:54:51 +00:00
Aman Harwara 94840a7afb chore: trigger release [skip e2e] 2024-03-08 11:15:18 +05:30
StandardNotes CI fb19b37d5b chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].3
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].3
 - @standardnotes/[email protected]
2024-03-07 15:40:21 +00:00
Mo 3b2f761661 fix: use API v0 on iOS (#2858) [skip e2e] 2024-03-07 09:29:46 -06:00
StandardNotes CI b28b59e4a0 chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
2024-03-07 12:38:06 +00:00
Karol Sójko 9238759d38 chore: add building web app image - skip e2e (#2857) 2024-03-07 13:28:13 +01:00
StandardNotes CI d2404ba276 chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].9
 - @standardnotes/[email protected]
2024-03-06 11:43:03 +00:00
Karol Sójko 7301acd36c chore: fix e2e tests for no cookie support setup - skip e2e 2024-03-06 12:33:30 +01:00
StandardNotes CI bf997e356c chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
2024-03-05 14:20:50 +00:00
Aman Harwara c151c3c6d7 chore: fix issue with sibling lists not being merged correctly in Super [skip e2e] 2024-03-05 19:39:49 +05:30
StandardNotes CI 6af7f66f46 chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].2
 - @standardnotes/[email protected].8
 - @standardnotes/[email protected].2
 - @standardnotes/[email protected]
2024-03-05 08:34:17 +00:00
Karol Sójko 1d0e8cfc7f chore: switch api to cookie based sessions - skip e2e (#2854)
* chore: switch api to cookie based sessions - skip e2e

* chore: fix legacy http service to include api version in requests - skip e2e
2024-03-05 09:25:53 +01:00
StandardNotes CI f3f5c63185 chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].7
 - @standardnotes/[email protected]
2024-03-01 13:51:47 +00:00
Karol Sójko 1651a24370 chore: replace sncrypto web with a published version - skip e2e 2024-03-01 14:41:58 +01:00
StandardNotes CI e6b6674407 chore(release): publish
- @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected]
 - @standardnotes/[email protected].6
 - @standardnotes/[email protected]
2024-03-01 13:21:26 +00:00
Karol Sójko 7aaa92ba57 chore: publish sncrypto web to npm - skip e2e 2024-03-01 14:12:53 +01:00
52 changed files with 981 additions and 71 deletions
+38
View File
@@ -103,6 +103,44 @@ jobs:
trigger_workflow: true
wait_workflow: true
publish-web-docker:
name: Build and publish Docker Image for Web App
needs: [e2e-base, e2e-vaults]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
token: ${{ secrets.CI_PAT_TOKEN }}
fetch-depth: 0
- name: Set up Node
uses: actions/setup-node@v3
with:
registry-url: 'https://registry.npmjs.org'
node-version-file: '.nvmrc'
cache: 'yarn'
- name: Install dependencies
run: yarn install --immutable
- name: Build
run: yarn build:web
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Publish SNJS Docker image for E2E testing
run: |
cd packages/web
docker build -t standardnotes/web:${{ github.sha }} .
docker tag standardnotes/web:${{ github.sha }} standardnotes/web:latest
docker push standardnotes/web:${{ github.sha }}
docker push standardnotes/web:latest
publish:
name: Publish to NPM
needs: [e2e-base, e2e-vaults]
+14
View File
@@ -3,6 +3,20 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.26.84](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-14)
**Note:** Version bump only for package @standardnotes/api
## [1.26.83](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-07)
### Bug Fixes
* use API v0 on iOS ([#2858](https://github.com/standardnotes/app/issues/2858)) [skip e2e] ([3b2f761](https://github.com/standardnotes/app/commit/3b2f76166126a5b11f35b64aacefa37618622c3d))
## [1.26.82](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-05)
**Note:** Version bump only for package @standardnotes/api
## [1.26.81](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-02-22)
**Note:** Version bump only for package @standardnotes/api
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@standardnotes/api",
"version": "1.26.81",
"version": "1.26.84",
"engines": {
"node": ">=16.0.0 <17.0.0"
},
@@ -1,3 +1,4 @@
export enum ApiVersion {
v0 = '20200115',
v1 = '20240226',
}
@@ -15,7 +15,10 @@ import { AuthApiServiceInterface } from './AuthApiServiceInterface'
export class AuthApiService implements AuthApiServiceInterface {
private operationsInProgress: Map<AuthApiOperations, boolean>
constructor(private authServer: AuthServerInterface) {
constructor(
private authServer: AuthServerInterface,
private apiVersion: ApiVersion,
) {
this.operationsInProgress = new Map()
}
@@ -50,7 +53,7 @@ export class AuthApiService implements AuthApiServiceInterface {
try {
const response = await this.authServer.recoveryKeyParams({
api_version: ApiVersion.v0,
api_version: this.apiVersion,
code_challenge: dto.codeChallenge,
recovery_codes: dto.recoveryCodes,
username: dto.username,
@@ -78,7 +81,7 @@ export class AuthApiService implements AuthApiServiceInterface {
try {
const response = await this.authServer.signInWithRecoveryCodes({
api_version: ApiVersion.v0,
api_version: this.apiVersion,
code_verifier: dto.codeVerifier,
password: dto.password,
recovery_codes: dto.recoveryCodes,
@@ -23,7 +23,10 @@ import { GetUserSubscriptionRequestParams } from '../../Request/Subscription/Get
export class SubscriptionApiService implements SubscriptionApiServiceInterface {
private operationsInProgress: Map<SubscriptionApiOperations, boolean>
constructor(private subscriptionServer: SubscriptionServerInterface) {
constructor(
private subscriptionServer: SubscriptionServerInterface,
private apiVersion: ApiVersion,
) {
this.operationsInProgress = new Map()
}
@@ -36,7 +39,7 @@ export class SubscriptionApiService implements SubscriptionApiServiceInterface {
try {
const response = await this.subscriptionServer.listInvites({
[ApiEndpointParam.ApiVersion]: ApiVersion.v0,
[ApiEndpointParam.ApiVersion]: this.apiVersion,
})
return response
@@ -56,7 +59,7 @@ export class SubscriptionApiService implements SubscriptionApiServiceInterface {
try {
const response = await this.subscriptionServer.cancelInvite({
[ApiEndpointParam.ApiVersion]: ApiVersion.v0,
[ApiEndpointParam.ApiVersion]: this.apiVersion,
inviteUuid,
})
@@ -77,7 +80,7 @@ export class SubscriptionApiService implements SubscriptionApiServiceInterface {
try {
const response = await this.subscriptionServer.invite({
[ApiEndpointParam.ApiVersion]: ApiVersion.v0,
[ApiEndpointParam.ApiVersion]: this.apiVersion,
identifier: inviteeEmail,
})
@@ -22,6 +22,7 @@ export class UserApiService implements UserApiServiceInterface {
constructor(
private userServer: UserServerInterface,
private userRequestServer: UserRequestServerInterface,
private apiVersion: ApiVersion,
) {
this.operationsInProgress = new Map()
}
@@ -72,7 +73,7 @@ export class UserApiService implements UserApiServiceInterface {
try {
const response = await this.userServer.register({
[ApiEndpointParam.ApiVersion]: ApiVersion.v0,
[ApiEndpointParam.ApiVersion]: this.apiVersion,
password: registerDTO.serverPassword,
email: registerDTO.email,
ephemeral: registerDTO.ephemeral,
@@ -92,7 +93,7 @@ export class UserApiService implements UserApiServiceInterface {
try {
const response = await this.userServer.update({
[ApiEndpointParam.ApiVersion]: ApiVersion.v0,
[ApiEndpointParam.ApiVersion]: this.apiVersion,
user_uuid: updateDTO.userUuid,
})
+46 -15
View File
@@ -1,6 +1,6 @@
import { LoggerInterface, joinPaths, sleep } from '@standardnotes/utils'
import { Environment } from '@standardnotes/models'
import { LegacySession, Session, SessionToken } from '@standardnotes/domain-core'
import { LegacySession, Result, Session, SessionToken } from '@standardnotes/domain-core'
import {
HttpStatusCode,
HttpRequestParams,
@@ -9,9 +9,11 @@ import {
HttpResponse,
HttpResponseMeta,
isErrorResponse,
ApiEndpointParam,
} from '@standardnotes/responses'
import { HttpServiceInterface } from './HttpServiceInterface'
import { ApiVersion } from '../Api'
import { Paths } from '../Server/Auth/Paths'
import { SessionRefreshResponseBody } from '../Response/Auth/SessionRefreshResponseBody'
import { FetchRequestHandler } from './FetchRequestHandler'
@@ -21,10 +23,11 @@ import { HttpRequestOptions } from './HttpRequestOptions'
export class HttpService implements HttpServiceInterface {
private session?: Session | LegacySession
private __latencySimulatorMs?: number
private __simulateNextSessionRefreshResponseDrop = false
private declare host: string
loggingEnabled = false
private inProgressRefreshSessionPromise?: Promise<boolean>
private inProgressRefreshSessionPromise?: Promise<Result<HttpResponse<SessionRefreshResponseBody>>>
private updateMetaCallback!: (meta: HttpResponseMeta) => void
private refreshSessionCallback!: (session: Session) => void
@@ -34,6 +37,7 @@ export class HttpService implements HttpServiceInterface {
private environment: Environment,
private appVersion: string,
private snjsVersion: string,
private apiVersion: ApiVersion,
private logger: LoggerInterface,
) {
this.requestHandler = new FetchRequestHandler(this.snjsVersion, this.appVersion, this.environment, this.logger)
@@ -145,6 +149,10 @@ export class HttpService implements HttpServiceInterface {
await sleep(this.__latencySimulatorMs, true)
}
httpRequest.params = httpRequest.params
? this.params(httpRequest.params as Record<string | number | symbol, unknown>)
: undefined
const isRefreshRequest = httpRequest.url === joinPaths(this.host, Paths.v1.refreshSession)
if (this.inProgressRefreshSessionPromise && !isRefreshRequest) {
await this.inProgressRefreshSessionPromise
@@ -166,12 +174,19 @@ export class HttpService implements HttpServiceInterface {
if (this.inProgressRefreshSessionPromise) {
await this.inProgressRefreshSessionPromise
} else {
this.inProgressRefreshSessionPromise = this.refreshSession()
const isSessionRefreshed = await this.inProgressRefreshSessionPromise
this.inProgressRefreshSessionPromise = undefined
const hasSessionTokenRenewedInBetweenOurRequest = httpRequest.authentication !== this.getSessionAccessToken()
if (!hasSessionTokenRenewedInBetweenOurRequest) {
this.inProgressRefreshSessionPromise = this.refreshSession()
const isSessionRefreshedResultOrError = await this.inProgressRefreshSessionPromise
let isSessionRefreshed = false
if (!isSessionRefreshedResultOrError.isFailed()) {
isSessionRefreshed = !isErrorResponse(isSessionRefreshedResultOrError.getValue())
}
this.inProgressRefreshSessionPromise = undefined
if (!isSessionRefreshed) {
return response
if (!isSessionRefreshed) {
return response
}
}
}
@@ -183,13 +198,13 @@ export class HttpService implements HttpServiceInterface {
return response
}
async refreshSession(): Promise<boolean> {
async refreshSession(): Promise<Result<HttpResponse<SessionRefreshResponseBody>>> {
if (!this.session) {
return false
return Result.fail('No session to refresh')
}
if (this.session instanceof LegacySession) {
return false
return Result.fail('Cannot refresh legacy session')
}
const response = await this.post<SessionRefreshResponseBody>(Paths.v1.refreshSession, {
@@ -197,8 +212,13 @@ export class HttpService implements HttpServiceInterface {
refresh_token: this.session.refreshToken.value,
})
if (this.__simulateNextSessionRefreshResponseDrop) {
this.__simulateNextSessionRefreshResponseDrop = false
return Result.fail('Simulating a dropped response')
}
if (isErrorResponse(response)) {
return false
return Result.ok(response)
}
if (response.meta) {
@@ -210,7 +230,7 @@ export class HttpService implements HttpServiceInterface {
response.data.session.access_expiration,
)
if (accessTokenOrError.isFailed()) {
return false
return Result.fail(accessTokenOrError.getError())
}
const accessToken = accessTokenOrError.getValue()
@@ -220,20 +240,31 @@ export class HttpService implements HttpServiceInterface {
response.data.session.refresh_expiration,
)
if (refreshTokenOrError.isFailed()) {
return false
return Result.fail(refreshTokenOrError.getError())
}
const refreshToken = refreshTokenOrError.getValue()
const sessionOrError = Session.create(accessToken, refreshToken, response.data.session.readonly_access)
if (sessionOrError.isFailed()) {
return false
return Result.fail(sessionOrError.getError())
}
this.setSession(sessionOrError.getValue())
this.refreshSessionCallback(this.session)
return true
return Result.ok(response)
}
private params(inParams: Record<string | number | symbol, unknown>): HttpRequestParams {
const params = {
...inParams,
...{
[ApiEndpointParam.ApiVersion]: this.apiVersion,
},
}
return params
}
}
@@ -1,7 +1,8 @@
import { LegacySession, Session } from '@standardnotes/domain-core'
import { LegacySession, Result, Session } from '@standardnotes/domain-core'
import { HttpRequest, HttpRequestParams, HttpResponse, HttpResponseMeta } from '@standardnotes/responses'
import { HttpRequestOptions } from './HttpRequestOptions'
import { SessionRefreshResponseBody } from '../Response'
export interface HttpServiceInterface {
setHost(host: string): void
@@ -16,7 +17,7 @@ export interface HttpServiceInterface {
runHttp<T>(httpRequest: HttpRequest): Promise<HttpResponse<T>>
setSession(session: Session | LegacySession): void
refreshSession(): Promise<boolean>
refreshSession(): Promise<Result<HttpResponse<SessionRefreshResponseBody>>>
setCallbacks(
updateMetaCallback: (meta: HttpResponseMeta) => void,
refreshSessionCallback: (session: Session) => void,
+64
View File
@@ -3,6 +3,70 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.1.438](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-14)
**Note:** Version bump only for package @standardnotes/clipper
## [1.1.437](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-14)
**Note:** Version bump only for package @standardnotes/clipper
## [1.1.436](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-14)
**Note:** Version bump only for package @standardnotes/clipper
## [1.1.435](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-13)
**Note:** Version bump only for package @standardnotes/clipper
## [1.1.434](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-12)
**Note:** Version bump only for package @standardnotes/clipper
## [1.1.433](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-11)
**Note:** Version bump only for package @standardnotes/clipper
## [1.1.432](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-11)
**Note:** Version bump only for package @standardnotes/clipper
## [1.1.431](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-11)
**Note:** Version bump only for package @standardnotes/clipper
## [1.1.430](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-08)
**Note:** Version bump only for package @standardnotes/clipper
## [1.1.429](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-07)
**Note:** Version bump only for package @standardnotes/clipper
## [1.1.428](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-07)
**Note:** Version bump only for package @standardnotes/clipper
## [1.1.427](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-06)
**Note:** Version bump only for package @standardnotes/clipper
## [1.1.426](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-05)
**Note:** Version bump only for package @standardnotes/clipper
## [1.1.425](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-05)
**Note:** Version bump only for package @standardnotes/clipper
## [1.1.424](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-01)
**Note:** Version bump only for package @standardnotes/clipper
## [1.1.423](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-01)
**Note:** Version bump only for package @standardnotes/clipper
## [1.1.422](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-01)
**Note:** Version bump only for package @standardnotes/clipper
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@standardnotes/clipper",
"description": "Web clipper browser extension for Standard Notes",
"version": "1.1.422",
"version": "1.1.438",
"private": true,
"scripts": {
"build-mv2": "yarn clean && webpack --config ./webpack.config.prod.js",
+64
View File
@@ -3,6 +3,70 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [3.110.40](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-14)
**Note:** Version bump only for package @standardnotes/desktop
## [3.110.39](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-14)
**Note:** Version bump only for package @standardnotes/desktop
## [3.110.38](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-14)
**Note:** Version bump only for package @standardnotes/desktop
## [3.110.37](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-13)
**Note:** Version bump only for package @standardnotes/desktop
## [3.110.36](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-12)
**Note:** Version bump only for package @standardnotes/desktop
## [3.110.35](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-11)
**Note:** Version bump only for package @standardnotes/desktop
## [3.110.34](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-11)
**Note:** Version bump only for package @standardnotes/desktop
## [3.110.33](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-11)
**Note:** Version bump only for package @standardnotes/desktop
## [3.110.32](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-08)
**Note:** Version bump only for package @standardnotes/desktop
## [3.110.31](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-07)
**Note:** Version bump only for package @standardnotes/desktop
## [3.110.30](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-07)
**Note:** Version bump only for package @standardnotes/desktop
## [3.110.29](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-06)
**Note:** Version bump only for package @standardnotes/desktop
## [3.110.28](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-05)
**Note:** Version bump only for package @standardnotes/desktop
## [3.110.27](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-05)
**Note:** Version bump only for package @standardnotes/desktop
## [3.110.26](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-01)
**Note:** Version bump only for package @standardnotes/desktop
## [3.110.25](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-01)
**Note:** Version bump only for package @standardnotes/desktop
## [3.110.24](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-01)
**Note:** Version bump only for package @standardnotes/desktop
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@standardnotes/desktop",
"main": "./app/dist/index.js",
"version": "3.110.24",
"version": "3.110.40",
"license": "AGPL-3.0",
"author": "Standard Notes.",
"private": true,
+66
View File
@@ -3,6 +3,72 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [3.58.97](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-14)
**Note:** Version bump only for package @standardnotes/mobile
## [3.58.96](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-14)
**Note:** Version bump only for package @standardnotes/mobile
## [3.58.95](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-14)
**Note:** Version bump only for package @standardnotes/mobile
## [3.58.94](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-13)
**Note:** Version bump only for package @standardnotes/mobile
## [3.58.93](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-12)
**Note:** Version bump only for package @standardnotes/mobile
## [3.58.92](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-11)
**Note:** Version bump only for package @standardnotes/mobile
## [3.58.91](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-11)
**Note:** Version bump only for package @standardnotes/mobile
## [3.58.90](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-11)
**Note:** Version bump only for package @standardnotes/mobile
## [3.58.89](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-08)
**Note:** Version bump only for package @standardnotes/mobile
## [3.58.88](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-07)
### Bug Fixes
* use API v0 on iOS ([#2858](https://github.com/standardnotes/app/issues/2858)) [skip e2e] ([3b2f761](https://github.com/standardnotes/app/commit/3b2f76166126a5b11f35b64aacefa37618622c3d))
## [3.58.87](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-07)
**Note:** Version bump only for package @standardnotes/mobile
## [3.58.86](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-06)
**Note:** Version bump only for package @standardnotes/mobile
## [3.58.85](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-05)
**Note:** Version bump only for package @standardnotes/mobile
## [3.58.84](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-05)
**Note:** Version bump only for package @standardnotes/mobile
## [3.58.83](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-01)
**Note:** Version bump only for package @standardnotes/mobile
## [3.58.82](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-01)
**Note:** Version bump only for package @standardnotes/mobile
## [3.58.81](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-01)
**Note:** Version bump only for package @standardnotes/mobile
+2 -2
View File
@@ -736,7 +736,7 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native/ReactCommon/yoga"
SPEC CHECKSUMS:
boost: 57d2868c099736d80fcd648bf211b4431e51a558
boost: a7c83b31436843459a1961bfd74b96033dc77234
CocoaAsyncSocket: 065fd1e645c7abab64f7a6a2007a48038fdc6a99
DoubleConversion: 5189b271737e1565bdce30deb4a08d647e3f5f54
FBLazyVector: 71803c074f6325f10b5ec891c443b6bbabef0ca7
@@ -756,7 +756,7 @@ SPEC CHECKSUMS:
MMKV: 9c6c3fa4ddd849f28c7b9a5c9d23aab84f14ee35
MMKVCore: 9bb7440b170181ac5b81f542ac258103542e693d
OpenSSL-Universal: ebc357f1e6bc71fa463ccb2fe676756aff50e88c
RCT-Folly: 424b8c9a7a0b9ab2886ffe9c3b041ef628fd4fb1
RCT-Folly: 0080d0a6ebf2577475bda044aa59e2ca1f909cda
RCTRequired: df81ab637d35fac9e6eb94611cfd20f0feb05455
RCTTypeSafety: 4636e4a36c7c2df332bda6d59b19b41c443d4287
React: e0cc5197a804031a6c53fb38483c3485fcb9d6f3
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@standardnotes/mobile",
"version": "3.58.81",
"version": "3.58.97",
"author": "Standard Notes.",
"private": true,
"license": "AGPL-3.0",
+64
View File
@@ -3,6 +3,70 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.4.733](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-14)
**Note:** Version bump only for package @standardnotes/releases
## [1.4.732](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-14)
**Note:** Version bump only for package @standardnotes/releases
## [1.4.731](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-14)
**Note:** Version bump only for package @standardnotes/releases
## [1.4.730](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-13)
**Note:** Version bump only for package @standardnotes/releases
## [1.4.729](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-12)
**Note:** Version bump only for package @standardnotes/releases
## [1.4.728](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-11)
**Note:** Version bump only for package @standardnotes/releases
## [1.4.727](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-11)
**Note:** Version bump only for package @standardnotes/releases
## [1.4.726](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-11)
**Note:** Version bump only for package @standardnotes/releases
## [1.4.725](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-08)
**Note:** Version bump only for package @standardnotes/releases
## [1.4.724](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-07)
**Note:** Version bump only for package @standardnotes/releases
## [1.4.723](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-07)
**Note:** Version bump only for package @standardnotes/releases
## [1.4.722](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-06)
**Note:** Version bump only for package @standardnotes/releases
## [1.4.721](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-05)
**Note:** Version bump only for package @standardnotes/releases
## [1.4.720](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-05)
**Note:** Version bump only for package @standardnotes/releases
## [1.4.719](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-01)
**Note:** Version bump only for package @standardnotes/releases
## [1.4.718](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-01)
**Note:** Version bump only for package @standardnotes/releases
## [1.4.717](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-01)
**Note:** Version bump only for package @standardnotes/releases
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@standardnotes/releases",
"version": "1.4.717",
"version": "1.4.733",
"license": "AGPL-3.0",
"main": "dist/releases.json",
"types": "dist/index.d.ts",
+14
View File
@@ -3,6 +3,20 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.70.4](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-14)
**Note:** Version bump only for package @standardnotes/services
## [1.70.3](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-07)
### Bug Fixes
* use API v0 on iOS ([#2858](https://github.com/standardnotes/app/issues/2858)) [skip e2e] ([3b2f761](https://github.com/standardnotes/app/commit/3b2f76166126a5b11f35b64aacefa37618622c3d))
## [1.70.2](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-05)
**Note:** Version bump only for package @standardnotes/services
## [1.70.1](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-02-22)
**Note:** Version bump only for package @standardnotes/services
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@standardnotes/services",
"version": "1.70.1",
"version": "1.70.4",
"engines": {
"node": ">=16.0.0 <17.0.0"
},
@@ -1,3 +1,4 @@
import { ApiVersion } from '@standardnotes/api'
import { Environment, Platform, ApplicationIdentifier } from '@standardnotes/models'
import { AlertService, DeviceInterface } from '@standardnotes/services'
import { PureCryptoInterface } from '@standardnotes/sncrypto-common'
@@ -39,4 +40,6 @@ export interface RequiredApplicationOptions {
* Version of client application.
*/
appVersion: string
apiVersion: ApiVersion
}
+4
View File
@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.14.11](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-01)
**Note:** Version bump only for package @standardnotes/sncrypto-web
## [1.14.10](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-11-23)
**Note:** Version bump only for package @standardnotes/sncrypto-web
+4 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@standardnotes/sncrypto-web",
"version": "1.14.10",
"version": "1.14.11",
"engines": {
"node": ">=16.0.0 <17.0.0"
},
@@ -13,7 +13,9 @@
"dist/**/*.d.ts"
],
"license": "AGPL-3.0",
"private": true,
"publishConfig": {
"access": "public"
},
"scripts": {
"clean": "rm -fr dist",
"prebuild": "yarn clean",
+34
View File
@@ -3,6 +3,40 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [2.208.13](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-14)
**Note:** Version bump only for package @standardnotes/snjs
## [2.208.12](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-11)
**Note:** Version bump only for package @standardnotes/snjs
## [2.208.11](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-11)
**Note:** Version bump only for package @standardnotes/snjs
## [2.208.10](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-07)
### Bug Fixes
* use API v0 on iOS ([#2858](https://github.com/standardnotes/app/issues/2858)) [skip e2e] ([3b2f761](https://github.com/standardnotes/app/commit/3b2f76166126a5b11f35b64aacefa37618622c3d))
## [2.208.9](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-06)
**Note:** Version bump only for package @standardnotes/snjs
## [2.208.8](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-05)
**Note:** Version bump only for package @standardnotes/snjs
## [2.208.7](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-01)
**Note:** Version bump only for package @standardnotes/snjs
## [2.208.6](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-01)
**Note:** Version bump only for package @standardnotes/snjs
## [2.208.5](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-01)
**Note:** Version bump only for package @standardnotes/snjs
-12
View File
@@ -3,22 +3,10 @@
/* Used for running mocha tests */
const connect = require('connect')
const serveStatic = require('serve-static')
const fs = require('fs')
const isDev = process.argv[2] === '--dev'
const port = isDev ? 9002 : 9001
const snCryptoDistFilePath = `${__dirname}/../sncrypto-web/dist/sncrypto-web.js`
if (!fs.existsSync(snCryptoDistFilePath)) {
console.error(
`Could not find sncrypto dist file under: ${snCryptoDistFilePath}. Please consider building the project first`,
)
process.exit(1)
}
fs.copyFileSync(snCryptoDistFilePath, `${__dirname}/mocha/vendor/sncrypto-web.js`)
connect()
.use(serveStatic(__dirname))
.listen(port, () => {
@@ -206,6 +206,7 @@ export class SNApplication implements ApplicationInterface, AppGroupManagedAppli
'identifier',
'defaultHost',
'appVersion',
'apiVersion',
]
for (const optionName of requiredOptions) {
@@ -1090,7 +1090,7 @@ export class Dependencies {
})
this.factory.set(TYPES.AuthApiService, () => {
return new AuthApiService(this.get<AuthServer>(TYPES.AuthServer))
return new AuthApiService(this.get<AuthServer>(TYPES.AuthServer), this.options.apiVersion)
})
this.factory.set(TYPES.AuthManager, () => {
@@ -1432,13 +1432,14 @@ export class Dependencies {
})
this.factory.set(TYPES.SubscriptionApiService, () => {
return new SubscriptionApiService(this.get<SubscriptionServer>(TYPES.SubscriptionServer))
return new SubscriptionApiService(this.get<SubscriptionServer>(TYPES.SubscriptionServer), this.options.apiVersion)
})
this.factory.set(TYPES.UserApiService, () => {
return new UserApiService(
this.get<UserServer>(TYPES.UserServer),
this.get<UserRequestServer>(TYPES.UserRequestServer),
this.options.apiVersion,
)
})
@@ -1542,6 +1543,7 @@ export class Dependencies {
this.options.environment,
this.options.appVersion,
SnjsVersion,
this.options.apiVersion,
this.get<Logger>(TYPES.Logger),
)
})
+27 -2
View File
@@ -81,7 +81,7 @@ import { Strings } from '@Lib/Strings'
import { AnyFeatureDescription } from '@standardnotes/features'
/** Legacy api version field to be specified in params when calling v0 APIs. */
const V0_API_VERSION = '20200115'
const V0_API_VERSION = '20240226'
type InvalidSessionObserver = (revoked: boolean) => void
@@ -408,7 +408,12 @@ export class LegacyApiService
}
}
async refreshSession(): Promise<HttpResponse<SessionRenewalResponse>> {
/**
* @deprecated
*
* This function should be replaced with @standardnotes/api's `HttpService::refreshSession` function.
*/
async deprecatedRefreshSessionOnlyUsedInE2eTests(): Promise<HttpResponse<SessionRenewalResponse>> {
const preprocessingError = this.preprocessingError()
if (preprocessingError) {
return preprocessingError
@@ -588,6 +593,26 @@ export class LegacyApiService
})
}
async updateSubscriptionSetting(
userUuid: UuidString,
settingName: string,
settingValue: string | null,
sensitive: boolean,
): Promise<HttpResponse<UpdateSettingResponse>> {
const params = {
name: settingName,
value: settingValue,
sensitive: sensitive,
}
return this.tokenRefreshableRequest<UpdateSettingResponse>({
verb: HttpVerb.Put,
url: joinPaths(this.host, Paths.v1.subscriptionSettings(userUuid)),
authentication: this.getSessionAccessToken(),
fallbackErrorMessage: API_MESSAGE_FAILED_UPDATE_SETTINGS,
params,
})
}
async deleteSetting(userUuid: UuidString, settingName: string): Promise<HttpResponse<DeleteSettingResponse>> {
return this.tokenRefreshableRequest<DeleteSettingResponse>({
verb: HttpVerb.Delete,
+1
View File
@@ -42,6 +42,7 @@ const SettingsPaths = {
setting: (userUuid: string, settingName: string) => `/v1/users/${userUuid}/settings/${settingName}`,
subscriptionSetting: (userUuid: string, settingName: string) =>
`/v1/users/${userUuid}/subscription-settings/${settingName}`,
subscriptionSettings: (userUuid: string) => `/v1/users/${userUuid}/subscription-settings`,
}
const SubscriptionPaths = {
@@ -874,7 +874,14 @@ export class SessionManager
const willRefreshTokenExpireSoon = refreshTokenExpiration.getTime() - Date.now() < ThirtyMinutes
if (willAccessTokenExpireSoon || willRefreshTokenExpireSoon) {
return this.httpService.refreshSession()
const refreshSessionResultOrError = await this.httpService.refreshSession()
if (refreshSessionResultOrError.isFailed()) {
return false
}
const refreshSessionResult = refreshSessionResultOrError.getValue()
return isErrorResponse(refreshSessionResult)
}
return false
@@ -38,6 +38,10 @@ export class SettingsService extends AbstractService implements SettingsClientIn
return this.provider.getSubscriptionSetting(name)
}
async updateSubscriptionSetting(name: SettingName, payload: string, sensitive = false) {
return this.provider.updateSubscriptionSetting(name, payload, sensitive)
}
async updateSetting(name: SettingName, payload: string, sensitive = false) {
return this.provider.updateSetting(name, payload, sensitive)
}
@@ -77,6 +77,13 @@ export class SettingsGateway {
return response?.data?.setting?.value ?? undefined
}
async updateSubscriptionSetting(name: SettingName, payload: string, sensitive: boolean): Promise<void> {
const response = await this.settingsApi.updateSubscriptionSetting(this.userUuid, name.value, payload, sensitive)
if (isErrorResponse(response)) {
throw new Error(getErrorFromErrorResponse(response).message)
}
}
async getDoesSensitiveSettingExist(name: SettingName): Promise<boolean> {
if (!name.isSensitive()) {
throw new Error(`Setting ${name.value} is not sensitive`)
@@ -21,5 +21,12 @@ export interface SettingsServerInterface {
getSubscriptionSetting(userUuid: UuidString, settingName: string): Promise<HttpResponse<GetSettingResponse>>
updateSubscriptionSetting(
userUuid: UuidString,
settingName: string,
settingValue: string,
sensitive: boolean,
): Promise<HttpResponse<UpdateSettingResponse>>
deleteSetting(userUuid: UuidString, settingName: string): Promise<HttpResponse<DeleteSettingResponse>>
}
+1
View File
@@ -22,6 +22,7 @@ export function createApplicationWithOptions({ identifier, environment, platform
defaultHost: host || Defaults.getDefaultHost(),
appVersion: Defaults.getAppVersion(),
webSocketUrl: Defaults.getDefaultWebSocketUrl(),
apiVersion: ApiVersion.v0,
syncCallsThresholdPerMinute,
})
}
+80 -6
View File
@@ -68,7 +68,7 @@ describe('server session', function () {
password: password,
})
const response = await application.legacyApi.refreshSession()
const response = await application.legacyApi.deprecatedRefreshSessionOnlyUsedInE2eTests()
expect(response.status).to.equal(200)
expect(response.data.session.access_token).to.be.a('string')
@@ -96,8 +96,21 @@ describe('server session', function () {
// After the above sync request is completed, we obtain the session information.
const sessionAfterSync = application.legacyApi.getSession()
/**
* Access token and refresh token values in the new API version (20240226) represent the session uuid.
* So they should stay the same as they were since we are operating on the same session.
*
* The actual token values are stored in cookies indexed by the session uuid and are not accessible to the client.
*
* [E2E][Cookies] When e2e supports the expected behavior, we can uncomment the following lines.
*
*/
// expect(sessionBeforeSync.accessToken.value).to.equal(sessionAfterSync.accessToken.value)
// expect(sessionBeforeSync.refreshToken.value).to.equal(sessionAfterSync.refreshToken.value)
expect(sessionBeforeSync.accessToken.value).to.not.equal(sessionAfterSync.accessToken.value)
expect(sessionBeforeSync.refreshToken.value).to.not.equal(sessionAfterSync.refreshToken.value)
expect(sessionBeforeSync.accessToken.expiresAt).to.be.lessThan(sessionAfterSync.accessToken.expiresAt)
// New token should expire in the future.
expect(sessionAfterSync.accessToken.expiresAt).to.be.greaterThan(Date.now())
@@ -165,7 +178,7 @@ describe('server session', function () {
expect(sessionFromStorage.refreshExpiration).to.equal(sessionFromApiService.refreshToken.expiresAt)
expect(sessionFromStorage.readonlyAccess).to.equal(sessionFromApiService.isReadOnly())
await application.legacyApi.refreshSession()
await application.legacyApi.deprecatedRefreshSessionOnlyUsedInE2eTests()
const updatedSessionFromStorage = await getSessionFromStorage(application)
const updatedSessionFromApiService = application.legacyApi.getSession()
@@ -394,9 +407,15 @@ describe('server session', function () {
await sleepUntilSessionExpires(application, false)
const refreshSessionResponse = await application.legacyApi.refreshSession()
const refreshSessionResponse = await application.legacyApi.deprecatedRefreshSessionOnlyUsedInE2eTests()
expect(refreshSessionResponse.status).to.equal(400)
/**
* [E2E][Cookies] The following expectations are commented out because e2e does not support sending cookies with requests yet.
*/
// expect(refreshSessionResponse.data.error.tag).to.equal('invalid-parameters')
// expect(refreshSessionResponse.data.error.message).to.equal('The provided parameters are not valid.')
expect(refreshSessionResponse.data.error.tag).to.equal('expired-refresh-token')
expect(refreshSessionResponse.data.error.message).to.equal('The refresh token has expired.')
@@ -411,7 +430,11 @@ describe('server session', function () {
expect(syncResponse.data.error.message).to.equal('Invalid login credentials.')
}).timeout(Factory.TwentySecondTimeout)
it('should fail when renewing a session with an invalid refresh token', async function () {
/**
* This test is skipped due to the fact that tokens reside now in cookies and are not accessible to the client.
* Thus it is not possible to tamper with the refresh token.
*/
it.skip('should fail when renewing a session with an invalid refresh token', async function () {
await Factory.registerUserToApplication({
application: application,
email: email,
@@ -429,7 +452,7 @@ describe('server session', function () {
})
application.sessions.initializeFromDisk()
const refreshSessionResponse = await application.legacyApi.refreshSession()
const refreshSessionResponse = await application.legacyApi.deprecatedRefreshSessionOnlyUsedInE2eTests()
expect(refreshSessionResponse.status).to.equal(400)
expect(refreshSessionResponse.data.error.tag).to.equal('invalid-refresh-token')
@@ -447,7 +470,7 @@ describe('server session', function () {
password: password,
})
const refreshPromise = application.legacyApi.refreshSession()
const refreshPromise = application.legacyApi.deprecatedRefreshSessionOnlyUsedInE2eTests()
const syncResponse = await application.legacyApi.sync([])
expect(syncResponse.data.error).to.be.ok
@@ -458,6 +481,57 @@ describe('server session', function () {
await refreshPromise
})
it('should tell the client to refresh the token if one is used during the cooldown period after a refresh', async function () {
await Factory.registerUserToApplication({
application: application,
email: email,
password: password,
})
const mimickApplyingSessionFromTheServerUnsuccessfully = () => {}
const originalSetSessionFn = application.http.setSession
const originalRefreshSessionCallbackFn = application.http.refreshSessionCallback
application.http.setSession = mimickApplyingSessionFromTheServerUnsuccessfully
application.http.refreshSessionCallback = mimickApplyingSessionFromTheServerUnsuccessfully
const refreshResultOrError = await application.http.refreshSession()
expect(refreshResultOrError.isFailed()).to.equal(false)
const refreshResult = refreshResultOrError.getValue()
expect(isErrorResponse(refreshResult)).to.equal(false)
const secondRefreshResultOrErrorWithNotAppliedSession = await application.http.refreshSession()
expect(secondRefreshResultOrErrorWithNotAppliedSession.isFailed()).to.equal(false)
const secondRefreshResultWithNotAppliedSession = secondRefreshResultOrErrorWithNotAppliedSession.getValue()
expect(isErrorResponse(secondRefreshResultWithNotAppliedSession)).to.equal(false)
application.http.setSession = originalSetSessionFn
application.http.refreshSessionCallback = originalRefreshSessionCallbackFn
})
it('if session renewal response is dropped, next sync with server should return a 498 and successfully renew the session', async function () {
await Factory.registerUserToApplication({
application: application,
email: email,
password: password,
})
await sleepUntilSessionExpires(application)
const refreshSpy = sinon.spy(application.http, 'refreshSession')
/**
* With this sync, we expect refreshSession to be called twice, once where the response is dropped,
* and the other time where the request succeeds
*/
application.http.__simulateNextSessionRefreshResponseDrop = true
await application.sync.sync(syncOptions)
await application.sync.sync(syncOptions)
expect(refreshSpy.callCount).to.equal(2)
})
it('notes should be synced as expected after refreshing a session', async function () {
await Factory.registerUserToApplication({
application: application,
+1 -1
View File
@@ -10,7 +10,7 @@
<script src="https://unpkg.com/[email protected]/mocha.js"></script>
<script src="https://unpkg.com/[email protected]/lib/chai-subset.js"></script>
<script src="https://unpkg.com/[email protected]/pkg/sinon.js"></script>
<script src="./vendor/sncrypto-web.js"></script>
<script src="https://unpkg.com/@standardnotes/[email protected]/dist/sncrypto-web.js"></script>
<script src="../dist/snjs.js"></script>
<script type="module">
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@standardnotes/snjs",
"version": "2.208.5",
"version": "2.208.13",
"engines": {
"node": ">=16.0.0 <17.0.0"
},
+4
View File
@@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.8.2](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-13)
**Note:** Version bump only for package @standardnotes/styles
## [1.8.1](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-10-24)
**Note:** Version bump only for package @standardnotes/styles
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@standardnotes/styles",
"version": "1.8.1",
"version": "1.8.2",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"publishConfig": {
@@ -45,3 +45,10 @@
scrollbar-width: thin;
}
.windows-web,
.windows-desktop {
.md\:hover\:overflow-y-auto {
scrollbar-gutter: stable;
}
}
+16
View File
@@ -3,6 +3,22 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.37.5](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-14)
**Note:** Version bump only for package @standardnotes/ui-services
## [1.37.4](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-13)
**Note:** Version bump only for package @standardnotes/ui-services
## [1.37.3](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-07)
**Note:** Version bump only for package @standardnotes/ui-services
## [1.37.2](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-05)
**Note:** Version bump only for package @standardnotes/ui-services
## [1.37.1](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-02-22)
**Note:** Version bump only for package @standardnotes/ui-services
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@standardnotes/ui-services",
"version": "1.37.1",
"version": "1.37.5",
"engines": {
"node": ">=16.0.0 <17.0.0"
},
+70
View File
@@ -3,6 +3,76 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [3.192.1](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-14)
### Reverts
* Revert "feat: Markdown text is now parsed correctly when pasted" ([bb81c8a](https://github.com/standardnotes/app/commit/bb81c8acfc470df76a70ab74fa8d487216e2d190))
# [3.192.0](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-14)
**Note:** Version bump only for package @standardnotes/web
## [3.191.24](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-14)
**Note:** Version bump only for package @standardnotes/web
## [3.191.23](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-13)
**Note:** Version bump only for package @standardnotes/web
## [3.191.22](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-12)
**Note:** Version bump only for package @standardnotes/web
## [3.191.21](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-11)
### Bug Fixes
* Fixed issue with re-authentication prompts ([6d872cd](https://github.com/standardnotes/app/commit/6d872cd45a504c824d6fa2d3325e1ba2401f3046))
## [3.191.20](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-11)
**Note:** Version bump only for package @standardnotes/web
## [3.191.19](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-11)
**Note:** Version bump only for package @standardnotes/web
## [3.191.18](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-08)
**Note:** Version bump only for package @standardnotes/web
## [3.191.17](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-07)
### Bug Fixes
* Fixed issue with re-authentication prompts ([#2858](https://github.com/standardnotes/app/issues/2858)) [skip e2e] ([3b2f761](https://github.com/standardnotes/app/commit/3b2f76166126a5b11f35b64aacefa37618622c3d))
## [3.191.16](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-07)
**Note:** Version bump only for package @standardnotes/web
## [3.191.15](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-06)
**Note:** Version bump only for package @standardnotes/web
## [3.191.14](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-05)
**Note:** Version bump only for package @standardnotes/web
## [3.191.13](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-05)
**Note:** Version bump only for package @standardnotes/web
## [3.191.12](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-01)
**Note:** Version bump only for package @standardnotes/web
## [3.191.11](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-01)
**Note:** Version bump only for package @standardnotes/web
## [3.191.10](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-01)
**Note:** Version bump only for package @standardnotes/web
+185
View File
@@ -1,5 +1,190 @@
{
"versions": [
{
"version": "3.192.1",
"title": "[3.192.1](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-14)",
"date": null,
"body": "### Reverts\n\n* Revert \"feat: Markdown text is now parsed correctly when pasted\" ([bb81c8a](https://github.com/standardnotes/app/commit/bb81c8acfc470df76a70ab74fa8d487216e2d190))",
"parsed": {
"_": [
"Revert \"feat: Markdown text is now parsed correctly when pasted\" (bb81c8a)"
],
"Reverts": [
"Revert \"feat: Markdown text is now parsed correctly when pasted\" (bb81c8a)"
]
}
},
{
"version": "3.192.0",
"title": "[3.192.0](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-14)",
"date": null,
"body": "**Note:** Version bump only for package @standardnotes/web",
"parsed": {
"_": [
"Note: Version bump only for package @standardnotes/web"
]
}
},
{
"version": "3.191.24",
"title": "[3.191.24](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-14)",
"date": null,
"body": "**Note:** Version bump only for package @standardnotes/web",
"parsed": {
"_": [
"Note: Version bump only for package @standardnotes/web"
]
}
},
{
"version": "3.191.23",
"title": "[3.191.23](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-13)",
"date": null,
"body": "**Note:** Version bump only for package @standardnotes/web",
"parsed": {
"_": [
"Note: Version bump only for package @standardnotes/web"
]
}
},
{
"version": "3.191.22",
"title": "[3.191.22](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-12)",
"date": null,
"body": "**Note:** Version bump only for package @standardnotes/web",
"parsed": {
"_": [
"Note: Version bump only for package @standardnotes/web"
]
}
},
{
"version": "3.191.21",
"title": "[3.191.21](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-11)",
"date": null,
"body": "### Bug Fixes\n\n* Fixed issue with re-authentication prompts ([6d872cd](https://github.com/standardnotes/app/commit/6d872cd45a504c824d6fa2d3325e1ba2401f3046))",
"parsed": {
"_": [
"Fixed issue with re-authentication prompts (6d872cd)"
],
"Bug Fixes": [
"Fixed issue with re-authentication prompts (6d872cd)"
]
}
},
{
"version": "3.191.20",
"title": "[3.191.20](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-11)",
"date": null,
"body": "**Note:** Version bump only for package @standardnotes/web",
"parsed": {
"_": [
"Note: Version bump only for package @standardnotes/web"
]
}
},
{
"version": "3.191.19",
"title": "[3.191.19](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-11)",
"date": null,
"body": "**Note:** Version bump only for package @standardnotes/web",
"parsed": {
"_": [
"Note: Version bump only for package @standardnotes/web"
]
}
},
{
"version": "3.191.18",
"title": "[3.191.18](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-08)",
"date": null,
"body": "**Note:** Version bump only for package @standardnotes/web",
"parsed": {
"_": [
"Note: Version bump only for package @standardnotes/web"
]
}
},
{
"version": "3.191.17",
"title": "[3.191.17](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-07)",
"date": null,
"body": "### Bug Fixes\n\n* Fixed issue with re-authentication prompts ([#2858](https://github.com/standardnotes/app/issues/2858)) [skip e2e] ([3b2f761](https://github.com/standardnotes/app/commit/3b2f76166126a5b11f35b64aacefa37618622c3d))",
"parsed": {
"_": [
"Fixed issue with re-authentication prompts (#2858) skip e2e] ([3b2f761)"
],
"Bug Fixes": [
"Fixed issue with re-authentication prompts (#2858) skip e2e] ([3b2f761)"
]
}
},
{
"version": "3.191.16",
"title": "[3.191.16](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-07)",
"date": null,
"body": "**Note:** Version bump only for package @standardnotes/web",
"parsed": {
"_": [
"Note: Version bump only for package @standardnotes/web"
]
}
},
{
"version": "3.191.15",
"title": "[3.191.15](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-06)",
"date": null,
"body": "**Note:** Version bump only for package @standardnotes/web",
"parsed": {
"_": [
"Note: Version bump only for package @standardnotes/web"
]
}
},
{
"version": "3.191.14",
"title": "[3.191.14](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-05)",
"date": null,
"body": "**Note:** Version bump only for package @standardnotes/web",
"parsed": {
"_": [
"Note: Version bump only for package @standardnotes/web"
]
}
},
{
"version": "3.191.13",
"title": "[3.191.13](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-05)",
"date": null,
"body": "**Note:** Version bump only for package @standardnotes/web",
"parsed": {
"_": [
"Note: Version bump only for package @standardnotes/web"
]
}
},
{
"version": "3.191.12",
"title": "[3.191.12](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-01)",
"date": null,
"body": "**Note:** Version bump only for package @standardnotes/web",
"parsed": {
"_": [
"Note: Version bump only for package @standardnotes/web"
]
}
},
{
"version": "3.191.11",
"title": "[3.191.11](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-01)",
"date": null,
"body": "**Note:** Version bump only for package @standardnotes/web",
"parsed": {
"_": [
"Note: Version bump only for package @standardnotes/web"
]
}
},
{
"version": "3.191.10",
"title": "[3.191.10](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2024-03-01)",
+4
View File
@@ -0,0 +1,4 @@
FROM nginx:alpine
COPY ./dist /usr/share/nginx/html
+5 -2
View File
@@ -1,9 +1,9 @@
{
"name": "@standardnotes/web",
"version": "3.191.10",
"version": "3.192.1",
"license": "AGPL-3.0",
"main": "dist/app.js",
"author": "Standard Notes",
"author": "Standard Notes.",
"private": true,
"files": [
"dist"
@@ -110,6 +110,9 @@
"dependencies": {
"@ariakit/react": "^0.3.9",
"@lexical/headless": "0.13.1",
"@lexical/list": "0.13.1",
"@lexical/rich-text": "0.13.1",
"@lexical/utils": "0.13.1",
"@radix-ui/react-slot": "^1.0.1",
"@react-pdf/renderer": "^3.3.2",
"comlink": "^4.4.1",
@@ -23,6 +23,7 @@ import {
SNNote,
DesktopManagerInterface,
FileItem,
ApiVersion,
} from '@standardnotes/snjs'
import { action, computed, makeObservable, observable } from 'mobx'
import { startAuthentication, startRegistration } from '@simplewebauthn/browser'
@@ -112,6 +113,10 @@ export class WebApplication extends SNApplication implements WebApplicationInter
defaultHost: defaultSyncServerHost,
appVersion: deviceInterface.appVersion,
webSocketUrl: webSocketUrl,
/**
* iOS file:// based origin does not work with production cookies
*/
apiVersion: platform === Platform.Ios || platform === Platform.Android ? ApiVersion.v0 : ApiVersion.v1,
loadBatchSize:
deviceInterface.environment === Environment.Mobile ? 250 : ApplicationOptionsDefaults.loadBatchSize,
sleepBetweenBatches:
@@ -42,6 +42,16 @@ const Email: FunctionComponent<Props> = ({ application }: Props) => {
}
}
const updateSubscriptionSetting = async (settingName: SettingName, payload: string): Promise<boolean> => {
try {
await application.settings.updateSubscriptionSetting(settingName, payload, false)
return true
} catch (e) {
application.alerts.alert(STRING_FAILED_TO_UPDATE_USER_SETTING).catch(console.error)
return false
}
}
const loadSettings = useCallback(async () => {
if (!application.sessions.getUser()) {
return
@@ -79,7 +89,7 @@ const Email: FunctionComponent<Props> = ({ application }: Props) => {
previousValue === MuteSignInEmailsOption.Muted ? MuteSignInEmailsOption.NotMuted : MuteSignInEmailsOption.Muted
setSignInEmailsMutedValue(newValue)
const updateResult = await updateSetting(
const updateResult = await updateSubscriptionSetting(
SettingName.create(SettingName.NAMES.MuteSignInEmails).getValue(),
newValue,
)
@@ -35,6 +35,7 @@ import { SearchPlugin } from './Plugins/SearchPlugin/SearchPlugin'
import AutoLinkPlugin from './Plugins/AutoLinkPlugin/AutoLinkPlugin'
import DatetimePlugin from './Plugins/DateTimePlugin/DateTimePlugin'
import PasswordPlugin from './Plugins/PasswordPlugin/PasswordPlugin'
import { MergeSiblingListsPlugin } from './Plugins/MergeSiblingListsPlugin'
type BlocksEditorProps = {
onChange?: (value: string, preview: string) => void
@@ -116,6 +117,7 @@ export const BlocksEditor: FunctionComponent<BlocksEditorProps> = ({
</div>
{isMobile && <ToolbarPlugin />}
<ListPlugin />
<MergeSiblingListsPlugin />
<MarkdownShortcutPlugin transformers={MarkdownTransformers} />
<TablePlugin hasCellMerge />
<OnChangePlugin onChange={handleChange} ignoreSelectionChange={true} />
@@ -0,0 +1,23 @@
import { ListNode, $isListNode } from '@lexical/list'
import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'
import { useEffect } from 'react'
function mergeListNodesTransform(node: ListNode) {
const nextSibling = node.getNextSibling()
if ($isListNode(nextSibling) && $isListNode(node) && nextSibling.getListType() === node.getListType()) {
node.append(...nextSibling.getChildren())
nextSibling.remove()
}
}
// https://github.com/facebook/lexical/issues/4618
export function MergeSiblingListsPlugin() {
const [editor] = useLexicalComposerContext()
useEffect(() => {
return editor.registerNodeTransform(ListNode, mergeListNodesTransform)
}, [editor])
return null
}
@@ -20,11 +20,18 @@ import {
ElementFormatType,
$isElementNode,
COMMAND_PRIORITY_LOW,
$createParagraphNode,
$isTextNode,
} from 'lexical'
import { mergeRegister, $findMatchingParent, $getNearestNodeOfType } from '@lexical/utils'
import {
mergeRegister,
$findMatchingParent,
$getNearestNodeOfType,
$getNearestBlockElementAncestorOrThrow,
} from '@lexical/utils'
import { $isLinkNode, $isAutoLinkNode, TOGGLE_LINK_COMMAND } from '@lexical/link'
import { $isListNode, ListNode } from '@lexical/list'
import { $isHeadingNode } from '@lexical/rich-text'
import { $isHeadingNode, $isQuoteNode } from '@lexical/rich-text'
import {
ComponentPropsWithoutRef,
ForwardedRef,
@@ -66,6 +73,7 @@ import { getDOMRangeRect } from '../../Lexical/Utils/getDOMRangeRect'
import { getPositionedPopoverStyles } from '@/Components/Popover/GetPositionedPopoverStyles'
import usePreference from '@/Hooks/usePreference'
import { ElementIds } from '@/Constants/ElementIDs'
import { $isDecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode'
const TOGGLE_LINK_AND_EDIT_COMMAND = createCommand<string | null>('TOGGLE_LINK_AND_EDIT_COMMAND')
@@ -172,14 +180,16 @@ interface ToolbarMenuItemProps extends Omit<MenuItemProps, 'children'> {
active?: boolean
}
const ToolbarMenuItem = ({ name, iconName, active, ...props }: ToolbarMenuItemProps) => {
const ToolbarMenuItem = ({ name, iconName, active, onClick, ...props }: ToolbarMenuItemProps) => {
return (
<MenuItem
className={classNames('overflow-hidden md:py-2', active ? '!bg-info !text-info-contrast' : 'hover:bg-contrast')}
onMouseDown={onClick}
{...props}
>
<Icon type={iconName} className="-mt-px mr-2.5 flex-shrink-0" />
<span className="overflow-hidden text-ellipsis whitespace-nowrap">{name}</span>
{active && <Icon type="check" className="ml-auto" />}
</MenuItem>
)
}
@@ -377,6 +387,49 @@ const ToolbarPlugin = () => {
containerElement.style.removeProperty('opacity')
}, [])
const clearFormatting = useCallback(() => {
activeEditor.update(() => {
const selection = $getSelection()
if ($isRangeSelection(selection)) {
const anchor = selection.anchor
const focus = selection.focus
const nodes = selection.getNodes()
if (anchor.key === focus.key && anchor.offset === focus.offset) {
return
}
nodes.forEach((node, idx) => {
// We split the first and last node by the selection
// So that we don't format unselected text inside those nodes
if ($isTextNode(node)) {
// Use a separate variable to ensure TS does not lose the refinement
let textNode = node
if (idx === 0 && anchor.offset !== 0) {
textNode = textNode.splitText(anchor.offset)[1] || textNode
}
if (idx === nodes.length - 1) {
textNode = textNode.splitText(focus.offset)[0] || textNode
}
if (textNode.__style !== '') {
textNode.setStyle('')
}
if (textNode.__format !== 0) {
textNode.setFormat(0)
$getNearestBlockElementAncestorOrThrow(textNode).setFormat('')
}
node = textNode
} else if ($isHeadingNode(node) || $isQuoteNode(node)) {
node.replace($createParagraphNode(), true)
} else if ($isDecoratorBlockNode(node)) {
node.setFormat('')
}
})
}
})
}, [activeEditor])
useEffect(() => {
if (isMobile) {
return
@@ -847,10 +900,11 @@ const ToolbarPlugin = () => {
active={isSuperscript}
onClick={() => editor.dispatchCommand(FORMAT_TEXT_COMMAND, 'superscript')}
/>
<ToolbarMenuItem name="Clear formatting" iconName="trash" onClick={clearFormatting} />
</Menu>
</Popover>
<Popover
title="Text style"
title="Block style"
anchorElement={textStyleAnchorRef}
open={isTextStyleMenuOpen}
togglePopover={() => setIsTextStyleMenuOpen(!isTextStyleMenuOpen)}
@@ -863,7 +917,7 @@ const ToolbarPlugin = () => {
portal={false}
documentElement={popoverDocumentElement}
>
<Menu a11yLabel="Text style" className="!px-0" onClick={() => setIsTextStyleMenuOpen(false)}>
<Menu a11yLabel="Block style" className="!px-0" onClick={() => setIsTextStyleMenuOpen(false)}>
<ToolbarMenuItem
name="Normal"
iconName="paragraph"
+3
View File
@@ -7682,7 +7682,10 @@ __metadata:
"@babel/preset-env": "*"
"@babel/preset-typescript": ^7.21.5
"@lexical/headless": 0.13.1
"@lexical/list": 0.13.1
"@lexical/react": 0.13.1
"@lexical/rich-text": 0.13.1
"@lexical/utils": 0.13.1
"@pmmmwh/react-refresh-webpack-plugin": ^0.5.10
"@radix-ui/react-slot": ^1.0.1
"@react-pdf/renderer": ^3.3.2