diff --git a/ShareX.UploadersLib/FileUploaders/Seafile.cs b/ShareX.UploadersLib/FileUploaders/Seafile.cs index dde5fccef..eaf57cacf 100644 --- a/ShareX.UploadersLib/FileUploaders/Seafile.cs +++ b/ShareX.UploadersLib/FileUploaders/Seafile.cs @@ -58,6 +58,7 @@ public override GenericUploader CreateUploader(UploadersConfig config, TaskRefer ShareDaysToExpire = config.SeafileShareDaysToExpire, SharePassword = config.SeafileSharePassword, CreateShareableURL = config.SeafileCreateShareableURL, + CreateShareableURLRaw = config.SeafileCreateShareableURLRaw, IgnoreInvalidCert = config.SeafileIgnoreInvalidCert }; } @@ -76,6 +77,7 @@ public sealed class Seafile : FileUploader public int ShareDaysToExpire { get; set; } public string SharePassword { get; set; } public bool CreateShareableURL { get; set; } + public bool CreateShareableURLRaw { get; set; } public bool IgnoreInvalidCert { get; set; } public Seafile(string apiurl, string authtoken, string repoid) @@ -450,6 +452,15 @@ public override UploadResult Upload(Stream stream, string fileName) { AllowReportProgress = false; result.URL = ShareFile(Path + fileName); + + if (CreateShareableURLRaw) + { + var uriBuilder = new UriBuilder(result.URL); + var query = System.Web.HttpUtility.ParseQueryString(uriBuilder.Query); + query["raw"] = "1"; + uriBuilder.Query = query.ToString(); + result.URL = $"{uriBuilder.Scheme}://{uriBuilder.Host}{uriBuilder.Path}{uriBuilder.Query}"; + } } else { diff --git a/ShareX.UploadersLib/Forms/UploadersConfigForm.Designer.cs b/ShareX.UploadersLib/Forms/UploadersConfigForm.Designer.cs index 984f8b310..01a9d603f 100644 --- a/ShareX.UploadersLib/Forms/UploadersConfigForm.Designer.cs +++ b/ShareX.UploadersLib/Forms/UploadersConfigForm.Designer.cs @@ -425,6 +425,7 @@ private void InitializeComponent() this.lblSeafilePassword = new System.Windows.Forms.Label(); this.cbSeafileIgnoreInvalidCert = new System.Windows.Forms.CheckBox(); this.cbSeafileCreateShareableURL = new System.Windows.Forms.CheckBox(); + this.cbSeafileCreateShareableURLRaw = new System.Windows.Forms.CheckBox(); this.txtSeafileAuthToken = new System.Windows.Forms.TextBox(); this.lblSeafileAuthToken = new System.Windows.Forms.Label(); this.lblSeafileAPIURL = new System.Windows.Forms.Label(); @@ -3177,6 +3178,7 @@ private void InitializeComponent() this.tpSeafile.Controls.Add(this.grpSeafileObtainAuthToken); this.tpSeafile.Controls.Add(this.cbSeafileIgnoreInvalidCert); this.tpSeafile.Controls.Add(this.cbSeafileCreateShareableURL); + this.tpSeafile.Controls.Add(this.cbSeafileCreateShareableURLRaw); this.tpSeafile.Controls.Add(this.txtSeafileAuthToken); this.tpSeafile.Controls.Add(this.lblSeafileAuthToken); this.tpSeafile.Controls.Add(this.lblSeafileAPIURL); @@ -3427,6 +3429,13 @@ private void InitializeComponent() this.cbSeafileCreateShareableURL.UseVisualStyleBackColor = true; this.cbSeafileCreateShareableURL.CheckedChanged += new System.EventHandler(this.cbSeafileCreateShareableURL_CheckedChanged); // + // cbSeafileCreateShareableURLRaw + // + resources.ApplyResources(this.cbSeafileCreateShareableURLRaw, "cbSeafileCreateShareableURLRaw"); + this.cbSeafileCreateShareableURLRaw.Name = "cbSeafileCreateShareableURLRaw"; + this.cbSeafileCreateShareableURLRaw.UseVisualStyleBackColor = true; + this.cbSeafileCreateShareableURLRaw.CheckedChanged += new System.EventHandler(this.cbSeafileCreateShareableURLRaw_CheckedChanged); + // // txtSeafileAuthToken // resources.ApplyResources(this.txtSeafileAuthToken, "txtSeafileAuthToken"); @@ -5309,6 +5318,7 @@ private void InitializeComponent() private System.Windows.Forms.Label lblSeafilePassword; private System.Windows.Forms.CheckBox cbSeafileIgnoreInvalidCert; private System.Windows.Forms.CheckBox cbSeafileCreateShareableURL; + private System.Windows.Forms.CheckBox cbSeafileCreateShareableURLRaw; private System.Windows.Forms.TextBox txtSeafileAuthToken; private System.Windows.Forms.Label lblSeafileAuthToken; private System.Windows.Forms.Label lblSeafileAPIURL; diff --git a/ShareX.UploadersLib/Forms/UploadersConfigForm.cs b/ShareX.UploadersLib/Forms/UploadersConfigForm.cs index 642d903fe..b45dd63c1 100644 --- a/ShareX.UploadersLib/Forms/UploadersConfigForm.cs +++ b/ShareX.UploadersLib/Forms/UploadersConfigForm.cs @@ -639,6 +639,8 @@ private void LoadFileUploaderSettings() txtSeafileLibraryPassword.ReadOnly = Config.SeafileIsLibraryEncrypted; btnSeafileLibraryPasswordValidate.Enabled = !Config.SeafileIsLibraryEncrypted; cbSeafileCreateShareableURL.Checked = Config.SeafileCreateShareableURL; + cbSeafileCreateShareableURLRaw.Checked = Config.SeafileCreateShareableURLRaw; + cbSeafileCreateShareableURLRaw.Enabled = cbSeafileCreateShareableURL.Checked; cbSeafileIgnoreInvalidCert.Checked = Config.SeafileIgnoreInvalidCert; nudSeafileExpireDays.SetValue(Config.SeafileShareDaysToExpire); txtSeafileSharePassword.Text = Config.SeafileSharePassword; @@ -2596,6 +2598,12 @@ private void btnSeafileGetAuthToken_Click(object sender, EventArgs e) private void cbSeafileCreateShareableURL_CheckedChanged(object sender, EventArgs e) { Config.SeafileCreateShareableURL = cbSeafileCreateShareableURL.Checked; + cbSeafileCreateShareableURLRaw.Enabled = cbSeafileCreateShareableURL.Checked; + } + + private void cbSeafileCreateShareableURLRaw_CheckedChanged(object sender, EventArgs e) + { + Config.SeafileCreateShareableURLRaw = cbSeafileCreateShareableURLRaw.Checked; } private void cbSeafileIgnoreInvalidCert_CheckedChanged(object sender, EventArgs e) diff --git a/ShareX.UploadersLib/Forms/UploadersConfigForm.resx b/ShareX.UploadersLib/Forms/UploadersConfigForm.resx index 1e8f43240..f3cd4b0ed 100644 --- a/ShareX.UploadersLib/Forms/UploadersConfigForm.resx +++ b/ShareX.UploadersLib/Forms/UploadersConfigForm.resx @@ -13085,6 +13085,18 @@ when you made the application key. 17 + + cbSeafileCreateShareableURLRaw + + + System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tpSeafile + + + 17 + txtSeafileAuthToken @@ -13353,7 +13365,7 @@ when you made the application key. NoControl - 320, 456 + 320, 479 71, 22 @@ -13377,7 +13389,7 @@ when you made the application key. 2 - 16, 457 + 16, 480 297, 20 @@ -13404,7 +13416,7 @@ when you made the application key. NoControl - 13, 441 + 13, 464 89, 13 @@ -13428,7 +13440,7 @@ when you made the application key. 4 - 16, 162 + 16, 185 375, 194 @@ -13467,7 +13479,7 @@ when you made the application key. NoControl - 320, 414 + 320, 437 71, 22 @@ -13491,7 +13503,7 @@ when you made the application key. 6 - 16, 415 + 16, 438 297, 20 @@ -13518,7 +13530,7 @@ when you made the application key. NoControl - 13, 364 + 13, 387 221, 26 @@ -13549,7 +13561,7 @@ Using an encrypted library disables sharing. NoControl - 13, 398 + 13, 421 32, 13 @@ -13576,7 +13588,7 @@ Using an encrypted library disables sharing. NoControl - 320, 365 + 320, 388 71, 23 @@ -13606,7 +13618,7 @@ Using an encrypted library disables sharing. NoControl - 13, 146 + 13, 169 70, 13 @@ -14116,7 +14128,7 @@ Using an encrypted library disables sharing. NoControl - 16, 126 + 16, 149 161, 17 @@ -14169,6 +14181,36 @@ Using an encrypted library disables sharing. 17 + + True + + + NoControl + + + 16, 126 + + + 131, 17 + + + 8 + + + Use raw URL + + + cbSeafileCreateShareableURLRaw + + + System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tpSeafile + + + 17 + 16, 77 diff --git a/ShareX.UploadersLib/UploadersConfig.cs b/ShareX.UploadersLib/UploadersConfig.cs index ba73fe8b0..d2cc73540 100644 --- a/ShareX.UploadersLib/UploadersConfig.cs +++ b/ShareX.UploadersLib/UploadersConfig.cs @@ -359,6 +359,7 @@ public class UploadersConfig : SettingsBase public bool SeafileIsLibraryEncrypted = false; public string SeafileEncryptedLibraryPassword = ""; public bool SeafileCreateShareableURL = true; + public bool SeafileCreateShareableURLRaw = false; public bool SeafileIgnoreInvalidCert = false; public int SeafileShareDaysToExpire = 0; public string SeafileSharePassword = "";