Merges master

This commit is contained in:
Mo Bitar
2020-03-14 12:05:38 -05:00
18 changed files with 1453 additions and 89822 deletions

15
.vscode/launch.json vendored
View File

@@ -1,15 +0,0 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "launch",
"name": "Launch Chrome against localhost",
"url": "http://localhost:3001",
"webRoot": "${workspaceFolder}"
}
]
}

View File

@@ -11,7 +11,7 @@ Standard Notes is a simple and private notes app available on most platforms, in
- Fast and encrypted cross-platform sync - Fast and encrypted cross-platform sync
- Free sync on unlimited devices - Free sync on unlimited devices
- Extensible with editors (such as Markdown and Code), themes, and components (like Folders and Autocomplete Tags). Learn more about [Extended](https://standardnotes.org/extensions). - Extensible with editors (such as Markdown and Code), themes, and components (like Folders and Autocomplete Tags). Learn more about [Extended](https://standardnotes.org/extensions).
- Open-source and the option to self-host your notes server. You can [host your own Standard Server](https://docs.standardnotes.org/self-hosting.html) in a few easy steps. - Open-source and the option to self-host your notes server. You can [host your own Standard Server](https://docs.standardnotes.org/self-hosting/getting-started) in a few easy steps.
- A strong focus on longevity and sustainability. [Learn more](https://standardnotes.org/longevity). - A strong focus on longevity and sustainability. [Learn more](https://standardnotes.org/longevity).
### Creating your private notes account ### Creating your private notes account
@@ -60,16 +60,16 @@ This repo contains the core code used in the web app, as well as the Electron-ba
**Instructions:** **Instructions:**
1. Clone the repo 1. Clone the repo
1. `npm run build` 2. `npm install`
1. `rails s` 3. `npm start`
Open your browser to http://localhost:3000. Then open your browser to `http://localhost:3000`.
--- ---
**Extensions Manager and Batch Manager:** **Extensions Manager and Batch Manager:**
The web app makes use of two optional native extensions, which can be configured to work as follows: The web app makes use of two optional native extensions, which, when running the app with Rails, can be configured to work as follows:
1. `git submodule update --init --force --remote` (will load the submodules in the `public/extensions` folder) 1. `git submodule update --init --force --remote` (will load the submodules in the `public/extensions` folder)
1. Set the following environment variables in the .env file: 1. Set the following environment variables in the .env file:

View File

@@ -39,7 +39,7 @@ class LockScreenCtrl extends PureCtrl {
} }
} }
async submitPasscodeForm($event) { async submitPasscodeForm() {
if ( if (
!this.formData.passcode || !this.formData.passcode ||
this.formData.passcode.length === 0 this.formData.passcode.length === 0

View File

@@ -133,8 +133,7 @@ class NotesCtrl extends PureCtrl {
const selectedNote = this.state.selectedNote; const selectedNote = this.state.selectedNote;
if (selectedNote) { if (selectedNote) {
const discarded = selectedNote.deleted || selectedNote.content.trashed; const discarded = selectedNote.deleted || selectedNote.content.trashed;
const notIncluded = !this.state.notes.includes(selectedNote); if (discarded) {
if (notIncluded || discarded) {
this.selectNextOrCreateNew(); this.selectNextOrCreateNew();
} }
} else { } else {
@@ -165,7 +164,7 @@ class NotesCtrl extends PureCtrl {
}); });
this.resetScrollPosition(); this.resetScrollPosition();
this.setShowMenuFalse(); this.setShowMenuFalse();
this.setNoteFilterText(''); await this.setNoteFilterText('');
this.desktopManager.searchText(); this.desktopManager.searchText();
this.resetPagination(); this.resetPagination();
@@ -219,7 +218,7 @@ class NotesCtrl extends PureCtrl {
selectedTag: this.state.tag, selectedTag: this.state.tag,
showArchived: this.state.showArchived, showArchived: this.state.showArchived,
hidePinned: this.state.hidePinned, hidePinned: this.state.hidePinned,
filterText: this.state.noteFilter.text, filterText: this.state.noteFilter.text.toLowerCase(),
sortBy: this.state.sortBy, sortBy: this.state.sortBy,
reverse: this.state.sortReverse reverse: this.state.sortReverse
}); });
@@ -514,10 +513,16 @@ class NotesCtrl extends PureCtrl {
if (!selectedTag) { if (!selectedTag) {
throw 'Attempting to create note with no selected tag'; throw 'Attempting to create note with no selected tag';
} }
if (this.state.selectedNote && this.state.selectedNote.dummy) { let title;
let isDummyNote = true;
if (this.isFiltering()) {
title = this.state.noteFilter.text;
isDummyNote = false;
} else if (this.state.selectedNote && this.state.selectedNote.dummy) {
return; return;
} else {
title = `Note ${this.state.notes.length + 1}`;
} }
const title = "Note" + (this.state.notes ? (" " + (this.state.notes.length + 1)) : "");
const newNote = await this.application.createItem({ const newNote = await this.application.createItem({
contentType: ContentTypes.Note, contentType: ContentTypes.Note,
content: { content: {
@@ -527,7 +532,7 @@ class NotesCtrl extends PureCtrl {
add: true add: true
}); });
newNote.client_updated_at = new Date(); newNote.client_updated_at = new Date();
newNote.dummy = true; newNote.dummy = isDummyNote;
this.application.setItemNeedsSync({ item: newNote }); this.application.setItemNeedsSync({ item: newNote });
if (!selectedTag.isSmartTag()) { if (!selectedTag.isSmartTag()) {
selectedTag.addItemAsRelationship(newNote); selectedTag.addItemAsRelationship(newNote);
@@ -562,9 +567,6 @@ class NotesCtrl extends PureCtrl {
this.searchSubmitted = false; this.searchSubmitted = false;
} }
await this.reloadNotes(); await this.reloadNotes();
if (!this.state.notes.includes(this.state.selectedNote)) {
this.selectFirstNote();
}
} }
onFilterEnter() { onFilterEnter() {

View File

@@ -254,40 +254,29 @@ class RootCtrl extends PureCtrl {
}, false); }, false);
} }
handleAutoSignInFromParams() { async handleAutoSignInFromParams() {
const urlParam = (key) => { const params = this.$location.search();
return this.$location.search()[key]; const server = params.server;
}; const email = params.email;
const password = params.pw;
if (!server || !email || !password) return;
const autoSignInFromParams = async () => { const user = this.application.getUser();
const server = urlParam('server'); if (user) {
const email = urlParam('email'); if (user.email === email && await this.application.getHost() === server) {
const pw = urlParam('pw'); /** Already signed in, return */
if (!this.application.getUser()) { return;
if (
await this.application.getHost() === server
&& this.application.getUser().email === email
) {
/** Already signed in, return */
// eslint-disable-next-line no-useless-return
return;
} else {
/** Sign out */
await this.application.signOut();
await this.application.restart();
}
} else { } else {
await this.application.setHost(server); /** Sign out */
this.application.signIn({ await this.application.signOut();
email: email, await this.application.restart();
password: pw,
});
} }
};
if (urlParam('server')) {
autoSignInFromParams();
} }
await this.application.setHost(server);
this.application.signIn({
email: email,
password: password,
});
} }
} }

View File

@@ -199,6 +199,7 @@ class AccountMenuCtrl extends PureCtrl {
} }
await this.setFormDataState({ await this.setFormDataState({
status: null, status: null,
user_password: null
}); });
const error = response const error = response
? response.error ? response.error
@@ -462,6 +463,19 @@ class AccountMenuCtrl extends PureCtrl {
} }
} }
hidePasswordForm() {
this.setFormDataState({
showLogin: false,
showRegister: false,
user_password: null,
password_conf: null
});
}
hasPasscode() {
return this.passcodeManager.hasPasscode();
}
addPasscodeClicked() { addPasscodeClicked() {
this.setFormDataState({ this.setFormDataState({
showPasscodeForm: true showPasscodeForm: true

View File

@@ -42,7 +42,7 @@ class EditorMenuCtrl extends PureCtrl {
} }
toggleDefaultForEditor(editor) { toggleDefaultForEditor(editor) {
if(this.defaultEditor === editor) { if(this.state.defaultEditor === editor) {
this.removeEditorDefault(editor); this.removeEditorDefault(editor);
} else { } else {
this.makeEditorDefault(editor); this.makeEditorDefault(editor);

View File

@@ -338,10 +338,7 @@
.sk-panel-row .sk-panel-row
.sk-p.left.neutral.faded {{self.state.appVersion}} .sk-p.left.neutral.faded {{self.state.appVersion}}
a.sk-a.right( a.sk-a.right(
ng-click=` ng-click='self.hidePasswordForm()',
self.state.formData.showLogin = false;
self.state.formData.showRegister = false;
`,
ng-if='self.state.formData.showLogin || self.state.formData.showRegister' ng-if='self.state.formData.showLogin || self.state.formData.showRegister'
) )
| Cancel | Cancel

View File

@@ -12,7 +12,6 @@
i.icon.ion-plus.add-button i.icon.ion-plus.add-button
.filter-section(role='search') .filter-section(role='search')
input#search-bar.filter-bar( input#search-bar.filter-bar(
lowercase='true',
ng-blur='self.onFilterEnter()', ng-blur='self.onFilterEnter()',
ng-change='self.filterTextChanged()', ng-change='self.filterTextChanged()',
ng-keyup='$event.keyCode == 13 && self.onFilterEnter();', ng-keyup='$event.keyCode == 13 && self.onFilterEnter();',

87030
dist/javascripts/app.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

2655
dist/stylesheets/app.css vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

1331
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -7,7 +7,7 @@
"url": "https://github.com/standardnotes/web" "url": "https://github.com/standardnotes/web"
}, },
"scripts": { "scripts": {
"start": "webpack --mode development -w", "start": "webpack-dev-server --progress",
"bundle": "webpack --mode production", "bundle": "webpack --mode production",
"build": "bundle install && npm install && npm run bundle", "build": "bundle install && npm install && npm run bundle",
"submodules": "git submodule update --init --force --remote", "submodules": "git submodule update --init --force --remote",
@@ -47,10 +47,11 @@
"pug-loader": "^2.4.0", "pug-loader": "^2.4.0",
"sass-loader": "^8.0.2", "sass-loader": "^8.0.2",
"serve-static": "^1.14.1", "serve-static": "^1.14.1",
"sn-stylekit": "2.0.20",
"snjs": "github:standardnotes/snjs#ea2f182ba4b53642516714396bbef264f25e373b", "snjs": "github:standardnotes/snjs#ea2f182ba4b53642516714396bbef264f25e373b",
"sn-stylekit": "2.0.22",
"webpack": "^4.41.5", "webpack": "^4.41.5",
"webpack-cli": "^3.3.10" "webpack-cli": "^3.3.10",
"webpack-dev-server": "^3.10.3"
}, },
"dependencies": { "dependencies": {
"lodash": "^4.17.15" "lodash": "^4.17.15"

25
public/manifest.json Normal file
View File

@@ -0,0 +1,25 @@
{
"app": {
"launch": {
"urls": [
"https://app.standardnotes.org/"
],
"web_url": "https://app.standardnotes.org",
"container": "tab"
}
},
"offline_enabled": true,
"permissions": [],
"requirements": {
"3D": {
"features": []
}
},
"icons": {
"128": "favicon/android-chrome-192x192.png"
},
"name": "Standard Notes",
"description": "A Simple And Private Notes App",
"version": "1.0",
"manifest_version": 2
}

View File

@@ -7,6 +7,15 @@ module.exports = {
output: { output: {
filename: './javascripts/app.js' filename: './javascripts/app.js'
}, },
devServer: {
proxy: {
'/extensions': {
target: 'http://localhost:3000',
pathRewrite: { '^/extensions': '/public/extensions' }
}
},
port: 3000
},
plugins: [ plugins: [
new webpack.DefinePlugin({ new webpack.DefinePlugin({
__VERSION__: JSON.stringify(require('./package.json').version) __VERSION__: JSON.stringify(require('./package.json').version)