瀏覽代碼

Removed namespace from npaste settings

tags/0.0.6
Kim Grytøyr 8 月之前
父節點
當前提交
0ea07475ac
簽署人: Kim Grytøyr <kim@grytoyr.io> GPG Key ID: 759EF8C94E0B45B7
共有 2 個文件被更改,包括 12 次插入12 次删除
  1. 5
    5
      npaste-upload.py
  2. 7
    7
      settings/npaste.sublime-settings

+ 5
- 5
npaste-upload.py 查看文件

@@ -22,11 +22,11 @@ class NpasteUploadCommand(sublime_plugin.TextCommand):

data = ""
passphrase = None
payload = {'age': settings.get('npaste.age') }
payload = {'age': settings.get('age') }

# Encrypt paste using GPG
if (settings.get('npaste.encrypt') == True):
passphrase = ''.join(random.SystemRandom().choice(string.ascii_lowercase + string.digits) for _ in range(settings.get('npaste.encryption_key_length')))
if (settings.get('encrypt') == True):
passphrase = ''.join(random.SystemRandom().choice(string.ascii_lowercase + string.digits) for _ in range(settings.get('encryption_key_length')))

process = Popen(['gpg', '--armor', '--batch', '--passphrase', passphrase, '--symmetric'], stdin=PIPE, stdout=PIPE, stderr=PIPE)
d = bytes(npaste_data, 'utf-8')
@@ -41,12 +41,12 @@ class NpasteUploadCommand(sublime_plugin.TextCommand):
else:
data = npaste_data

if settings.get('npaste.archive') == True:
if settings.get('archive') == True:
payload["archive"] = 1

# Upload paste to npaste
files = {'paste': ('paste.txt', data, 'text/plain')}
r = requests.post(settings.get('npaste.url'), files=files, data=payload, auth=HTTPBasicAuth(settings.get('npaste.username'), settings.get('npaste.password')))
r = requests.post(settings.get('url'), files=files, data=payload, auth=HTTPBasicAuth(settings.get('username'), settings.get('password')))

url = r.text


+ 7
- 7
settings/npaste.sublime-settings 查看文件

@@ -1,22 +1,22 @@
{
// Specifies the URL of the npaste server to use
"npaste.url": "http://localhost:3000/",
"url": "http://localhost:3000/",

// Specifies the npaste API username
"npaste.username": "user",
"username": "user",

// Specifies the npaste API password
"npaste.password": "password",
"password": "password",

// If true, pastes will be archived instead of deleted when they expire.
"npaste.archive": true,
"archive": true,

// Sets the age of pastes (s,m,h,d,y)
"npaste.age": "14d",
"age": "14d",

// If true, pastes will be encrypted using GPG
"npaste.encrypt": true,
"encrypt": true,

// Encryption key length
"npaste.encryption_key_length": 32
"encryption_key_length": 32
}

Loading…
取消
儲存