File size: 1,752 Bytes
e26fba6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Net.Mime;
using System.Configuration;
using System.IO;

namespace BlueTube.Web.Controllers
{
    public class APIController : Controller
    {
        //
        // GET: /API/
        public string AppVersion(string uid)
        {
            return ConfigurationManager.AppSettings["AppVersion"];
        }

        public string Key()
        {
            return ConfigurationManager.AppSettings["WeakKey"];
        }

        [HttpPost]
        public string Install(string message, string computername, string os, string uid)
        {
            DataService.LogInstall(message, computername, os, uid);
            return "ok";

        }

        [HttpPost]
        public void Suggestion(string text, string version)
        {
            if (String.IsNullOrWhiteSpace(text))
                return;
            if (String.IsNullOrWhiteSpace(version))
                return;
            text = text.Substring(0, Math.Min(1000, text.Length));
            
            try
            {
                var path = Path.Combine(Server.MapPath("~/App_Data"), "suggestions.txt");
                System.IO.File.AppendAllText(path, String.Format("Version: {0}, Suggestion: {1}, Date: {2}{3}{4}",
                    version, text, DateTime.Now.ToString(), Environment.NewLine, Environment.NewLine));
            }
            catch (Exception ex) {  }
        }


        public ActionResult DownloadApp(string uid)
        {
            return File(ConfigurationManager.AppSettings["BlueTubeApp"], MediaTypeNames.Application.Zip, "BlueTube.zip");
        }

    }
}