Only upload file if file set

FossilOrigin-Name: d1c469b86118c321978abdcd338ec268ca41b52ccd908e417bb17cfdb46424f0
This commit is contained in:
me@ow.nekobit.net 2022-04-12 19:13:57 +00:00
parent 3a2d946c88
commit 3db8081bfc
5 changed files with 101 additions and 48 deletions

34
dist/treebird20.css vendored
View file

@ -11,8 +11,16 @@
padding: 0;
}
html, body
{
margin: 0;
padding: 0;
margin-top: 0px;
}
html
{
height: 100%;
background-color: #f6f6f6;
}
@ -22,16 +30,35 @@ body
background-size: cover !important;
background-color: unset;
font-family: Arial, Helvetica, sans-serif;
min-height: 100%;
}
/* Basic elements */
h1, h2, h3, h4
{
margin: 12px 0px 6px 0px;
}
ul
{
margin: 12px;
}
#main-page-container
{
padding: 8px;
}
#main-page
{
margin: 8px;
margin-top: 0;
width: 1000px;
border-top: 0 !important;
margin-left: auto;
margin-right: auto;
border: 1px solid #dadada !important;
border: 1px solid #bbbbbb !important;
box-shadow: 0px 2px 5px rgba(0, 0, 0, 0.3);
border-width: 0;
border-radius: 5px;
@ -93,7 +120,7 @@ table.ui-table td
{
vertical-align: middle;
display: inline-block;
margin: 4px 3px 5px 14px;
margin: 4px 0px 6px 18px;
}
#navbar span.info
@ -107,11 +134,10 @@ table.ui-table td
#navbar-right-container
{
width: 782px;
width: 795px;
display: inline-block;
position: relative;
top: 9px;
padding-right: 8px;
align-items: center;
}

25
dist/treebird40.css vendored
View file

@ -11,8 +11,16 @@
padding: 0;
}
html, body
{
margin: 0;
padding: 0;
margin-top: 0px;
}
html
{
height: 100%;
background-color: #f6f6f6;
}
@ -22,6 +30,23 @@ body
background-size: cover !important;
background-color: unset;
font-family: Arial, Helvetica, sans-serif;
min-height: 100%;
}
/* Basic elements */
h1, h2, h3, h4
{
margin: 12px 0px 6px 0px;
}
ul
{
margin: 12px;
}
#main-page-container
{
padding: 8px;
}
#main-page

View file

@ -38,7 +38,8 @@ int try_upload_media(struct mstdnt_storage* storage,
struct mstdnt_attachment** attachments,
char*** media_ids)
{
if (!ssn->post.files.array_size)
if (!ssn->post.files.array_size ||
!(ssn->post.files.content && ssn->post.files.content[0].content_size))
return 1;
if (media_ids)

View file

@ -60,14 +60,12 @@ int set_config_int(int* ssn,
void load_config(struct session* ssn, mastodont_t* api)
{
if (ssn->post.theme && ssn->post.files.array_size && ssn->post.files.content[0].content_size)
if (ssn->post.theme)
{
struct mstdnt_attachment* attachments = NULL;
struct mstdnt_storage storage = { 0 };
if (try_upload_media(&storage, ssn, api, &attachments, NULL) == 0)
{
set_config_str(&(ssn->config.background_url), "background_url", attachments[0].url);
}
}
set_config_str(&(ssn->config.theme), "theme", ssn->post.theme);
set_config_int(&(ssn->config.themeclr), "themeclr", ssn->post.themeclr);

View file

@ -7,48 +7,51 @@
<link rel="stylesheet" type="text/css" href="/%s%s.css">
</head>
<body %s>
<div id="main-page">
<header id="navbar">
<a href="%s/"><img src="/treebird_logo.png" height="42"></a>
<span class="info">%s</span>
<div id="navbar-right-container">
<div id="navbar-right">
%s
<!-- Searchbox -->
<form action="%s/search" method="get">
<input type="textbox" class="group group-left group-inputbox" placeholder="%s" id="searchbox" name="q"><!-- i hate HTML
--><input type="submit" class="btn group group-right" value="%s">
</form>
<div></div>
<div id="main-page-container">
<div id="main-page">
<header id="navbar">
<a href="%s/"><img src="/treebird_logo.png" height="42"></a>
<span class="info">%s</span>
<div id="navbar-right-container">
<div id="navbar-right">
%s
<!-- Searchbox -->
<form action="%s/search" method="get">
<input type="textbox" class="group group-left group-inputbox" placeholder="%s" id="searchbox" name="q"><!-- i hate HTML
--><input type="submit" class="btn group group-right" value="%s">
</form>
</div>
</div>
</div>
</header>
<table id="content" class="ui-table">
<!-- Navigation -->
<tr>
<td id="leftbar" class="sidebar">
<ul>
<li><a class="sidebarbtn %s" href="%s/">%s</a></li>
<li><a class="sidebarbtn %s" href="%s/local/">%s</a></li>
<li><a class="sidebarbtn %s" href="%s/federated/">%s</a></li>
<li><a class="sidebarbtn %s" href="%s/notifications">%s</a></li>
<li><a class="sidebarbtn %s" href="%s/lists">%s</a></li>
<li><a class="sidebarbtn %s" href="%s/direct">%s</a></li>
<li><a class="sidebarbtn %s" href="%s/config">%s</a></li>
</ul>
%s
</td>
<!-- Display for posts -->
<td id="main">
%s
</td>
</header>
<table id="content" class="ui-table">
<!-- Navigation -->
<tr>
<td id="leftbar" class="sidebar">
<ul>
<li><a class="sidebarbtn %s" href="%s/">%s</a></li>
<li><a class="sidebarbtn %s" href="%s/local/">%s</a></li>
<li><a class="sidebarbtn %s" href="%s/federated/">%s</a></li>
<li><a class="sidebarbtn %s" href="%s/notifications">%s</a></li>
<li><a class="sidebarbtn %s" href="%s/lists">%s</a></li>
<li><a class="sidebarbtn %s" href="%s/direct">%s</a></li>
<li><a class="sidebarbtn %s" href="%s/config">%s</a></li>
</ul>
%s
</td>
<!-- Display for posts -->
<td id="main">
%s
</td>
<!-- Notifications and such -->
<td id="rightbar" class="sidebar">
%s
</td>
</tr>
</table>
<!-- Notifications and such -->
<td id="rightbar" class="sidebar">
%s
</td>
</tr>
</table>
</div>
</div>
</body>
</html>