mirror of
https://github.com/ShareX/ShareX.git
synced 2024-07-07 15:35:47 +12:00
Merge pull request #808 from DanielMcAssey/feature-4
Add VURL.com URL Shortener
This commit is contained in:
commit
90ec3c1623
|
@ -160,6 +160,8 @@ public enum UrlShortenerType
|
||||||
CoinURL,
|
CoinURL,
|
||||||
[Description("qr.net")]
|
[Description("qr.net")]
|
||||||
QRnet,
|
QRnet,
|
||||||
|
[Description("vurl.com")]
|
||||||
|
VURL,
|
||||||
CustomURLShortener // Localized
|
CustomURLShortener // Localized
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -297,6 +297,7 @@
|
||||||
<Compile Include="URLShorteners\TurlURLShortener.cs" />
|
<Compile Include="URLShorteners\TurlURLShortener.cs" />
|
||||||
<Compile Include="FileUploaders\MediaCrushUploader.cs" />
|
<Compile Include="FileUploaders\MediaCrushUploader.cs" />
|
||||||
<Compile Include="URLShorteners\VgdURLShortener.cs" />
|
<Compile Include="URLShorteners\VgdURLShortener.cs" />
|
||||||
|
<Compile Include="URLShorteners\VURLShortener.cs" />
|
||||||
<Compile Include="URLShorteners\YourlsURLShortener.cs" />
|
<Compile Include="URLShorteners\YourlsURLShortener.cs" />
|
||||||
<Compile Include="FileUploaders\Up1.cs" />
|
<Compile Include="FileUploaders\Up1.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
51
ShareX.UploadersLib/URLShorteners/VURLShortener.cs
Normal file
51
ShareX.UploadersLib/URLShorteners/VURLShortener.cs
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
#region License Information (GPL v3)
|
||||||
|
|
||||||
|
/*
|
||||||
|
ShareX - A program that allows you to take screenshots and share any file type
|
||||||
|
Copyright © 2007-2015 ShareX Developers
|
||||||
|
|
||||||
|
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 System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace ShareX.UploadersLib.URLShorteners
|
||||||
|
{
|
||||||
|
public sealed class VURLShortener : URLShortener
|
||||||
|
{
|
||||||
|
private const string API_ENDPOINT = "http://vurl.com/api.php";
|
||||||
|
|
||||||
|
public override UploadResult ShortenURL(string url)
|
||||||
|
{
|
||||||
|
UploadResult result = new UploadResult { URL = url };
|
||||||
|
|
||||||
|
Dictionary<string, string> args = new Dictionary<string, string>();
|
||||||
|
args.Add("url", url);
|
||||||
|
|
||||||
|
string response = SendRequest(HttpMethod.GET, API_ENDPOINT, args);
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(response) && response != "Invalid URL")
|
||||||
|
{
|
||||||
|
result.ShortenedURL = response;
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1090,6 +1090,9 @@ public UploadResult ShortenURL(string url)
|
||||||
case UrlShortenerType.QRnet:
|
case UrlShortenerType.QRnet:
|
||||||
urlShortener = new QRnetURLShortener();
|
urlShortener = new QRnetURLShortener();
|
||||||
break;
|
break;
|
||||||
|
case UrlShortenerType.VURL:
|
||||||
|
urlShortener = new VURLShortener();
|
||||||
|
break;
|
||||||
case UrlShortenerType.CustomURLShortener:
|
case UrlShortenerType.CustomURLShortener:
|
||||||
CustomUploaderItem customUploader = GetCustomUploader(Program.UploadersConfig.CustomURLShortenerSelected);
|
CustomUploaderItem customUploader = GetCustomUploader(Program.UploadersConfig.CustomURLShortenerSelected);
|
||||||
if (customUploader != null)
|
if (customUploader != null)
|
||||||
|
|
Loading…
Reference in a new issue