fixed #1416: Added Pastebin raw URL option

This commit is contained in:
Jaex 2016-03-18 12:46:55 +02:00
parent 2ea54136d6
commit 3ce8312cfc
4 changed files with 115 additions and 42 deletions

View file

@ -528,6 +528,7 @@ private void InitializeComponent()
this.lblWidthHint = new System.Windows.Forms.Label();
this.ttlvMain = new ShareX.HelpersLib.TabToListView();
this.actRapidShareAccountType = new ShareX.UploadersLib.AccountTypeControl();
this.cbPastebinRaw = new System.Windows.Forms.CheckBox();
this.tpOtherUploaders.SuspendLayout();
this.tcOtherUploaders.SuspendLayout();
this.tpTwitter.SuspendLayout();
@ -3316,6 +3317,7 @@ private void InitializeComponent()
//
// tpPastebin
//
this.tpPastebin.Controls.Add(this.cbPastebinRaw);
this.tpPastebin.Controls.Add(this.cbPastebinSyntax);
this.tpPastebin.Controls.Add(this.btnPastebinRegister);
this.tpPastebin.Controls.Add(this.lblPastebinSyntax);
@ -4230,6 +4232,13 @@ private void InitializeComponent()
this.actRapidShareAccountType.Name = "actRapidShareAccountType";
this.actRapidShareAccountType.SelectedAccountType = ShareX.UploadersLib.AccountType.Anonymous;
//
// cbPastebinRaw
//
resources.ApplyResources(this.cbPastebinRaw, "cbPastebinRaw");
this.cbPastebinRaw.Name = "cbPastebinRaw";
this.cbPastebinRaw.UseVisualStyleBackColor = true;
this.cbPastebinRaw.CheckedChanged += new System.EventHandler(this.cbPastebinRaw_CheckedChanged);
//
// UploadersConfigForm
//
resources.ApplyResources(this, "$this");
@ -4881,5 +4890,6 @@ private void InitializeComponent()
private System.Windows.Forms.ComboBox cbCheveretoUploaders;
private System.Windows.Forms.Label lblCheveretoUploadURLExample;
private System.Windows.Forms.Button btnCheveretoTestAll;
private System.Windows.Forms.CheckBox cbPastebinRaw;
}
}

View file

@ -282,6 +282,7 @@ public void LoadSettings()
}
}
txtPastebinTitle.Text = Config.PastebinSettings.Title;
cbPastebinRaw.Checked = Config.PastebinSettings.Raw;
// Paste.ee
@ -1115,6 +1116,11 @@ private void txtPastebinTitle_TextChanged(object sender, EventArgs e)
Config.PastebinSettings.Title = txtPastebinTitle.Text;
}
private void cbPastebinRaw_CheckedChanged(object sender, EventArgs e)
{
Config.PastebinSettings.Raw = cbPastebinRaw.Checked;
}
#endregion Pastebin
#region Paste.ee

View file

@ -9655,8 +9655,35 @@ Using an encrypted library disables sharing.</value>
<data name="&gt;&gt;btnCopyShowFiles.Type" xml:space="preserve">
<value>System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="cbPastebinRaw.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="cbPastebinRaw.Location" type="System.Drawing.Point, System.Drawing">
<value>16, 336</value>
</data>
<data name="cbPastebinRaw.Size" type="System.Drawing.Size, System.Drawing">
<value>90, 17</value>
</data>
<data name="cbPastebinRaw.TabIndex" type="System.Int32, mscorlib">
<value>18</value>
</data>
<data name="cbPastebinRaw.Text" xml:space="preserve">
<value>Use raw URL</value>
</data>
<data name="&gt;&gt;cbPastebinRaw.Name" xml:space="preserve">
<value>cbPastebinRaw</value>
</data>
<data name="&gt;&gt;cbPastebinRaw.Type" xml:space="preserve">
<value>System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;cbPastebinRaw.Parent" xml:space="preserve">
<value>tpPastebin</value>
</data>
<data name="&gt;&gt;cbPastebinRaw.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<data name="cbPastebinSyntax.Location" type="System.Drawing.Point, System.Drawing">
<value>16, 240</value>
<value>16, 256</value>
</data>
<data name="cbPastebinSyntax.Size" type="System.Drawing.Size, System.Drawing">
<value>152, 21</value>
@ -9674,13 +9701,13 @@ Using an encrypted library disables sharing.</value>
<value>tpPastebin</value>
</data>
<data name="&gt;&gt;cbPastebinSyntax.ZOrder" xml:space="preserve">
<value>0</value>
<value>1</value>
</data>
<data name="btnPastebinRegister.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="btnPastebinRegister.Location" type="System.Drawing.Point, System.Drawing">
<value>16, 96</value>
<value>16, 112</value>
</data>
<data name="btnPastebinRegister.Size" type="System.Drawing.Size, System.Drawing">
<value>112, 23</value>
@ -9701,7 +9728,7 @@ Using an encrypted library disables sharing.</value>
<value>tpPastebin</value>
</data>
<data name="&gt;&gt;btnPastebinRegister.ZOrder" xml:space="preserve">
<value>1</value>
<value>2</value>
</data>
<data name="lblPastebinSyntax.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@ -9710,7 +9737,7 @@ Using an encrypted library disables sharing.</value>
<value>NoControl</value>
</data>
<data name="lblPastebinSyntax.Location" type="System.Drawing.Point, System.Drawing">
<value>13, 224</value>
<value>13, 240</value>
</data>
<data name="lblPastebinSyntax.Size" type="System.Drawing.Size, System.Drawing">
<value>70, 13</value>
@ -9731,7 +9758,7 @@ Using an encrypted library disables sharing.</value>
<value>tpPastebin</value>
</data>
<data name="&gt;&gt;lblPastebinSyntax.ZOrder" xml:space="preserve">
<value>2</value>
<value>3</value>
</data>
<data name="lblPastebinExpiration.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@ -9740,7 +9767,7 @@ Using an encrypted library disables sharing.</value>
<value>NoControl</value>
</data>
<data name="lblPastebinExpiration.Location" type="System.Drawing.Point, System.Drawing">
<value>13, 176</value>
<value>13, 192</value>
</data>
<data name="lblPastebinExpiration.Size" type="System.Drawing.Size, System.Drawing">
<value>56, 13</value>
@ -9761,7 +9788,7 @@ Using an encrypted library disables sharing.</value>
<value>tpPastebin</value>
</data>
<data name="&gt;&gt;lblPastebinExpiration.ZOrder" xml:space="preserve">
<value>3</value>
<value>4</value>
</data>
<data name="lblPastebinPrivacy.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@ -9770,7 +9797,7 @@ Using an encrypted library disables sharing.</value>
<value>NoControl</value>
</data>
<data name="lblPastebinPrivacy.Location" type="System.Drawing.Point, System.Drawing">
<value>13, 128</value>
<value>13, 144</value>
</data>
<data name="lblPastebinPrivacy.Size" type="System.Drawing.Size, System.Drawing">
<value>45, 13</value>
@ -9791,7 +9818,7 @@ Using an encrypted library disables sharing.</value>
<value>tpPastebin</value>
</data>
<data name="&gt;&gt;lblPastebinPrivacy.ZOrder" xml:space="preserve">
<value>4</value>
<value>5</value>
</data>
<data name="lblPastebinTitle.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@ -9800,7 +9827,7 @@ Using an encrypted library disables sharing.</value>
<value>NoControl</value>
</data>
<data name="lblPastebinTitle.Location" type="System.Drawing.Point, System.Drawing">
<value>13, 272</value>
<value>13, 288</value>
</data>
<data name="lblPastebinTitle.Size" type="System.Drawing.Size, System.Drawing">
<value>56, 13</value>
@ -9821,7 +9848,7 @@ Using an encrypted library disables sharing.</value>
<value>tpPastebin</value>
</data>
<data name="&gt;&gt;lblPastebinTitle.ZOrder" xml:space="preserve">
<value>5</value>
<value>6</value>
</data>
<data name="lblPastebinPassword.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@ -9830,7 +9857,7 @@ Using an encrypted library disables sharing.</value>
<value>NoControl</value>
</data>
<data name="lblPastebinPassword.Location" type="System.Drawing.Point, System.Drawing">
<value>13, 56</value>
<value>13, 64</value>
</data>
<data name="lblPastebinPassword.Size" type="System.Drawing.Size, System.Drawing">
<value>56, 13</value>
@ -9851,7 +9878,7 @@ Using an encrypted library disables sharing.</value>
<value>tpPastebin</value>
</data>
<data name="&gt;&gt;lblPastebinPassword.ZOrder" xml:space="preserve">
<value>6</value>
<value>7</value>
</data>
<data name="lblPastebinUsername.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@ -9881,10 +9908,10 @@ Using an encrypted library disables sharing.</value>
<value>tpPastebin</value>
</data>
<data name="&gt;&gt;lblPastebinUsername.ZOrder" xml:space="preserve">
<value>7</value>
<value>8</value>
</data>
<data name="cbPastebinExpiration.Location" type="System.Drawing.Point, System.Drawing">
<value>16, 192</value>
<value>16, 208</value>
</data>
<data name="cbPastebinExpiration.Size" type="System.Drawing.Size, System.Drawing">
<value>152, 21</value>
@ -9902,10 +9929,10 @@ Using an encrypted library disables sharing.</value>
<value>tpPastebin</value>
</data>
<data name="&gt;&gt;cbPastebinExpiration.ZOrder" xml:space="preserve">
<value>8</value>
<value>9</value>
</data>
<data name="cbPastebinPrivacy.Location" type="System.Drawing.Point, System.Drawing">
<value>16, 144</value>
<value>16, 160</value>
</data>
<data name="cbPastebinPrivacy.Size" type="System.Drawing.Size, System.Drawing">
<value>152, 21</value>
@ -9923,10 +9950,10 @@ Using an encrypted library disables sharing.</value>
<value>tpPastebin</value>
</data>
<data name="&gt;&gt;cbPastebinPrivacy.ZOrder" xml:space="preserve">
<value>9</value>
<value>10</value>
</data>
<data name="txtPastebinTitle.Location" type="System.Drawing.Point, System.Drawing">
<value>16, 288</value>
<value>16, 304</value>
</data>
<data name="txtPastebinTitle.Size" type="System.Drawing.Size, System.Drawing">
<value>152, 20</value>
@ -9944,10 +9971,10 @@ Using an encrypted library disables sharing.</value>
<value>tpPastebin</value>
</data>
<data name="&gt;&gt;txtPastebinTitle.ZOrder" xml:space="preserve">
<value>10</value>
<value>11</value>
</data>
<data name="txtPastebinPassword.Location" type="System.Drawing.Point, System.Drawing">
<value>16, 72</value>
<value>16, 80</value>
</data>
<data name="txtPastebinPassword.Size" type="System.Drawing.Size, System.Drawing">
<value>152, 20</value>
@ -9965,7 +9992,7 @@ Using an encrypted library disables sharing.</value>
<value>tpPastebin</value>
</data>
<data name="&gt;&gt;txtPastebinPassword.ZOrder" xml:space="preserve">
<value>11</value>
<value>12</value>
</data>
<data name="txtPastebinUsername.Location" type="System.Drawing.Point, System.Drawing">
<value>16, 32</value>
@ -9986,7 +10013,7 @@ Using an encrypted library disables sharing.</value>
<value>tpPastebin</value>
</data>
<data name="&gt;&gt;txtPastebinUsername.ZOrder" xml:space="preserve">
<value>12</value>
<value>13</value>
</data>
<data name="lblPastebinLoginStatus.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
@ -9995,7 +10022,7 @@ Using an encrypted library disables sharing.</value>
<value>NoControl</value>
</data>
<data name="lblPastebinLoginStatus.Location" type="System.Drawing.Point, System.Drawing">
<value>256, 101</value>
<value>256, 117</value>
</data>
<data name="lblPastebinLoginStatus.Size" type="System.Drawing.Size, System.Drawing">
<value>40, 13</value>
@ -10016,13 +10043,13 @@ Using an encrypted library disables sharing.</value>
<value>tpPastebin</value>
</data>
<data name="&gt;&gt;lblPastebinLoginStatus.ZOrder" xml:space="preserve">
<value>13</value>
<value>14</value>
</data>
<data name="btnPastebinLogin.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="btnPastebinLogin.Location" type="System.Drawing.Point, System.Drawing">
<value>136, 96</value>
<value>136, 112</value>
</data>
<data name="btnPastebinLogin.Size" type="System.Drawing.Size, System.Drawing">
<value>112, 23</value>
@ -10043,7 +10070,7 @@ Using an encrypted library disables sharing.</value>
<value>tpPastebin</value>
</data>
<data name="&gt;&gt;btnPastebinLogin.ZOrder" xml:space="preserve">
<value>14</value>
<value>15</value>
</data>
<data name="tpPastebin.Location" type="System.Drawing.Point, System.Drawing">
<value>4, 22</value>

View file

@ -99,7 +99,15 @@ public override UploadResult UploadText(string text, string fileName)
if (!string.IsNullOrEmpty(ur.Response) && !ur.Response.StartsWith("Bad API request") && ur.Response.IsValidUrl())
{
ur.URL = ur.Response;
if (Settings.Raw)
{
string paste_key = URLHelpers.GetFileName(ur.Response);
ur.URL = "http://pastebin.com/raw/" + paste_key;
}
else
{
ur.URL = ur.Response;
}
}
else
{
@ -156,6 +164,7 @@ public static List<PastebinSyntaxInfo> GetSyntaxList()
actionscript = ActionScript
actionscript3 = ActionScript 3
ada = Ada
aimms = AIMMS
algol68 = ALGOL 68
apache = Apache Log
applescript = AppleScript
@ -172,22 +181,28 @@ public static List<PastebinSyntaxInfo> GetSyntaxList()
bascomavr = BASCOM AVR
bash = Bash
basic4gl = Basic4GL
dos = Batch
bibtex = BibTeX
blitzbasic = Blitz Basic
b3d = Blitz3D
bmx = BlitzMax
bnf = BNF
boo = BOO
bf = BrainFuck
c = C
c_winapi = C (WinAPI)
c_mac = C for Macs
cil = C Intermediate Language
csharp = C#
cpp = C++
cpp-qt = C++ (with QT extensions)
cpp-winapi = C++ (WinAPI)
cpp-qt = C++ (with Qt extensions)
c_loadrunner = C: Loadrunner
caddcl = CAD DCL
cadlisp = CAD Lisp
cfdg = CFDG
chaiscript = ChaiScript
chapel = Chapel
clojure = Clojure
klonec = Clone C
klonecpp = Clone C++
@ -198,6 +213,7 @@ public static List<PastebinSyntaxInfo> GetSyntaxList()
css = CSS
cuesheet = Cuesheet
d = D
dart = Dart
dcl = DCL
dcpu16 = DCPU-16
dcs = DCS
@ -205,9 +221,9 @@ public static List<PastebinSyntaxInfo> GetSyntaxList()
oxygene = Delphi Prism (Oxygene)
diff = Diff
div = DIV
dos = DOS
dot = DOT
e = E
ezt = Easytrieve
ecmascript = ECMAScript
eiffel = Eiffel
email = Email
@ -241,11 +257,15 @@ public static List<PastebinSyntaxInfo> GetSyntaxList()
inno = Inno Script
intercal = INTERCAL
io = IO
ispfpanel = ISPF Panel Definition
j = J
java = Java
java5 = Java 5
javascript = JavaScript
jcl = JCL
jquery = jQuery
json = JSON
julia = Julia
kixtart = KiXtart
latex = Latex
ldif = LDIF
@ -274,7 +294,10 @@ public static List<PastebinSyntaxInfo> GetSyntaxList()
mxml = MXML
mysql = MySQL
nagios = Nagios
netrexx = NetRexx
newlisp = newLISP
nginx = Nginx
nimrod = Nimrod
nsis = NullSoft Installer
oberon2 = Oberon 2
objeck = Objeck Programming Langua
@ -291,7 +314,7 @@ public static List<PastebinSyntaxInfo> GetSyntaxList()
parasail = ParaSail
parigp = PARI/GP
pascal = Pascal
pawn = PAWN
pawn = Pawn
pcre = PCRE
per = Per
perl = Perl
@ -303,6 +326,7 @@ public static List<PastebinSyntaxInfo> GetSyntaxList()
pixelbender = Pixel Bender
plsql = PL/SQL
postgresql = PostgreSQL
postscript = PostScript
povray = POV-Ray
powershell = Power Shell
powerbuilder = PowerBuilder
@ -311,14 +335,18 @@ public static List<PastebinSyntaxInfo> GetSyntaxList()
prolog = Prolog
properties = Properties
providex = ProvideX
puppet = Puppet
purebasic = PureBasic
pycon = PyCon
python = Python
pys60 = Python for S60
q = q/kdb+
qbasic = QBasic
qml = QML
rsplus = R
racket = Racket
rails = Rails
rbs = RBScript
rebol = REBOL
reg = REG
rexx = Rexx
@ -326,17 +354,23 @@ public static List<PastebinSyntaxInfo> GetSyntaxList()
rpmspec = RPM Spec
ruby = Ruby
gnuplot = Ruby Gnuplot
rust = Rust
sas = SAS
scala = Scala
scheme = Scheme
scilab = Scilab
scl = SCL
sdlbasic = SdlBasic
smalltalk = Smalltalk
smarty = Smarty
spark = SPARK
sparql = SPARQL
sqf = SQF
sql = SQL
standardml = StandardML
stonescript = StoneScript
sclang = SuperCollider
swift = Swift
systemverilog = SystemVerilog
tsql = T-SQL
tcl = TCL
@ -349,6 +383,7 @@ public static List<PastebinSyntaxInfo> GetSyntaxList()
urbi = Urbi
vala = Vala
vbnet = VB.NET
vbscript = VBScript
vedit = Vedit
verilog = VeriLog
vhdl = VHDL
@ -373,6 +408,7 @@ public static List<PastebinSyntaxInfo> GetSyntaxList()
foreach (string line in syntaxList.Lines().Select(x => x.Trim()))
{
int index = line.IndexOf('=');
if (index > 0)
{
PastebinSyntaxInfo syntaxInfo = new PastebinSyntaxInfo();
@ -439,17 +475,11 @@ public class PastebinSettings
{
public string Username { get; set; }
public string Password { get; set; }
public PastebinPrivacy Exposure { get; set; }
public PastebinExpiration Expiration { get; set; }
public PastebinPrivacy Exposure { get; set; } = PastebinPrivacy.Unlisted;
public PastebinExpiration Expiration { get; set; } = PastebinExpiration.N;
public string Title { get; set; }
public string TextFormat { get; set; }
public string TextFormat { get; set; } = "text";
public string UserKey { get; set; }
public PastebinSettings()
{
Exposure = PastebinPrivacy.Unlisted;
Expiration = PastebinExpiration.N;
TextFormat = "text";
}
public bool Raw { get; set; }
}
}