added design account

This commit is contained in:
Nicolas Constant 2020-03-22 16:38:15 -04:00
parent 32337058c5
commit c84694079a
No known key found for this signature in database
GPG key ID: 1E9F677FB01A5688
7 changed files with 61 additions and 8 deletions

View file

@ -7,5 +7,7 @@
public string Url { get; set; }
public string ProfileImageUrl { get; set; }
public string ProfileBackgroundImageUrl { get; set; }
public string Acct { get; set; }
public string ProfileBannerURL { get; set; }
}
}

View file

@ -24,16 +24,20 @@ namespace BirdsiteLive.Twitter
public TwitterUser GetUser(string username)
{
Auth.SetUserCredentials(_settings.ConsumerKey, _settings.ConsumerSecret, _settings.AccessToken, _settings.AccessTokenSecret);
//Auth.SetUserCredentials(_settings.ConsumerKey, _settings.ConsumerSecret, _settings.AccessToken, _settings.AccessTokenSecret);
Auth.SetApplicationOnlyCredentials(_settings.ConsumerKey, _settings.ConsumerSecret, true);
var user = User.GetUserFromScreenName(username);
if (user == null) return null;
return new TwitterUser
{
Acct = username,
Name = user.Name,
Description = user.Description,
Url = user.Url,
ProfileImageUrl = user.ProfileImageUrl,
ProfileBackgroundImageUrl = user.ProfileBackgroundImageUrl
ProfileImageUrl = user.ProfileImageUrlFullSize,
ProfileBackgroundImageUrl = user.ProfileBackgroundImageUrlHttps,
ProfileBannerURL = user.ProfileBannerURL
};
}
}

View file

@ -24,6 +24,7 @@ namespace BirdsiteLive.Controllers
public IActionResult Index(string id)
{
var user = _twitterService.GetUser(id);
if (user == null) return NotFound();
var r = Request.Headers["Accept"].First();

View file

@ -51,7 +51,9 @@ namespace BirdsiteLive.Controllers
if (!string.IsNullOrWhiteSpace(domain) && domain != _settings.Domain)
return NotFound();
//TODO: check if twitter user exists
var user = _twitterService.GetUser(name);
if (user == null)
return NotFound();
var result = new WebFingerResult()
{

View file

@ -6,6 +6,7 @@
<title>@ViewData["Title"] - BirdsiteLive</title>
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" />
<link rel="stylesheet" href="~/css/site.css" />
<link rel="stylesheet" href="~/css/birdsite.css" />
</head>
<body>
<header>

View file

@ -1,10 +1,18 @@

@model BirdsiteLive.Twitter.Models.TwitterUser
@{
ViewData["Title"] = "User";
}
<h1>User</h1>
<div class="profile" style="background-image: url('@ViewData.Model.ProfileBannerURL');">
<div class="sub-profile">
<img class="avatar" src="@ViewData.Model.ProfileImageUrl" />
@ViewData.Model.Name
<h1>@ViewData.Model.Name</h1>
<h2>@@@ViewData.Model.Acct</h2>
@ViewData.Model.Description
<div class="description">
@ViewData.Model.Description
</div>
</div>
</div>

View file

@ -0,0 +1,35 @@
.profile {
border: 1px #dddddd solid;
border-radius: 5px;
background-repeat: no-repeat;
/*background-attachment: fixed;*/
background-position: center;
}
.profile h1 {
font-size: 32px;
margin-left: 120px;
padding-top: 8px;
}
.profile h2 {
font-size: 20px;
margin-left: 120px;
}
.sub-profile {
padding: 20px;
background-color: rgba(255, 255, 255, 0.7);
}
.avatar {
float: left;
width: 100px;
border-radius: 50%;
}
.description {
margin-top: 40px;
margin-left: 20px;
font-weight: bold;
}