sn-revisions 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 008b8602beb04a57882d9e7f3e821fc13071b5b7
4
- data.tar.gz: 0362024a93034631d5f8d5d33a9a1f93969bda5e
3
+ metadata.gz: e7b8bc78d4a09b32f3f240300f005d0baa1514ec
4
+ data.tar.gz: a72f039d58caac4bd9962eacde711ad7ff574844
5
5
  SHA512:
6
- metadata.gz: f8e9647c44c9ee6e38d6ba21a8d94624f048d10dc2ed6d9949dc845324ee926702a5ff950054c57c64a2b83f0ee30c3dcab6f90367509f2bbf750dc7f13cb580
7
- data.tar.gz: 11ea6a08385908d96cc419bcbc04ae918897a37014e4d1dbabf7efa75ae11b9dbdb377fdbb00b01e7665ff5b7f4a40c20d81e010143b4d3450b2750f75b1a7ee
6
+ metadata.gz: 6ec13396e57341580b23e3a0b9b749e9abb2aec2fca412819398a5fdd783eecba575f255fa539dfc0c3a7c2a291e2743e234825edeb8ca61b2a63cd9174116a3
7
+ data.tar.gz: 129860408be7f28b7cf389fd69799ddd09642d6bded03ecc9d34df94222a5b427c80ddcc7b15e3c37292f1eee86a82b18a9af96b8a12c35bd1f510d9d15ccf61
@@ -9,13 +9,31 @@ module Revisions
9
9
 
10
10
  end
11
11
 
12
+ def build_url_payload(type, name, deps)
13
+ params = {:type => type, :name => name}
14
+ if deps
15
+ params[:deps] = deps
16
+ end
17
+ return Base64.strict_encode64(params.to_json)
18
+ end
19
+
12
20
  def register
13
21
  user = Revisions::User.new
14
22
  user.key = Digest::SHA256.hexdigest(SecureRandom.random_bytes(32))
15
23
  user.save
16
24
 
17
- @server_url = build_url("items?key=#{user.key}&uid=#{user.id}")
18
- @client_url = build_url("ext?key=#{user.key}&uid=#{user.id}")
25
+ server_url = build_url("items?key=#{user.key}&uid=#{user.id}")
26
+ client_url = build_url("ext?key=#{user.key}&uid=#{user.id}")
27
+
28
+ client_url_payload = build_url_payload('SN|Extension', 'Note History', nil)
29
+
30
+ app_payload = build_url_payload(
31
+ "SF|Extension",
32
+ "Note History Server Extension",
33
+ ["#{client_url}&ap=#{client_url_payload}"]
34
+ )
35
+
36
+ @url = "#{server_url}&ap=#{app_payload}"
19
37
 
20
38
  render "index"
21
39
  end
@@ -1,45 +1,27 @@
1
1
  %h1 Note History Extension for Standard Notes
2
2
  %p The note history extension keeps track of changes, and allows you to restore a note to a previous version.
3
3
 
4
- - if @server_url
4
+ - if @url
5
5
  %p
6
6
  %strong
7
- Your secret
8
- %span{:style => "text-decoration:underline;"} server extension
7
+ Your secret extension
9
8
  URL is:
10
- = @server_url
11
- %p
12
- %strong
13
- Your secret
14
- %span{:style => "text-decoration:underline;"} app extension
15
- URL is:
16
- = @client_url
9
+ = @url
17
10
  - else
18
- = button_to "Generate URLs", {:controller => "home", :action => "register", :method => "post"}, {:class => "button-link"}
11
+ = button_to "Generate URL", {:controller => "home", :action => "register", :method => "post"}, {:class => "button-link"}
19
12
  %h3 Instructions
20
13
 
21
14
  %p
22
15
  %strong To get started:
23
16
  %ol
24
- %li Press "Generate URLs" above to generate your server and app extension URLs.
17
+ %li Press "Generate URL" above to generate your extension URL.
25
18
 
26
- %p Once you've generated your URLs, it's time to register the extensions.
19
+ %p Once you've generated your URL, it's time to register the extension:
27
20
 
28
- %p
29
- %strong To register your server extension:
30
- %ol
31
- %li In the Standard Notes app, find and click "Account" in the lower left corner.
32
- %li Click "Standard File Dashboard".
33
- %li After logging in, click "Extensions" in the left panel.
34
- %li In the add new extension section, paste in the server secret URL, and submit.
35
- %p Registering the server extension allows your main Standard File server to forward encrypted data to the Note History extension server.
36
-
37
- %p
38
- %strong To register your app extension:
39
21
  %ol
40
22
  %li In the Standard Notes app, find and click "Extensions" in the lower left corner.
41
23
  %li Click "Add new extension".
42
- %li Paste in the app secret URL and submit.
24
+ %li Paste in the secret URL and submit.
43
25
 
44
26
  %p The app extension allows you to view previous versions of the note.
45
27
 
@@ -1,3 +1,3 @@
1
1
  module Revisions
2
- VERSION = '0.1.2'
2
+ VERSION = '0.1.3'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sn-revisions
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Standard Notes