Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Automatic plaintext backup option in Preferences > Backups will backup your notes and tags into plaintext, unencrypted folders on your computer. In addition, automatic encrypted text backups preference management has moved from the top-level menu in the desktop app to Preferences > Backups. #2322

Merged
merged 19 commits into from
May 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions packages/desktop/.env.public.development
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PURCHASE_URL=https://website-dev.standardnotes.com/purchase
PLANS_URL=https://website-dev.standardnotes.com/plans
DASHBOARD_URL=https://website-dev.standardnotes.com/dashboard
DEFAULT_SYNC_SERVER=https://api-dev.standardnotes.com
PURCHASE_URL=https://standardnotes.com/purchase
PLANS_URL=https://standardnotes.com/plans
DASHBOARD_URL=https://standardnotes.com/dashboard
DEFAULT_SYNC_SERVER=https://api.standardnotes.com
54 changes: 6 additions & 48 deletions packages/desktop/README.md
Original file line number Diff line number Diff line change
@@ -1,51 +1,17 @@
# Standard Notes

<div align="center">

[![Twitter Follow](https://img.shields.io/badge/follow-%40standardnotes-blue.svg?style=flat&logo=twitter)](https://twitter.com/standardnotes)

</div>

This application makes use of the core JS/CSS/HTML code found in the [web repo](https://github.com/standardnotes/app). For issues related to the actual app experience, please post issues in the web repo.
# Standard Notes Desktop App

## Running Locally

Make sure [Yarn](https://classic.yarnpkg.com/en/) is installed on your system.
Most commands below hog up a terminal process and must be conducted in different tabs. Be sure to quit any production version of the app running on your system first.

```bash
yarn install
yarn build:web # Or `yarn dev:web`
yarn dev

# In another terminal
yarn start
cd packages/snjs && yarn start # optional to watch snjs changes
cd packages/web && yarn watch # optional to watch web changes
yarn dev # to start compilation watch process for electron-related code
yarn start # to start dev app
```

We use [commitlint](https://github.com/conventional-changelog/commitlint) to validate commit messages.
Before making a pull request, make sure to check the output of the following commands:

```bash
yarn lint
yarn test # Make sure to start `yarn dev` before running the tests, and quit any running Standard Notes applications so they don't conflict.
```

Pull requests should target the `develop` branch.

### Installing dependencies

To determine where to install a dependency:

- If it is only required for building, install it in `package.json`'s `devDependencies`
- If it is required at runtime but can be packaged by webpack, install it in `package.json`'s `dependencies`.
- If it must be distributed as a node module (not packaged by webpack), install it in `app/package.json`'s `dependencies`
- Also make sure to declare it as an external commonjs dependency in `webpack.common.js`.

## Building

Build for all platforms:

- `yarn release`

## Building natively on arm64

Building arm64 releases on amd64 systems is only possible with AppImage, Debian and universal "dir" targets.
Expand All @@ -63,14 +29,6 @@ and making sure `$GEM_HOME/bin` is added to `$PATH`.

Snap releases also require a working snapcraft / `snapd` installation.

Building can then be done by running:

- `yarn install`

Followed by

- `node scripts/build.mjs deb-arm64`

## Installation

On Linux, download the latest AppImage from the [Releases](https://github.com/standardnotes/app/releases/latest) page, and give it executable permission:
Expand Down
11 changes: 0 additions & 11 deletions packages/desktop/app/AppState.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { action, makeObservable, observable } from 'mobx'
import { MessageType } from '../test/TestIpcMessage'
import { Store } from './javascripts/Main/Store/Store'
import { StoreKeys } from './javascripts/Main/Store/StoreKeys'
Expand All @@ -14,7 +13,6 @@ export class AppState {
readonly startUrl = Urls.indexHtml
readonly isPrimaryInstance: boolean
public willQuitApp = false
public lastBackupDate: number | null = null
public windowState?: WindowState
public deepLinkUrl?: string
public readonly updates: UpdateState
Expand All @@ -28,11 +26,6 @@ export class AppState {
this.lastRunVersion = this.store.get(StoreKeys.LastRunVersion) || 'unknown'
this.store.set(StoreKeys.LastRunVersion, this.version)

makeObservable(this, {
lastBackupDate: observable,
setBackupCreationDate: action,
})

this.updates = new UpdateState(this)

if (isTesting()) {
Expand All @@ -45,8 +38,4 @@ export class AppState {
public isRunningVersionForFirstTime(): boolean {
return this.lastRunVersion !== this.version
}

setBackupCreationDate(date: number | null): void {
this.lastBackupDate = date
}
}
21 changes: 21 additions & 0 deletions packages/desktop/app/Logging.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { isDev } from './javascripts/Main/Utils/Utils'
import { log as utilsLog } from '@standardnotes/utils'

export const isDevMode = isDev()

export enum LoggingDomain {
Backups,
}

const LoggingStatus: Record<LoggingDomain, boolean> = {
[LoggingDomain.Backups]: true,
}

// eslint-disable-next-line @typescript-eslint/no-explicit-any
export function log(domain: LoggingDomain, ...args: any[]): void {
if (!isDevMode || !LoggingStatus[domain]) {
return
}

utilsLog(LoggingDomain[domain], ...args)
}
4 changes: 4 additions & 0 deletions packages/desktop/app/application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ export function initializeApplication(args: { app: Electron.App; ipcMain: Electr
if (isDev()) {
/** Expose the app's state as a global variable. Useful for debugging */
;(global as any).appState = state

setTimeout(() => {
state.windowState?.window.webContents.openDevTools()
}, 500)
}
}

Expand Down
2 changes: 1 addition & 1 deletion packages/desktop/app/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ function migrateSnapStorage() {
error?.message ?? error,
)
}
store.set(StoreKeys.BackupsLocation, newLocation)
store.set(StoreKeys.LegacyTextBackupsLocation, newLocation)
console.log('Migration: finished moving backups directory.')
}
}
Expand Down