Browse Source

Removed namespace from npaste settings

tags/0.0.6
Kim Grytøyr 6 months ago
parent
commit
0ea07475ac
Signed by: Kim Grytøyr <kim@grytoyr.io> GPG Key ID: 759EF8C94E0B45B7
2 changed files with 12 additions and 12 deletions
  1. 5
    5
      npaste-upload.py
  2. 7
    7
      settings/npaste.sublime-settings

+ 5
- 5
npaste-upload.py View File

@@ -22,11 +22,11 @@ class NpasteUploadCommand(sublime_plugin.TextCommand):
22 22
 
23 23
     data = ""
24 24
     passphrase = None
25
-    payload = {'age': settings.get('npaste.age') }
25
+    payload = {'age': settings.get('age') }
26 26
 
27 27
     # Encrypt paste using GPG
28
-    if (settings.get('npaste.encrypt') == True):
29
-      passphrase = ''.join(random.SystemRandom().choice(string.ascii_lowercase + string.digits) for _ in range(settings.get('npaste.encryption_key_length')))
28
+    if (settings.get('encrypt') == True):
29
+      passphrase = ''.join(random.SystemRandom().choice(string.ascii_lowercase + string.digits) for _ in range(settings.get('encryption_key_length')))
30 30
 
31 31
       process = Popen(['gpg', '--armor', '--batch', '--passphrase', passphrase, '--symmetric'], stdin=PIPE, stdout=PIPE, stderr=PIPE)
32 32
       d = bytes(npaste_data, 'utf-8')
@@ -41,12 +41,12 @@ class NpasteUploadCommand(sublime_plugin.TextCommand):
41 41
     else:
42 42
       data = npaste_data
43 43
 
44
-    if settings.get('npaste.archive') == True:
44
+    if settings.get('archive') == True:
45 45
       payload["archive"] = 1
46 46
 
47 47
     # Upload paste to npaste
48 48
     files = {'paste': ('paste.txt', data, 'text/plain')}
49
-    r = requests.post(settings.get('npaste.url'), files=files, data=payload, auth=HTTPBasicAuth(settings.get('npaste.username'), settings.get('npaste.password')))
49
+    r = requests.post(settings.get('url'), files=files, data=payload, auth=HTTPBasicAuth(settings.get('username'), settings.get('password')))
50 50
 
51 51
     url = r.text
52 52
 

+ 7
- 7
settings/npaste.sublime-settings View File

@@ -1,22 +1,22 @@
1 1
 {
2 2
 //  Specifies the URL of the npaste server to use
3
-    "npaste.url": "http://localhost:3000/",
3
+    "url": "http://localhost:3000/",
4 4
 
5 5
 //  Specifies the npaste API username
6
-    "npaste.username": "user",
6
+    "username": "user",
7 7
 
8 8
 //  Specifies the npaste API password
9
-    "npaste.password": "password",
9
+    "password": "password",
10 10
 
11 11
 //  If true, pastes will be archived instead of deleted when they expire.
12
-    "npaste.archive": true,
12
+    "archive": true,
13 13
 
14 14
 //  Sets the age of pastes (s,m,h,d,y)
15
-    "npaste.age": "14d",
15
+    "age": "14d",
16 16
 
17 17
 //  If true, pastes will be encrypted using GPG
18
-    "npaste.encrypt": true,
18
+    "encrypt": true,
19 19
 
20 20
 //  Encryption key length
21
-    "npaste.encryption_key_length": 32
21
+    "encryption_key_length": 32
22 22
 }

Loading…
Cancel
Save