fixed #733: Added maxfile.ro file uploader

This commit is contained in:
Jaex 2015-06-20 09:51:27 +03:00
parent fe8b755406
commit aee83e1536
5 changed files with 56 additions and 5 deletions

View file

@ -122,6 +122,8 @@ public enum FileDestination
Imgrush,
[Description("VideoBin")]
VideoBin,
[Description("MaxFile")]
MaxFile,
[Description("Dropfile")]
Dropfile,
SharedFolder, // Localized

View file

@ -0,0 +1,41 @@
#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;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ShareX.UploadersLib.FileUploaders
{
public sealed class MaxFile : Pomf
{
public MaxFile()
{
UploadURL = "https://maxfile.ro/static/upload.php";
ResultURL = "https://d.maxfile.ro";
}
}
}

View file

@ -24,16 +24,20 @@ You should have received a copy of the GNU General Public License
#endregion License Information (GPL v3)
using Newtonsoft.Json;
using ShareX.HelpersLib;
using System.Collections.Generic;
using System.IO;
namespace ShareX.UploadersLib.FileUploaders
{
public sealed class Pomf : FileUploader
public class Pomf : FileUploader
{
protected string UploadURL = "https://pomf.se/upload.php";
protected string ResultURL = "https://a.pomf.se";
public override UploadResult Upload(Stream stream, string fileName)
{
UploadResult result = UploadData(stream, "https://pomf.se/upload.php", fileName, "files[]");
UploadResult result = UploadData(stream, UploadURL, fileName, "files[]");
if (result.IsSuccess)
{
@ -41,21 +45,21 @@ public override UploadResult Upload(Stream stream, string fileName)
if (response.success && response.files != null && response.files.Count > 0)
{
result.URL = "https://a.pomf.se/" + response.files[0].url;
result.URL = URLHelpers.CombineURL(ResultURL, response.files[0].url);
}
}
return result;
}
internal class PomfResponse
private class PomfResponse
{
public bool success { get; set; }
public object error { get; set; }
public List<PomfFile> files { get; set; }
}
internal class PomfFile
private class PomfFile
{
public string hash { get; set; }
public string name { get; set; }

View file

@ -116,6 +116,7 @@
<Compile Include="FileUploaders\Hubic.cs" />
<Compile Include="FileUploaders\Jira.cs" />
<Compile Include="FileUploaders\Hostr.cs" />
<Compile Include="FileUploaders\MaxFile.cs" />
<Compile Include="FileUploaders\MediaFire.cs" />
<Compile Include="FileUploaders\Mega.cs" />
<Compile Include="FileUploaders\OneDrive.cs" />

View file

@ -1003,6 +1003,9 @@ public UploadResult UploadFile(Stream stream, string fileName)
case FileDestination.VideoBin:
fileUploader = new VideoBin();
break;
case FileDestination.MaxFile:
fileUploader = new MaxFile();
break;
case FileDestination.Dropfile:
fileUploader = new Dropfile();
break;