Browse Source

Added doNotTrack option to the API.

tags/2.0.2
Teknikode 5 years ago
parent
commit
984eab6501

+ 9
- 6
Teknik/Areas/API/Controllers/APIv1Controller.cs View File

@@ -27,11 +27,12 @@ namespace Teknik.Areas.API.Controllers

[HttpPost]
[AllowAnonymous]
public ActionResult Upload(HttpPostedFileWrapper file, string contentType = null, bool encrypt = false, bool saveKey = false, string key = null, int keySize = 0, string iv = null, int blockSize = 0, bool genDeletionKey = false)
public ActionResult Upload(HttpPostedFileWrapper file, string contentType = null, bool encrypt = false, bool saveKey = false, string key = null, int keySize = 0, string iv = null, int blockSize = 0, bool genDeletionKey = false, bool doNotTrack = false)
{
try
{
Tracking.TrackPageView(Request, "Upload");
if (!doNotTrack)
Tracking.TrackPageView(Request, "Upload");
if (file != null)
{
if (file.ContentLength <= Config.UploadConfig.MaxUploadSize)
@@ -127,11 +128,12 @@ namespace Teknik.Areas.API.Controllers

[HttpPost]
[AllowAnonymous]
public ActionResult Paste(string code, string title = "", string syntax = "auto", string expireUnit = "never", int expireLength = 1, string password = "", bool hide = false)
public ActionResult Paste(string code, string title = "", string syntax = "auto", string expireUnit = "never", int expireLength = 1, string password = "", bool hide = false, bool doNotTrack = false)
{
try
{
Tracking.TrackPageView(Request, "Paste");
if (!doNotTrack)
Tracking.TrackPageView(Request, "Paste");
Paste.Models.Paste paste = PasteHelper.CreatePaste(code, title, syntax, expireUnit, expireLength, password, hide);

db.Pastes.Add(paste);
@@ -156,11 +158,12 @@ namespace Teknik.Areas.API.Controllers
}
}

public ActionResult Shorten(string url)
public ActionResult Shorten(string url, bool doNotTrack = false)
{
try
{
Tracking.TrackPageView(Request, "Shorten");
if (!doNotTrack)
Tracking.TrackPageView(Request, "Shorten");
if (url.IsValidUrl())
{
ShortenedUrl newUrl = Shortener.Shortener.ShortenUrl(url, Config.ShortenerConfig.UrlLength);

+ 14
- 0
Teknik/Areas/Help/Views/Help/API/v1/Paste.cshtml View File

@@ -129,6 +129,20 @@
If the paste should be visible in the most recent pastes list.
</td>
</tr>
<tr>
<td>
<code>doNotTrack</code>
</td>
<td>
<code>bool</code>
</td>
<td>
<var>false</var>
</td>
<td>
If you do not want the api request to be tracked as defined in the privacy policy.
</td>
</tr>
</tbody>
</table>
<h4>Response</h4>

+ 14
- 0
Teknik/Areas/Help/Views/Help/API/v1/Shorten.cshtml View File

@@ -35,6 +35,20 @@
The url you want to shorten. This url must be an absolute url.
</td>
</tr>
<tr>
<td>
<code>doNotTrack</code>
</td>
<td>
<code>bool</code>
</td>
<td>
<var>false</var>
</td>
<td>
If you do not want the api request to be tracked as defined in the privacy policy.
</td>
</tr>
</tbody>
</table>
<h4>Response</h4>

+ 14
- 0
Teknik/Areas/Help/Views/Help/API/v1/Upload.cshtml View File

@@ -147,6 +147,20 @@
Generates a deletion key.
</td>
</tr>
<tr>
<td>
<code>doNotTrack</code>
</td>
<td>
<code>bool</code>
</td>
<td>
<var>false</var>
</td>
<td>
If you do not want the api request to be tracked as defined in the privacy policy.
</td>
</tr>
</tbody>
</table>
<h4>Response</h4>

Loading…
Cancel
Save