Skip to content
This repository was archived by the owner on Dec 21, 2023. It is now read-only.

Commit c28beea

Browse files
Merge pull request #94 from InfinityGhost/release-controller
Move release download logic to separate controller
2 parents ba92645 + 4ca8db6 commit c28beea

File tree

4 files changed

+39
-26
lines changed

4 files changed

+39
-26
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
using System.Linq;
2+
using System.Threading.Tasks;
3+
using Microsoft.AspNetCore.Mvc;
4+
using OpenTabletDriver.Web.Core.Services;
5+
6+
#nullable enable
7+
8+
namespace OpenTabletDriver.Web.Controllers
9+
{
10+
public class ReleaseController : Controller
11+
{
12+
private readonly IReleaseService _releaseService;
13+
14+
public ReleaseController(IReleaseService releaseService)
15+
{
16+
_releaseService = releaseService;
17+
}
18+
19+
[Route("{Release}/{Download}/{file}")]
20+
public async Task<IActionResult> Download(string file)
21+
{
22+
var release = await _releaseService.GetLatestRelease();
23+
var assets = await release.GetReleaseAssets();
24+
var asset = assets.First(a => a.FileName == file);
25+
return Redirect(asset.Url);
26+
}
27+
}
28+
}

OpenTabletDriver.Web/Views/Wiki/Install/Linux.cshtml

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,14 @@
1-
@using OpenTabletDriver.Web.Core.Services
2-
3-
@inject IReleaseService releaseService
4-
51
@{
62
ViewBag.Title = "Linux Installation Guide";
7-
var release = await releaseService.GetLatestRelease();
8-
var assets = await release.GetReleaseAssets();
9-
var deb = assets.FirstOrDefault(a => a.FileName == "OpenTabletDriver.deb")!;
103
}
114

125
<h3 class="wiki-nav-item" id="debian">
136
Ubuntu / Debian
147
</h3>
158
<ol>
169
<li>
17-
Download the <a href="@deb.Url">latest release</a>
10+
Download the
11+
<a href="/Release/Download/OpenTabletDriver.deb">latest release</a>
1812
<small class="text-muted">(OpenTabletDriver.deb)</small>
1913
</li>
2014
<li>
@@ -73,7 +67,7 @@
7367
<p>
7468
Alternatively, you can install <code>opentabletdriver</code> without an AUR helper.
7569
</p>
76-
<li>
70+
<li>
7771
Run the following commands in a terminal to install and enable the OpenTabletDriver service.
7872
<codeblock class="mt-2" language="bash">
7973
# Downloads the pkgbuild from the AUR.
Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,14 @@
1-
@using OpenTabletDriver.Web.Core.Services
2-
@inject IReleaseService releaseService
3-
41
@{
52
ViewBag.Title = "macOS Installation Guide";
6-
var release = await releaseService.GetLatestRelease();
7-
var assets = await release.GetReleaseAssets();
8-
var asset = assets.First(a => a.FileName.Contains("osx-x64"));
93
}
104

115
<h3 class="wiki-nav-item" id="app">
126
App
137
</h3>
148
<ol>
159
<li>
16-
Download the <a href="@asset.Url">latest release</a>
10+
Download the
11+
<a href="/Release/Download/OpenTabletDriver.osx-x64.tar.gz">latest release</a>
1712
<small class="text-muted">(OpenTabletDriver-osx-x64.tar.gz)</small>
1813
</li>
1914
<li>
@@ -22,4 +17,4 @@
2217
<li>
2318
Run the OpenTabletDriver app.
2419
</li>
25-
</ol>
20+
</ol>

OpenTabletDriver.Web/Views/Wiki/Install/Windows.cshtml

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,5 @@
1-
@using OpenTabletDriver.Web.Core.Services
2-
3-
@inject IReleaseService releaseService
4-
51
@{
62
ViewBag.Title = "Windows Installation Guide";
7-
var release = await releaseService.GetLatestRelease();
8-
var assets = await release.GetReleaseAssets();
9-
var winzip = assets.FirstOrDefault(a => a.FileName == "OpenTabletDriver.win-x64.zip")!;
103
}
114

125
<h3 class="wiki-nav-item" id="dependencies">
@@ -39,7 +32,7 @@
3932
<ol>
4033
<li>
4134
Download the
42-
<a href="@(winzip.Url)">latest release</a>
35+
<a href="/Release/Download/OpenTabletDriver.win-x64.zip">latest release</a>
4336
<small class="text-muted">(OpenTabletDriver-win-x64.zip)</small>
4437
</li>
4538
<li>
@@ -72,7 +65,10 @@
7265
requires WinUSB, and if it does, what interface. Check the <a href="/Tablets">supported list of tablets here</a>.
7366
</p>
7467
<ol>
75-
<li>If your tablet <b>does</b> require WinUSB download it from <a href="https://github.com/pbatard/libwdi/releases/download/b755/zadig-2.6.exe">here</a>.</li>
68+
<li>
69+
If your tablet <b>does</b> require WinUSB download it from
70+
<a href="https://github.com/pbatard/libwdi/releases/download/b755/zadig-2.6.exe">here</a>.
71+
</li>
7672
<li>Start Zadig.</li>
7773
<li>Go to <code>Options > show all devices</code></li>
7874
<li>Find your tablet on the device list and the interface.</li>

0 commit comments

Comments
 (0)