ownCloud direct link

This commit is contained in:
Jaex 2014-07-07 00:06:37 +03:00
parent d1f9ce6a34
commit 5d80134937
5 changed files with 39 additions and 14 deletions

View file

@ -934,7 +934,8 @@ public UploadResult UploadFile(Stream stream, string fileName)
fileUploader = new OwnCloud(Program.UploadersConfig.OwnCloudHost, Program.UploadersConfig.OwnCloudUsername, Program.UploadersConfig.OwnCloudPassword)
{
Path = Program.UploadersConfig.OwnCloudPath,
CreateShare = Program.UploadersConfig.OwnCloudCreateShare
CreateShare = Program.UploadersConfig.OwnCloudCreateShare,
DirectLink = Program.UploadersConfig.OwnCloudDirectLink
};
break;
case FileDestination.Pushbullet:

View file

@ -42,6 +42,7 @@ public sealed class OwnCloud : FileUploader
public string Password { get; set; }
public string Path { get; set; }
public bool CreateShare { get; set; }
public bool DirectLink { get; set; }
public OwnCloud(string host, string username, string password)
{
@ -114,7 +115,9 @@ public string ShareFile(string path)
{
if (result.ocs.data != null && result.ocs.meta.statuscode == 100)
{
return result.ocs.data.url;
string link = result.ocs.data.url;
if (DirectLink) link += "&download";
return link;
}
else
{

View file

@ -185,6 +185,8 @@ private void InitializeComponent()
this.cbGoogleDriveIsPublic = new System.Windows.Forms.CheckBox();
this.oauth2GoogleDrive = new UploadersLib.OAuthControl();
this.tpOwnCloud = new System.Windows.Forms.TabPage();
this.cbOwnCloudDirectLink = new System.Windows.Forms.CheckBox();
this.cbOwnCloudCreateShare = new System.Windows.Forms.CheckBox();
this.txtOwnCloudPath = new System.Windows.Forms.TextBox();
this.txtOwnCloudPassword = new System.Windows.Forms.TextBox();
this.txtOwnCloudUsername = new System.Windows.Forms.TextBox();
@ -371,7 +373,6 @@ private void InitializeComponent()
this.ttlvMain = new HelpersLib.TabToListView();
this.lblWidthHint = new System.Windows.Forms.Label();
this.actRapidShareAccountType = new UploadersLib.AccountTypeControl();
this.cbOwnCloudCreateShare = new System.Windows.Forms.CheckBox();
this.tpOtherUploaders.SuspendLayout();
this.tcOtherUploaders.SuspendLayout();
this.tpCustomUploaders.SuspendLayout();
@ -2047,6 +2048,7 @@ private void InitializeComponent()
//
// tpOwnCloud
//
this.tpOwnCloud.Controls.Add(this.cbOwnCloudDirectLink);
this.tpOwnCloud.Controls.Add(this.cbOwnCloudCreateShare);
this.tpOwnCloud.Controls.Add(this.txtOwnCloudPath);
this.tpOwnCloud.Controls.Add(this.txtOwnCloudPassword);
@ -2064,6 +2066,28 @@ private void InitializeComponent()
this.tpOwnCloud.Text = "ownCloud";
this.tpOwnCloud.UseVisualStyleBackColor = true;
//
// cbOwnCloudDirectLink
//
this.cbOwnCloudDirectLink.AutoSize = true;
this.cbOwnCloudDirectLink.Location = new System.Drawing.Point(19, 136);
this.cbOwnCloudDirectLink.Name = "cbOwnCloudDirectLink";
this.cbOwnCloudDirectLink.Size = new System.Drawing.Size(208, 17);
this.cbOwnCloudDirectLink.TabIndex = 9;
this.cbOwnCloudDirectLink.Text = "Direct link (Adds \"&&download\" to URL)";
this.cbOwnCloudDirectLink.UseVisualStyleBackColor = true;
this.cbOwnCloudDirectLink.CheckedChanged += new System.EventHandler(this.cbOwnCloudDirectLink_CheckedChanged);
//
// cbOwnCloudCreateShare
//
this.cbOwnCloudCreateShare.AutoSize = true;
this.cbOwnCloudCreateShare.Location = new System.Drawing.Point(19, 112);
this.cbOwnCloudCreateShare.Name = "cbOwnCloudCreateShare";
this.cbOwnCloudCreateShare.Size = new System.Drawing.Size(131, 17);
this.cbOwnCloudCreateShare.TabIndex = 8;
this.cbOwnCloudCreateShare.Text = "Create shareable URL";
this.cbOwnCloudCreateShare.UseVisualStyleBackColor = true;
this.cbOwnCloudCreateShare.CheckedChanged += new System.EventHandler(this.cbOwnCloudCreateShare_CheckedChanged);
//
// txtOwnCloudPath
//
this.txtOwnCloudPath.Location = new System.Drawing.Point(80, 84);
@ -3969,17 +3993,6 @@ private void InitializeComponent()
this.actRapidShareAccountType.Size = new System.Drawing.Size(214, 29);
this.actRapidShareAccountType.TabIndex = 16;
//
// cbOwnCloudCreateShare
//
this.cbOwnCloudCreateShare.AutoSize = true;
this.cbOwnCloudCreateShare.Location = new System.Drawing.Point(19, 112);
this.cbOwnCloudCreateShare.Name = "cbOwnCloudCreateShare";
this.cbOwnCloudCreateShare.Size = new System.Drawing.Size(131, 17);
this.cbOwnCloudCreateShare.TabIndex = 8;
this.cbOwnCloudCreateShare.Text = "Create shareable URL";
this.cbOwnCloudCreateShare.UseVisualStyleBackColor = true;
this.cbOwnCloudCreateShare.CheckedChanged += new System.EventHandler(this.cbOwnCloudCreateShare_CheckedChanged);
//
// UploadersConfigForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -4438,5 +4451,6 @@ private void InitializeComponent()
private System.Windows.Forms.Label lblOwnCloudUsername;
private System.Windows.Forms.Label lblOwnCloudHost;
private System.Windows.Forms.CheckBox cbOwnCloudCreateShare;
private System.Windows.Forms.CheckBox cbOwnCloudDirectLink;
}
}

View file

@ -483,6 +483,7 @@ public void LoadSettings(UploadersConfig uploadersConfig)
txtOwnCloudPassword.Text = Config.OwnCloudPassword;
txtOwnCloudPath.Text = Config.OwnCloudPath;
cbOwnCloudCreateShare.Checked = Config.OwnCloudCreateShare;
cbOwnCloudDirectLink.Checked = Config.OwnCloudDirectLink;
#endregion File uploaders
@ -1668,6 +1669,11 @@ private void cbOwnCloudCreateShare_CheckedChanged(object sender, EventArgs e)
Config.OwnCloudCreateShare = cbOwnCloudCreateShare.Checked;
}
private void cbOwnCloudDirectLink_CheckedChanged(object sender, EventArgs e)
{
Config.OwnCloudDirectLink = cbOwnCloudDirectLink.Checked;
}
#endregion ownCloud
#region Pushbullet

View file

@ -211,6 +211,7 @@ public class UploadersConfig : SettingsBase<UploadersConfig>
public string OwnCloudPassword = "";
public string OwnCloudPath = "/";
public bool OwnCloudCreateShare = true;
public bool OwnCloudDirectLink = false;
#endregion File uploaders