mirror of
https://github.com/ShareX/ShareX.git
synced 2024-09-30 01:07:21 +13:00
-Add Pushbullet as a URLSharingService (it is :D);
-Change classes from public to private; -Move Pushbullet entry to FileUploaders in UploadersConfig.cs
This commit is contained in:
parent
4108b2f90f
commit
ff44f52aff
4 changed files with 23 additions and 7 deletions
|
@ -1129,6 +1129,9 @@ public void ShareURL(string url)
|
|||
case URLSharingServices.VK:
|
||||
URLHelpers.OpenURL("http://vk.com/share.php?url=" + encodedUrl);
|
||||
break;
|
||||
case URLSharingServices.Pushbullet:
|
||||
new Pushbullet(Program.UploadersConfig.PushbulletSettings).PushLink(url, "ShareX: URL Share");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -171,7 +171,9 @@ public enum URLSharingServices
|
|||
[Description("Delicious")]
|
||||
Delicious,
|
||||
[Description("VK")]
|
||||
VK
|
||||
VK,
|
||||
[Description("Pushbullet")]
|
||||
Pushbullet
|
||||
}
|
||||
|
||||
public enum HttpMethod
|
||||
|
|
|
@ -112,6 +112,14 @@ private string Push(string pushType, string valueType, string value, string titl
|
|||
args.Add("title", title);
|
||||
args.Add(valueType, value);
|
||||
|
||||
if (valueType != "body")
|
||||
{
|
||||
if (pushType == "link")
|
||||
args.Add("body", value);
|
||||
else
|
||||
args.Add("body", "Sent via ShareX");
|
||||
}
|
||||
|
||||
string response = SendRequest(HttpMethod.POST, apiSendPushURL, args, headers);
|
||||
|
||||
if (response == null) return null;
|
||||
|
@ -189,7 +197,7 @@ private class PushbulletResponsePushData
|
|||
public string body { get; set; }
|
||||
}
|
||||
|
||||
public class PushbulletResponseFileUpload
|
||||
private class PushbulletResponseFileUpload
|
||||
{
|
||||
public string file_type { get; set; }
|
||||
|
||||
|
@ -202,7 +210,7 @@ public class PushbulletResponseFileUpload
|
|||
public PushbulletResponseFileUploadData data { get; set; }
|
||||
}
|
||||
|
||||
public class PushbulletResponseFileUploadData
|
||||
private class PushbulletResponseFileUploadData
|
||||
{
|
||||
public string awsaccesskeyid { get; set; }
|
||||
|
||||
|
|
|
@ -97,10 +97,6 @@ public class UploadersConfig : SettingsBase<UploadersConfig>
|
|||
public string UpasteUserKey = string.Empty;
|
||||
public bool UpasteIsPublic = false;
|
||||
|
||||
// Pushbullet
|
||||
|
||||
public PushbulletSettings PushbulletSettings = new PushbulletSettings();
|
||||
|
||||
#endregion Text uploaders
|
||||
|
||||
#region File uploaders
|
||||
|
@ -226,6 +222,10 @@ public class UploadersConfig : SettingsBase<UploadersConfig>
|
|||
public string MediaFirePath = "";
|
||||
public bool MediaFireUseLongLink = false;
|
||||
|
||||
// Pushbullet
|
||||
|
||||
public PushbulletSettings PushbulletSettings = new PushbulletSettings();
|
||||
|
||||
// MediaCrush
|
||||
|
||||
public bool MediaCrushDirectLink = false;
|
||||
|
@ -421,6 +421,9 @@ public bool IsValid(URLSharingServices destination)
|
|||
return !string.IsNullOrEmpty(EmailSmtpServer) && EmailSmtpPort > 0 && !string.IsNullOrEmpty(EmailFrom) && !string.IsNullOrEmpty(EmailPassword);
|
||||
case URLSharingServices.Twitter:
|
||||
return TwitterOAuthInfoList != null && TwitterOAuthInfoList.IsValidIndex(TwitterSelectedAccount) && OAuthInfo.CheckOAuth(TwitterOAuthInfoList[TwitterSelectedAccount]);
|
||||
case URLSharingServices.Pushbullet:
|
||||
return PushbulletSettings != null && !string.IsNullOrEmpty(PushbulletSettings.UserAPIKey) && PushbulletSettings.DeviceList != null &&
|
||||
PushbulletSettings.DeviceList.IsValidIndex(PushbulletSettings.SelectedDevice);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
Loading…
Reference in a new issue