added instance handle in user page
This commit is contained in:
parent
f6145aceb0
commit
b7acb4c907
4 changed files with 36 additions and 5 deletions
|
@ -6,7 +6,9 @@ using System.Net.Mime;
|
|||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using BirdsiteLive.ActivityPub;
|
||||
using BirdsiteLive.Common.Settings;
|
||||
using BirdsiteLive.Domain;
|
||||
using BirdsiteLive.Models;
|
||||
using BirdsiteLive.Twitter;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
@ -20,13 +22,15 @@ namespace BirdsiteLive.Controllers
|
|||
private readonly ITwitterService _twitterService;
|
||||
private readonly IUserService _userService;
|
||||
private readonly IStatusService _statusService;
|
||||
private readonly InstanceSettings _instanceSettings;
|
||||
|
||||
#region Ctor
|
||||
public UsersController(ITwitterService twitterService, IUserService userService, IStatusService statusService)
|
||||
public UsersController(ITwitterService twitterService, IUserService userService, IStatusService statusService, InstanceSettings instanceSettings)
|
||||
{
|
||||
_twitterService = twitterService;
|
||||
_userService = userService;
|
||||
_statusService = statusService;
|
||||
_instanceSettings = instanceSettings;
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
@ -45,7 +49,17 @@ namespace BirdsiteLive.Controllers
|
|||
return Content(jsonApUser, "application/activity+json; charset=utf-8");
|
||||
}
|
||||
|
||||
return View(user);
|
||||
var displayableUser = new DisplayTwitterUser
|
||||
{
|
||||
Name = user.Name,
|
||||
Description = user.Description,
|
||||
Acct = user.Acct,
|
||||
Url = user.Url,
|
||||
ProfileImageUrl = user.ProfileImageUrl,
|
||||
|
||||
InstanceHandle = $"@{user.Acct}@{_instanceSettings.Domain}"
|
||||
};
|
||||
return View(displayableUser);
|
||||
}
|
||||
|
||||
[Route("/@{id}/{statusId}")]
|
||||
|
@ -81,7 +95,7 @@ namespace BirdsiteLive.Controllers
|
|||
using (var reader = new StreamReader(Request.Body))
|
||||
{
|
||||
var body = await reader.ReadToEndAsync();
|
||||
//System.IO.File.WriteAllText($@"C:\apdebug\{Guid.NewGuid()}.json", body);
|
||||
System.IO.File.WriteAllText($@"C:\apdebug\{Guid.NewGuid()}.json", body);
|
||||
|
||||
var activity = ApDeserializer.ProcessActivity(body);
|
||||
// Do something
|
||||
|
|
13
src/BirdsiteLive/Models/DisplayTwitterUser.cs
Normal file
13
src/BirdsiteLive/Models/DisplayTwitterUser.cs
Normal file
|
@ -0,0 +1,13 @@
|
|||
namespace BirdsiteLive.Models
|
||||
{
|
||||
public class DisplayTwitterUser
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string Description { get; set; }
|
||||
public string Acct { get; set; }
|
||||
public string Url { get; set; }
|
||||
public string ProfileImageUrl { get; set; }
|
||||
|
||||
public string InstanceHandle { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,4 +1,5 @@
|
|||
@model BirdsiteLive.Twitter.Models.TwitterUser
|
||||
@using Tweetinvi.Streams.Model.AccountActivity
|
||||
@model DisplayTwitterUser
|
||||
@{
|
||||
ViewData["Title"] = "User";
|
||||
}
|
||||
|
@ -28,7 +29,9 @@
|
|||
|
||||
</div>
|
||||
</a>
|
||||
<br/>
|
||||
<br />
|
||||
<br />
|
||||
<p>Search this handle to find it in your instance:</p>
|
||||
|
||||
<input type="text" name="textbox" value=" @ViewData.Model.InstanceHandle" onclick="this.select()" class="form-control" readonly/>
|
||||
</div>
|
|
@ -53,6 +53,7 @@
|
|||
|
||||
.sub-profile {
|
||||
padding: 10px 15px;
|
||||
min-height: 80px;
|
||||
}
|
||||
|
||||
/*.sub-profile a {
|
||||
|
|
Reference in a new issue