mirror of
https://github.com/ShareX/ShareX.git
synced 2024-09-30 01:07:21 +13:00
Teknik was overriding Gist tab page icon
This commit is contained in:
parent
771b5b9317
commit
0364a1ca84
3 changed files with 104 additions and 45 deletions
|
@ -1,14 +1,35 @@
|
|||
using Newtonsoft.Json;
|
||||
#region License Information (GPL v3)
|
||||
|
||||
/*
|
||||
ShareX - A program that allows you to take screenshots and share any file type
|
||||
Copyright (c) 2007-2019 ShareX Team
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
Optionally you can also view the license at <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#endregion License Information (GPL v3)
|
||||
|
||||
using Newtonsoft.Json;
|
||||
using ShareX.HelpersLib;
|
||||
using ShareX.UploadersLib.Properties;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Specialized;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace ShareX.UploadersLib.FileUploaders
|
||||
|
@ -116,21 +137,19 @@ public NameValueCollection GetAuthHeaders()
|
|||
|
||||
public sealed class TeknikUploader : FileUploader, IOAuth2Basic
|
||||
{
|
||||
private Teknik _Teknik;
|
||||
|
||||
public OAuth2Info AuthInfo { get; set; }
|
||||
|
||||
public string APIUrl { get; set; }
|
||||
public TeknikExpirationUnit ExpirationUnit { get; set; }
|
||||
public int ExpirationLength { get; set; }
|
||||
|
||||
public bool Encryption { get; set; }
|
||||
public bool GenerateDeletionKey { get; set; }
|
||||
|
||||
private Teknik teknik;
|
||||
|
||||
public TeknikUploader(OAuth2Info oauth, string authUrl)
|
||||
{
|
||||
_Teknik = new Teknik(oauth, authUrl);
|
||||
AuthInfo = _Teknik.AuthInfo;
|
||||
teknik = new Teknik(oauth, authUrl);
|
||||
AuthInfo = teknik.AuthInfo;
|
||||
}
|
||||
|
||||
public override UploadResult Upload(Stream stream, string fileName)
|
||||
|
@ -144,7 +163,7 @@ public override UploadResult Upload(Stream stream, string fileName)
|
|||
args.Add("blockSize", "128");
|
||||
args.Add("genDeletionKey", GenerateDeletionKey.ToString());
|
||||
|
||||
UploadResult result = SendRequestFile(APIUrl, stream, fileName, "file", args, _Teknik.GetAuthHeaders());
|
||||
UploadResult result = SendRequestFile(APIUrl, stream, fileName, "file", args, teknik.GetAuthHeaders());
|
||||
|
||||
if (result.IsSuccess)
|
||||
{
|
||||
|
@ -161,12 +180,12 @@ public override UploadResult Upload(Stream stream, string fileName)
|
|||
|
||||
public string GetAuthorizationURL()
|
||||
{
|
||||
return _Teknik.GetAuthorizationURL();
|
||||
return teknik.GetAuthorizationURL();
|
||||
}
|
||||
|
||||
public bool GetAccessToken(string code)
|
||||
{
|
||||
return _Teknik.GetAccessToken(code);
|
||||
return teknik.GetAccessToken(code);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -193,4 +212,4 @@ public class TeknikUploadResponse
|
|||
public int BlockSize { get; set; }
|
||||
public string DeletionKey { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,12 +1,33 @@
|
|||
using Newtonsoft.Json;
|
||||
#region License Information (GPL v3)
|
||||
|
||||
/*
|
||||
ShareX - A program that allows you to take screenshots and share any file type
|
||||
Copyright (c) 2007-2019 ShareX Team
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
Optionally you can also view the license at <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#endregion License Information (GPL v3)
|
||||
|
||||
using Newtonsoft.Json;
|
||||
using ShareX.UploadersLib.FileUploaders;
|
||||
using ShareX.UploadersLib.Properties;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace ShareX.UploadersLib.TextUploaders
|
||||
|
@ -30,31 +51,30 @@ public override GenericUploader CreateUploader(UploadersConfig config, TaskRefer
|
|||
};
|
||||
}
|
||||
|
||||
public override TabPage GetUploadersConfigTabPage(UploadersConfigForm form) => form.tpGist;
|
||||
public override TabPage GetUploadersConfigTabPage(UploadersConfigForm form) => form.tpTeknik;
|
||||
}
|
||||
|
||||
public sealed class TeknikPaster : TextUploader, IOAuth2Basic
|
||||
{
|
||||
private Teknik _Teknik;
|
||||
|
||||
public OAuth2Info AuthInfo { get; set; }
|
||||
|
||||
public string APIUrl { get; set; }
|
||||
|
||||
private Teknik teknik;
|
||||
|
||||
public TeknikPaster(OAuth2Info oauth, string authUrl)
|
||||
{
|
||||
_Teknik = new Teknik(oauth, authUrl);
|
||||
AuthInfo = _Teknik.AuthInfo;
|
||||
teknik = new Teknik(oauth, authUrl);
|
||||
AuthInfo = teknik.AuthInfo;
|
||||
}
|
||||
|
||||
public bool GetAccessToken(string code)
|
||||
{
|
||||
return _Teknik.GetAccessToken(code);
|
||||
return teknik.GetAccessToken(code);
|
||||
}
|
||||
|
||||
public string GetAuthorizationURL()
|
||||
{
|
||||
return _Teknik.GetAuthorizationURL();
|
||||
return teknik.GetAuthorizationURL();
|
||||
}
|
||||
|
||||
public override UploadResult UploadText(string text, string fileName)
|
||||
|
@ -62,7 +82,7 @@ public override UploadResult UploadText(string text, string fileName)
|
|||
Dictionary<string, string> args = new Dictionary<string, string>();
|
||||
args.Add("code", text);
|
||||
|
||||
string response = SendRequestMultiPart(APIUrl, args, _Teknik.GetAuthHeaders(), null, HttpMethod.POST);
|
||||
string response = SendRequestMultiPart(APIUrl, args, teknik.GetAuthHeaders());
|
||||
TeknikPasteResponseWrapper apiResponse = JsonConvert.DeserializeObject<TeknikPasteResponseWrapper>(response);
|
||||
|
||||
UploadResult ur = new UploadResult();
|
||||
|
@ -89,4 +109,4 @@ public class TeknikPasteResponse
|
|||
public string Syntax { get; set; }
|
||||
public string Password { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,12 +1,33 @@
|
|||
using Newtonsoft.Json;
|
||||
#region License Information (GPL v3)
|
||||
|
||||
/*
|
||||
ShareX - A program that allows you to take screenshots and share any file type
|
||||
Copyright (c) 2007-2019 ShareX Team
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
Optionally you can also view the license at <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#endregion License Information (GPL v3)
|
||||
|
||||
using Newtonsoft.Json;
|
||||
using ShareX.UploadersLib.FileUploaders;
|
||||
using ShareX.UploadersLib.Properties;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace ShareX.UploadersLib.URLShorteners
|
||||
|
@ -30,31 +51,30 @@ public override URLShortener CreateShortener(UploadersConfig config, TaskReferen
|
|||
};
|
||||
}
|
||||
|
||||
public override TabPage GetUploadersConfigTabPage(UploadersConfigForm form) => form.tpGist;
|
||||
public override TabPage GetUploadersConfigTabPage(UploadersConfigForm form) => form.tpTeknik;
|
||||
}
|
||||
|
||||
public sealed class TeknikUrlShortener : URLShortener, IOAuth2Basic
|
||||
{
|
||||
private Teknik _Teknik;
|
||||
|
||||
public OAuth2Info AuthInfo { get; set; }
|
||||
|
||||
public string APIUrl { get; set; }
|
||||
|
||||
private Teknik teknik;
|
||||
|
||||
public TeknikUrlShortener(OAuth2Info oauth, string authUrl)
|
||||
{
|
||||
_Teknik = new Teknik(oauth, authUrl);
|
||||
AuthInfo = _Teknik.AuthInfo;
|
||||
teknik = new Teknik(oauth, authUrl);
|
||||
AuthInfo = teknik.AuthInfo;
|
||||
}
|
||||
|
||||
public bool GetAccessToken(string code)
|
||||
{
|
||||
return _Teknik.GetAccessToken(code);
|
||||
return teknik.GetAccessToken(code);
|
||||
}
|
||||
|
||||
public string GetAuthorizationURL()
|
||||
{
|
||||
return _Teknik.GetAuthorizationURL();
|
||||
return teknik.GetAuthorizationURL();
|
||||
}
|
||||
|
||||
public override UploadResult ShortenURL(string url)
|
||||
|
@ -62,7 +82,7 @@ public override UploadResult ShortenURL(string url)
|
|||
Dictionary<string, string> args = new Dictionary<string, string>();
|
||||
args.Add("url", url);
|
||||
|
||||
string response = SendRequestMultiPart(APIUrl, args, _Teknik.GetAuthHeaders(), null, HttpMethod.POST);
|
||||
string response = SendRequestMultiPart(APIUrl, args, teknik.GetAuthHeaders());
|
||||
TeknikUrlShortenerResponseWrapper apiResponse = JsonConvert.DeserializeObject<TeknikUrlShortenerResponseWrapper>(response);
|
||||
|
||||
UploadResult ur = new UploadResult();
|
||||
|
@ -86,4 +106,4 @@ public class TeknikUrlShortenerResponse
|
|||
public string shortUrl { get; set; }
|
||||
public string originalUrl { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue