Skip to content
This repository was archived by the owner on Jun 20, 2022. It is now read-only.

Commit 0d6d120

Browse files
committed
chore: prettify files
1 parent 3e09a68 commit 0d6d120

18 files changed

+618
-657
lines changed

.prettierignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,5 @@ test/data/tmp/
66
web/
77
.github
88
codeqldb
9+
*.js
10+
scripts/

app/@types/modules.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
declare module '*.html' {
2-
const content: string;
3-
export default content;
2+
const content: string
3+
export default content
44
}

app/grantLinuxPasswordsAccess.html

Lines changed: 18 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,11 @@
1919
<div class="sk-panel-content" style="padding-bottom: 2rem">
2020
<h1 class="sk-h1">Choose how you want Standard Notes to store your account keys</h1>
2121
<p class="sk-p">
22-
Standard Notes can either use your operating system's password manager or its own
23-
local storage facility.
22+
Standard Notes can either use your operating system's password manager or its own local storage
23+
facility.
2424
</p>
2525
<p class="sk-p">
26-
<strong
27-
>Standard Notes currently does not have access to your system password
28-
service.</strong
29-
>
26+
<strong>Standard Notes currently does not have access to your system password service.</strong>
3027
If you grant it access, you must quit the app for the change to come into effect.
3128
</p>
3229
<div class="sk-panel-row">
@@ -45,47 +42,37 @@ <h1 class="sk-h1">Choose how you want Standard Notes to store your account keys<
4542
<div class="sk-panel-section">
4643
<h1 class="sk-h1">What's the difference?</h1>
4744
<p class="sk-p">
48-
Using local storage, your account keys may be more easily accessible by
49-
third-party programs, unlike in your password manager which has additional
50-
protections built-in.
45+
Using local storage, your account keys may be more easily accessible by third-party programs, unlike
46+
in your password manager which has additional protections built-in.
5147
</p>
5248
<p class="sk-p">
53-
In either cases, the strongest way to protect your account keys is to use a
54-
strong passcode, which will be used to encrypt your keys and prevent any
55-
software or operating system from reading them.
56-
<strong>
57-
If you plan on setting a passcode, you can safely use local storage.
58-
</strong>
49+
In either cases, the strongest way to protect your account keys is to use a strong passcode, which
50+
will be used to encrypt your keys and prevent any software or operating system from reading them.
51+
<strong> If you plan on setting a passcode, you can safely use local storage. </strong>
5952
</p>
6053
<div class="sk-panel-row"></div>
61-
<h2 class="sk-h2">
62-
Granting Standard Notes access to your system password service
63-
</h2>
54+
<h2 class="sk-h2">Granting Standard Notes access to your system password service</h2>
6455
<p class="sk-p">
6556
Note that
6657
<strong>
67-
granting access to your system password service will allow Standard Notes to
68-
read, write, and delete <em>any</em> of your saved passwords.
58+
granting access to your system password service will allow Standard Notes to read, write, and
59+
delete <em>any</em> of your saved passwords.
6960
</strong>
70-
Standard Notes will never use this privilege to do anything more than reading
71-
and writing to its own entry.
61+
Standard Notes will never use this privilege to do anything more than reading and writing to its own
62+
entry.
7263
</p>
7364
<ol>
7465
<li class="sk-li">Quit Standard Notes</li>
75-
<li class="sk-li">
76-
Open your software store (Ubuntu Software Center/Snap Store)
77-
</li>
66+
<li class="sk-li">Open your software store (Ubuntu Software Center/Snap Store)</li>
7867
<li class="sk-li">In your installed apps list, click on Standard Notes</li>
7968
<li class="sk-li">Look for a <em>Permissions</em> button</li>
8069
<li class="sk-li">
81-
Make sure the permission associated with reading and writing passwords is
82-
checked
70+
Make sure the permission associated with reading and writing passwords is checked
8371
</li>
8472
<li class="sk-li">Open Standard Notes again</li>
8573
</ol>
8674
<h2 class="sk-h2">
87-
Granting Standard Notes access to your system password service from the command
88-
line
75+
Granting Standard Notes access to your system password service from the command line
8976
</h2>
9077
<p class="sk-p">
9178
Run the following command:<br />
@@ -94,9 +81,8 @@ <h2 class="sk-h2">
9481
</div>
9582
<p>
9683
<em>
97-
Note: Password Service may also be referred to as keyring, saved passwords,
98-
stored passwords, password manager, passwords, or secrets, depending on your
99-
Linux configuration.
84+
Note: Password Service may also be referred to as keyring, saved passwords, stored passwords,
85+
password manager, passwords, or secrets, depending on your Linux configuration.
10086
</em>
10187
</p>
10288
</div>

test/TestIpcMessage.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
export interface TestIPCMessage {
2-
id: number;
3-
type: MessageType;
4-
args: any[];
2+
id: number
3+
type: MessageType
4+
args: any[]
55
}
66

77
export interface TestIPCMessageResult {
8-
id: number;
9-
resolve?: any;
10-
reject?: any;
8+
id: number
9+
resolve?: any
10+
reject?: any
1111
}
1212

1313
export interface AppTestMessage {
14-
type: AppMessageType;
14+
type: AppMessageType
1515
}
1616

1717
export enum AppMessageType {

test/backupsManager.spec.ts

Lines changed: 81 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -1,115 +1,115 @@
1-
import { promises as fs } from 'fs';
2-
import path from 'path';
3-
import { serial as anyTest, TestInterface } from 'ava';
4-
import { Driver, createDriver } from './driver';
1+
import { promises as fs } from 'fs'
2+
import path from 'path'
3+
import { serial as anyTest, TestInterface } from 'ava'
4+
import { Driver, createDriver } from './driver'
55

6-
const test = anyTest as TestInterface<Driver>;
6+
const test = anyTest as TestInterface<Driver>
77

8-
const BackupsDirectoryName = 'Standard Notes Backups';
8+
const BackupsDirectoryName = 'Standard Notes Backups'
99

1010
test.beforeEach(async (t) => {
11-
t.context = await createDriver();
12-
const backupsLocation = await t.context.backups.location();
13-
await fs.rmdir(backupsLocation, { recursive: true });
14-
await t.context.backups.copyDecryptScript(backupsLocation);
15-
});
11+
t.context = await createDriver()
12+
const backupsLocation = await t.context.backups.location()
13+
await fs.rmdir(backupsLocation, { recursive: true })
14+
await t.context.backups.copyDecryptScript(backupsLocation)
15+
})
1616
test.afterEach.always(async (t) => {
17-
await t.context.stop();
18-
});
17+
await t.context.stop()
18+
})
1919

2020
/**
2121
* Depending on the current system load, performing a backup
2222
* might take a while
2323
*/
24-
const timeoutDuration = 20 * 1000; /** 20s */
24+
const timeoutDuration = 20 * 1000 /** 20s */
2525

2626
function wait(duration = 1000) {
27-
return new Promise((resolve) => setTimeout(resolve, duration));
27+
return new Promise((resolve) => setTimeout(resolve, duration))
2828
}
2929

3030
test('saves incoming data to the backups folder', async (t) => {
31-
const data = 'Sample Data';
32-
const fileName = await t.context.backups.save(data);
33-
const backupsLocation = await t.context.backups.location();
34-
const files = await fs.readdir(backupsLocation);
35-
t.true(files.includes(fileName));
36-
t.is(data, await fs.readFile(path.join(backupsLocation, fileName), 'utf8'));
37-
});
31+
const data = 'Sample Data'
32+
const fileName = await t.context.backups.save(data)
33+
const backupsLocation = await t.context.backups.location()
34+
const files = await fs.readdir(backupsLocation)
35+
t.true(files.includes(fileName))
36+
t.is(data, await fs.readFile(path.join(backupsLocation, fileName), 'utf8'))
37+
})
3838

3939
test('saves the decrypt script to the backups folder', async (t) => {
40-
const backupsLocation = await t.context.backups.location();
41-
await wait(300); /** Disk might be busy */
42-
const files = await fs.readdir(backupsLocation);
43-
t.true(files.includes('decrypt.html'));
44-
});
40+
const backupsLocation = await t.context.backups.location()
41+
await wait(300) /** Disk might be busy */
42+
const files = await fs.readdir(backupsLocation)
43+
t.true(files.includes('decrypt.html'))
44+
})
4545

4646
test('performs a backup', async (t) => {
47-
t.timeout(timeoutDuration);
48-
await wait();
49-
await t.context.backups.perform();
50-
const backupsLocation = await t.context.backups.location();
51-
const files = await fs.readdir(backupsLocation);
52-
t.true(files.length >= 1);
53-
});
47+
t.timeout(timeoutDuration)
48+
await wait()
49+
await t.context.backups.perform()
50+
const backupsLocation = await t.context.backups.location()
51+
const files = await fs.readdir(backupsLocation)
52+
t.true(files.length >= 1)
53+
})
5454

5555
test('changes backups folder location', async (t) => {
56-
t.timeout(timeoutDuration);
57-
await wait();
58-
await t.context.backups.perform();
59-
let newLocation = path.join(t.context.userDataPath, 'newLocation');
60-
await fs.mkdir(newLocation);
61-
const currentLocation = await t.context.backups.location();
62-
const fileNames = await fs.readdir(currentLocation);
63-
await t.context.backups.changeLocation(newLocation);
64-
newLocation = path.join(newLocation, BackupsDirectoryName);
65-
t.deepEqual(fileNames, await fs.readdir(newLocation));
56+
t.timeout(timeoutDuration)
57+
await wait()
58+
await t.context.backups.perform()
59+
let newLocation = path.join(t.context.userDataPath, 'newLocation')
60+
await fs.mkdir(newLocation)
61+
const currentLocation = await t.context.backups.location()
62+
const fileNames = await fs.readdir(currentLocation)
63+
await t.context.backups.changeLocation(newLocation)
64+
newLocation = path.join(newLocation, BackupsDirectoryName)
65+
t.deepEqual(fileNames, await fs.readdir(newLocation))
6666

6767
/** Assert that the setting was saved */
68-
const data = await t.context.storage.dataOnDisk();
69-
t.is(data.backupsLocation, newLocation);
68+
const data = await t.context.storage.dataOnDisk()
69+
t.is(data.backupsLocation, newLocation)
7070

7171
/** Perform backup and make sure there is one more file in the directory */
72-
await t.context.backups.perform();
73-
const newFileNames = await fs.readdir(newLocation);
74-
t.deepEqual(newFileNames.length, fileNames.length + 1);
75-
});
72+
await t.context.backups.perform()
73+
const newFileNames = await fs.readdir(newLocation)
74+
t.deepEqual(newFileNames.length, fileNames.length + 1)
75+
})
7676

7777
test('changes backups location to a child directory', async (t) => {
78-
t.timeout(timeoutDuration);
79-
await wait();
80-
await t.context.backups.perform();
81-
const currentLocation = await t.context.backups.location();
82-
const backups = await fs.readdir(currentLocation);
83-
t.is(backups.length, 2); /** 1 + decrypt script */
84-
const newLocation = path.join(currentLocation, 'child_dir');
85-
await t.context.backups.changeLocation(newLocation);
86-
t.deepEqual(await fs.readdir(path.join(newLocation, BackupsDirectoryName)), backups);
87-
});
78+
t.timeout(timeoutDuration)
79+
await wait()
80+
await t.context.backups.perform()
81+
const currentLocation = await t.context.backups.location()
82+
const backups = await fs.readdir(currentLocation)
83+
t.is(backups.length, 2) /** 1 + decrypt script */
84+
const newLocation = path.join(currentLocation, 'child_dir')
85+
await t.context.backups.changeLocation(newLocation)
86+
t.deepEqual(await fs.readdir(path.join(newLocation, BackupsDirectoryName)), backups)
87+
})
8888

8989
test('changing backups location to the same directory should not do anything', async (t) => {
90-
t.timeout(timeoutDuration);
91-
await wait();
92-
await t.context.backups.perform();
93-
await t.context.backups.perform();
94-
const currentLocation = await t.context.backups.location();
95-
let totalFiles = (await fs.readdir(currentLocation)).length;
96-
t.is(totalFiles, 3); /** 2 + decrypt script */
97-
await t.context.backups.changeLocation(currentLocation);
98-
totalFiles = (await fs.readdir(currentLocation)).length;
99-
t.is(totalFiles, 3);
100-
});
90+
t.timeout(timeoutDuration)
91+
await wait()
92+
await t.context.backups.perform()
93+
await t.context.backups.perform()
94+
const currentLocation = await t.context.backups.location()
95+
let totalFiles = (await fs.readdir(currentLocation)).length
96+
t.is(totalFiles, 3) /** 2 + decrypt script */
97+
await t.context.backups.changeLocation(currentLocation)
98+
totalFiles = (await fs.readdir(currentLocation)).length
99+
t.is(totalFiles, 3)
100+
})
101101

102102
test('backups are enabled by default', async (t) => {
103-
t.is(await t.context.backups.enabled(), true);
104-
});
103+
t.is(await t.context.backups.enabled(), true)
104+
})
105105

106106
test('does not save a backup when they are disabled', async (t) => {
107-
await t.context.backups.toggleEnabled();
108-
await t.context.windowLoaded;
107+
await t.context.backups.toggleEnabled()
108+
await t.context.windowLoaded
109109
/** Do not wait on this one as the backup shouldn't be triggered */
110-
t.context.backups.perform();
111-
await wait();
112-
const backupsLocation = await t.context.backups.location();
113-
const files = await fs.readdir(backupsLocation);
114-
t.deepEqual(files, ['decrypt.html']);
115-
});
110+
t.context.backups.perform()
111+
await wait()
112+
const backupsLocation = await t.context.backups.location()
113+
const files = await fs.readdir(backupsLocation)
114+
t.deepEqual(files, ['decrypt.html'])
115+
})

0 commit comments

Comments
 (0)