1
0
mirror of https://git.teknik.io/Teknikode/Teknik.git synced 2023-08-02 14:16:22 +02:00

Added doNotTrack option to the API.

This commit is contained in:
Uncled1023 2016-02-26 22:09:57 -08:00
parent 668f6acae2
commit 984eab6501
4 changed files with 51 additions and 6 deletions

View File

@ -27,11 +27,12 @@ namespace Teknik.Areas.API.Controllers
[HttpPost] [HttpPost]
[AllowAnonymous] [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 try
{ {
Tracking.TrackPageView(Request, "Upload"); if (!doNotTrack)
Tracking.TrackPageView(Request, "Upload");
if (file != null) if (file != null)
{ {
if (file.ContentLength <= Config.UploadConfig.MaxUploadSize) if (file.ContentLength <= Config.UploadConfig.MaxUploadSize)
@ -127,11 +128,12 @@ namespace Teknik.Areas.API.Controllers
[HttpPost] [HttpPost]
[AllowAnonymous] [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 try
{ {
Tracking.TrackPageView(Request, "Paste"); if (!doNotTrack)
Tracking.TrackPageView(Request, "Paste");
Paste.Models.Paste paste = PasteHelper.CreatePaste(code, title, syntax, expireUnit, expireLength, password, hide); Paste.Models.Paste paste = PasteHelper.CreatePaste(code, title, syntax, expireUnit, expireLength, password, hide);
db.Pastes.Add(paste); 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 try
{ {
Tracking.TrackPageView(Request, "Shorten"); if (!doNotTrack)
Tracking.TrackPageView(Request, "Shorten");
if (url.IsValidUrl()) if (url.IsValidUrl())
{ {
ShortenedUrl newUrl = Shortener.Shortener.ShortenUrl(url, Config.ShortenerConfig.UrlLength); ShortenedUrl newUrl = Shortener.Shortener.ShortenUrl(url, Config.ShortenerConfig.UrlLength);

View File

@ -129,6 +129,20 @@
If the paste should be visible in the most recent pastes list. If the paste should be visible in the most recent pastes list.
</td> </td>
</tr> </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> </tbody>
</table> </table>
<h4>Response</h4> <h4>Response</h4>

View File

@ -35,6 +35,20 @@
The url you want to shorten. This url must be an absolute url. The url you want to shorten. This url must be an absolute url.
</td> </td>
</tr> </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> </tbody>
</table> </table>
<h4>Response</h4> <h4>Response</h4>

View File

@ -147,6 +147,20 @@
Generates a deletion key. Generates a deletion key.
</td> </td>
</tr> </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> </tbody>
</table> </table>
<h4>Response</h4> <h4>Response</h4>