add: PORT env var
This commit is contained in:
parent
52c8983634
commit
5961999ce4
9 changed files with 58 additions and 4 deletions
|
@ -82,7 +82,11 @@ async fn main() {
|
|||
.compact()
|
||||
.init();
|
||||
|
||||
let config = config::Config::get_config();
|
||||
let mut config = config::Config::get_config();
|
||||
if let Ok(port) = var("PORT") {
|
||||
let port = port.parse::<u16>().expect("port should be a u16");
|
||||
config.port = port;
|
||||
}
|
||||
|
||||
// init
|
||||
init_dirs(&config).await;
|
||||
|
|
|
@ -94,7 +94,7 @@
|
|||
(text "{{ dislikes }}"))
|
||||
(text "{%- endif %}"))
|
||||
|
||||
(text "{%- endif %} {%- endmacro %} {% macro full_username(user) -%}")
|
||||
(text "{%- endif %} {%- endmacro %} {% macro full_username(user) -%} {% if user and user.username -%}")
|
||||
(div
|
||||
("class" "flex items-center")
|
||||
(a
|
||||
|
@ -110,8 +110,7 @@
|
|||
("class" "flex items-center")
|
||||
(text "{{ icon \"badge-check\" }}"))
|
||||
(text "{%- endif %}"))
|
||||
|
||||
(text "{%- endmacro %} {% macro repost(repost, post, owner, secondary=false, community=false, show_community=true, can_manage_post=false) -%}")
|
||||
(text "{%- endif %} {%- endmacro %} {% macro repost(repost, post, owner, secondary=false, community=false, show_community=true, can_manage_post=false) -%}")
|
||||
(div
|
||||
("style" "display: contents")
|
||||
(text "{{ self::post(post=post, owner=owner, secondary=secondary, community=community, show_community=show_community, can_manage_post=can_manage_post, repost=repost, expect_repost=true) }}"))
|
||||
|
|
|
@ -326,6 +326,7 @@
|
|||
|
||||
(div
|
||||
("data-tab" "editor")
|
||||
("class" "flex flex-col gap-2")
|
||||
(div
|
||||
("class" "flex flex-col gap-2 card")
|
||||
("style" "animation: fadein ease-in-out 1 0.5s forwards running")
|
||||
|
|
|
@ -1359,6 +1359,11 @@
|
|||
\"{{ profile.settings.show_nsfw }}\",
|
||||
\"checkbox\",
|
||||
],
|
||||
[
|
||||
[\"auto_unlist\", \"Automatically mark my posts as NSFW\"],
|
||||
\"{{ profile.settings.auto_unlist }}\",
|
||||
\"checkbox\",
|
||||
],
|
||||
[[], \"Questions\", \"title\"],
|
||||
[
|
||||
[
|
||||
|
|
|
@ -1194,6 +1194,7 @@ ${option.input_element_type === "textarea" ? `${option.value}</textarea>` : ""}
|
|||
self.IO_DATA_TMPL = tmpl;
|
||||
self.IO_DATA_PAGE = page;
|
||||
self.IO_DATA_SEEN_IDS = [];
|
||||
self.IO_DATA_WAITING = false;
|
||||
|
||||
if (!paginated_mode) {
|
||||
self.IO_DATA_OBSERVER.observe(self.IO_DATA_MARKER);
|
||||
|
@ -1208,6 +1209,11 @@ ${option.input_element_type === "textarea" ? `${option.value}</textarea>` : ""}
|
|||
});
|
||||
|
||||
self.define("io_load_data", async () => {
|
||||
if (self.IO_DATA_WAITING) {
|
||||
return;
|
||||
}
|
||||
|
||||
self.IO_DATA_WAITING = true;
|
||||
self.IO_DATA_PAGE += 1;
|
||||
console.log("load page", self.IO_DATA_PAGE);
|
||||
|
||||
|
@ -1220,6 +1226,7 @@ ${option.input_element_type === "textarea" ? `${option.value}</textarea>` : ""}
|
|||
await fetch(`${self.IO_DATA_TMPL}${self.IO_DATA_PAGE}`)
|
||||
).text();
|
||||
|
||||
self.IO_DATA_WAITING = false;
|
||||
self.IO_DATA_ELEMENT.querySelector("[ui_ident=loading_skel]").remove();
|
||||
|
||||
if (
|
||||
|
|
|
@ -1795,6 +1795,11 @@ impl DataManager {
|
|||
);
|
||||
}
|
||||
|
||||
// auto unlist
|
||||
if owner.settings.auto_unlist {
|
||||
data.context.is_nsfw = true;
|
||||
}
|
||||
|
||||
// ...
|
||||
let conn = match self.0.connect().await {
|
||||
Ok(c) => c,
|
||||
|
|
|
@ -237,6 +237,9 @@ pub struct UserSettings {
|
|||
/// If drawings are enabled for questions sent to the user.
|
||||
#[serde(default)]
|
||||
pub enable_drawings: bool,
|
||||
/// Automatically unlist posts from timelines.
|
||||
#[serde(default)]
|
||||
pub auto_unlist: bool,
|
||||
}
|
||||
|
||||
fn mime_avif() -> String {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue