From bb9643fa12124f9a072e9a2a192d9726eac30b5a Mon Sep 17 00:00:00 2001 From: nekobit Date: Tue, 24 May 2022 06:40:14 +0000 Subject: [PATCH] Fix background image upload FossilOrigin-Name: d49f0fd8eaa657908148bd3194ccdb2a8bc9a26945fa807f61f7c43d27e7477b --- src/local_config_set.c | 26 ++++++++------- static/attachment_audio.html | 2 +- static/config_general.html | 64 ++++++++++++++++++------------------ static/instance.html | 1 + 4 files changed, 48 insertions(+), 45 deletions(-) create mode 100644 static/instance.html diff --git a/src/local_config_set.c b/src/local_config_set.c index 7d63507..5f193bc 100644 --- a/src/local_config_set.c +++ b/src/local_config_set.c @@ -65,19 +65,21 @@ int set_config_int(struct session* ssn, void load_config(struct session* ssn, mastodont_t* api) { - // TODO update - /* if (ssn->post.theme) */ - /* { */ - /* struct mstdnt_attachment* attachments = NULL; */ - /* struct mstdnt_storage* storage = NULL; */ - /* if (try_upload_media(&storage, ssn, api, &attachments, NULL) == 0) */ - /* { */ - /* set_config_str(&(ssn->config.background_url), "background_url", attachments[0].url); */ - /* } */ + if (ssn->post.set.is_set) + { + struct mstdnt_attachment* attachments = NULL; + struct mstdnt_storage* storage = NULL; + if (try_upload_media(&storage, ssn, api, &attachments, NULL) == 0) + { + struct key atm = { .type.s = attachments[0].url, .is_set = 1 }; + set_config_str(ssn, &(ssn->config.background_url), "background_url", &(atm), &(ssn->cookies.background_url)); + } - /* if (storage) */ - /* cleanup_media_storages(ssn, storage); */ - /* } */ + if (storage) + cleanup_media_storages(ssn, storage); + } + if (!ssn->post.set.is_set) + ssn->config.background_url = keystr(ssn->cookies.background_url); set_config_str(LOAD_CFG_SIM("theme", theme)); set_config_int(LOAD_CFG_SIM("themeclr", themeclr)); set_config_int(LOAD_CFG_SIM("jsactions", jsactions)); diff --git a/static/attachment_audio.html b/static/attachment_audio.html index 013fecd..dd946a7 100644 --- a/static/attachment_audio.html +++ b/static/attachment_audio.html @@ -1,7 +1,7 @@
- +
diff --git a/static/config_general.html b/static/config_general.html index f470748..252ea41 100644 --- a/static/config_general.html +++ b/static/config_general.html @@ -10,54 +10,54 @@ -
  • - - -
  • -
  • - - -
  • -
  • - - -
  • + + + + + + + + + + + +

    Statuses

    Instance