Browse Source

Merge branch 'master' of ssh://gitea.ennucore.com:2222/agorata/frontend

master
Aleksandr Bautin 1 year ago
parent
commit
34b767d631
No known key found for this signature in database
GPG Key ID: 9B3364A12DFE9211
  1. 4
      src/api.ts
  2. 27
      src/components/SiteSettings.vue
  3. 14
      src/views/Explore.vue

4
src/api.ts

@ -15,13 +15,13 @@ export class Api {
public readonly tonviewer_url: string; public readonly tonviewer_url: string;
constructor() { constructor() {
if (process.env.NODE_ENV === "development") { if (process.env.NODE_ENV === "development" && false) {
this.api_url = "http://localhost:5170/"; this.api_url = "http://localhost:5170/";
this.ton_api_url = "https://testnet.tonapi.io/v2/"; this.ton_api_url = "https://testnet.tonapi.io/v2/";
this.tonscan_url = "https://testnet.tonscan.org/"; this.tonscan_url = "https://testnet.tonscan.org/";
this.tonviewer_url = "https://testnet.tonviewer.com/"; this.tonviewer_url = "https://testnet.tonviewer.com/";
} else { } else {
this.api_url = "https://api.agorata.io/"; this.api_url = "https://agorata.io/api/";
this.ton_api_url = "https://tonapi.io/v2/"; this.ton_api_url = "https://tonapi.io/v2/";
this.tonscan_url = "https://tonscan.org/"; this.tonscan_url = "https://tonscan.org/";
this.tonviewer_url = "https://testnet.tonviewer.com/"; this.tonviewer_url = "https://testnet.tonviewer.com/";

27
src/components/SiteSettings.vue

@ -57,7 +57,7 @@
<div <div
:class="{ :class="{
get_b: true, get_b: true,
inactive: !siteChanged, inactive: inactiveSave,
signing: signingSite, signing: signingSite,
}" }"
@click="$emit('save')" @click="$emit('save')"
@ -96,11 +96,22 @@
</template> </template>
</Switcher> </Switcher>
<TemplatesList <TemplatesList
@save-constructor="$emit('save-constructor')"
:site-changed="siteChanged" :site-changed="siteChanged"
:templates="templates" :templates="templates"
:active-template-name="activeTemplateName" :active-template-name="activeTemplateName"
:constructor-changed="constructorChanged"
:site_rec_init="site_rec_init"
:signing-site="signingSite" :signing-site="signingSite"
@change="
site_rec = $event;
$emit('change', site_rec_patched);
"
@change-constructor="
constructor_params = $event;
$emit('change-constructor', constructor_params);
"
@save="$emit('save', $event)"
@save-constructor="$emit('save-constructor', $event)"
/> />
</div> </div>
</div> </div>
@ -141,7 +152,10 @@ export default {
}, },
data() { data() {
let site_rec = this.site_rec_init; let site_rec = this.site_rec_init;
if (!site_rec) site_rec = config.agorata_adnl; if (!site_rec) {
site_rec = config.agorata_adnl;
this.$emit("change", this.site_rec);
}
let constructor_site = let constructor_site =
site_rec.toLowerCase() === config.agorata_adnl.toLowerCase(); site_rec.toLowerCase() === config.agorata_adnl.toLowerCase();
return { return {
@ -196,6 +210,9 @@ export default {
templateId() { templateId() {
return this.templateId; return this.templateId;
}, },
inactiveSave() {
return !this.siteChanged && this.site_rec !== null;
},
link_types() { link_types() {
// return the types from link_types that are not in the constructor_params.contacts // return the types from link_types that are not in the constructor_params.contacts
return link_types.filter( return link_types.filter(
@ -233,6 +250,10 @@ export default {
}, },
mounted() { mounted() {
this.setTemplates(); this.setTemplates();
if (this.site_rec === null) {
this.site_rec = config.agorata_adnl;
this.$emit("change", this.site_rec);
}
}, },
}; };
</script> </script>

14
src/views/Explore.vue

@ -229,7 +229,10 @@ export default {
this.constructor_params !== this.saved_constructor_params; this.constructor_params !== this.saved_constructor_params;
} }
return ( return (
this.records && (this.site_rec !== this.records.site || constr_change) (this.records &&
(this.site_rec !== this.records.site || constr_change)) ||
(!this.records && constr_change) ||
(this.records !== null && this.site_rec === null)
); );
}, },
settingsCompLoaded() { settingsCompLoaded() {
@ -300,6 +303,7 @@ export default {
if (this.site_rec !== this.records.site) { if (this.site_rec !== this.records.site) {
await this.saveSite(); await this.saveSite();
} }
this.constructor_params.domain = this.domain;
await call_api_post("set-site-data", this.constructor_params); await call_api_post("set-site-data", this.constructor_params);
this.saved_constructor_params = this.constructor_params; this.saved_constructor_params = this.constructor_params;
this.updSettingsComponent(); this.updSettingsComponent();
@ -332,11 +336,15 @@ export default {
records: function (val) { records: function (val) {
if (val) { if (val) {
this.wallet_rec = val.wallet; this.wallet_rec = val.wallet;
this.site_rec = val.site; if (!this.site_rec || val.site) {
this.site_rec = val.site;
}
} }
}, },
site_rec() { site_rec() {
this.$refs.site_settings.set_site_rec(this.site_rec); if (this.$refs.site_settings) {
this.$refs.site_settings.set_site_rec(this.site_rec);
}
}, },
saved_constructor_params() { saved_constructor_params() {
this.$refs.site_settings.saved_constructor_params = this.$refs.site_settings.saved_constructor_params =

Loading…
Cancel
Save