Skip to content

Commit

Permalink
Terms and conditions (#14)
Browse files Browse the repository at this point in the history
* doc: add terms and conditions

* feat: add markdown lib

* feat: show terms and conditions

* refactor: extrac terms and conditions URL
  • Loading branch information
motorina0 authored Jul 23, 2024
1 parent 2c7c980 commit 3a782b1
Show file tree
Hide file tree
Showing 7 changed files with 120 additions and 6 deletions.
24 changes: 24 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"nostr-tools": "^2.7.0",
"pinia": "^2.1.7",
"quasar": "^2.16.4",
"showdown": "^2.1.0",
"vue": "^3.0.0",
"vue-echarts": "^6.7.3",
"vue-i18n": "^9.13.1",
Expand Down
2 changes: 2 additions & 0 deletions quasar.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ export default configure((/* ctx */) => {
env: {
apiUrl: "",
domainID: "3dYkq5gtM4bEipi62KFAUf",
termsAndConditionsUrl:
"https://raw.githubusercontent.com/lnbits/my.nostr.com/terms_and_conditions/terms_and_conditions.md",
// dev vars:
// apiUrl: "https://localhost:9000",
// domainID: "gUpdtMxSAzdWfB9PnyxGRM",
Expand Down
18 changes: 17 additions & 1 deletion src/boot/utils.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import axios from "axios";
import { Converter } from "showdown";

function secondsToDhm(seconds) {
seconds = Number(seconds);
const d = Math.floor(seconds / (3600 * 24));
Expand Down Expand Up @@ -79,4 +82,17 @@ function getTagValue(event, tag) {
return event.tags.find(([k, v]) => k == tag)?.[1];
}

export { secondsToDhm, timeFromNow, getTagValues };
async function markdownToHTML(url) {
const response = await axios({
method: "GET",
withCredentials: false,
url,
});

const converter = new Converter();
converter.setFlavor("github");
converter.setOption("simpleLineBreaks", true);
return converter.makeHtml(response.data);
}

export { secondsToDhm, timeFromNow, getTagValues, markdownToHTML };
1 change: 1 addition & 0 deletions src/layouts/MainLayout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
<q-btn
to="/login"
rounded
class="text-capitalize"
color="secondary"
text-color="primary"
label="Account"
Expand Down
52 changes: 47 additions & 5 deletions src/pages/Login.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,39 @@
<template>
<q-page class="flex flex-center">
<q-card
v-if="isTermsAndConditionsRequest"
v-bind:style="
q.screen.lt.sm
? { width: '80%', marginTop: '3.5rem' }
: { width: '70%', minWidth: '350px' }
"
>
<q-card-section v-if="termsAndConditions">
<div v-html="termsAndConditions"></div>
<q-separator></q-separator>
<q-btn
label="Agree and Register"
@click="register"
type="submit"
color="secondary"
class="full-width q-mt-sm text-capitalize"
:disable="inProgress"
/>
<q-btn

@click="isTermsAndConditionsRequest = false"
label="Back"
type="button"
class="full-width q-mt-md"
color="grey"
/>
</q-card-section>
<q-card-section v-else class="q-ma-xl q-pa-md"
>Terms and Conditions loading....
</q-card-section>
</q-card>
<q-card
v-else
v-bind:style="
q.screen.lt.sm
? { width: '80%', marginTop: '3.5rem' }
Expand Down Expand Up @@ -73,7 +106,7 @@
@click="login"
type="submit"
color="primary"
class="full-width"
class="full-width text-capitalize"
:disable="inProgress"
/>

Expand All @@ -86,7 +119,7 @@
@click="signup"
type="submit"
color="secondary"
class="full-width q-mt-sm"
class="full-width q-mt-sm text-capitalize"
:disable="inProgress"
/>
<q-btn
Expand All @@ -109,6 +142,7 @@ import { ref } from "vue";
import { useQuasar } from "quasar";
import { useAppStore } from "src/stores/store";
import { markdownToHTML } from "boot/utils";
import { saas } from "boot/saas";
export default defineComponent({
Expand All @@ -123,10 +157,12 @@ export default defineComponent({
password: ref(""),
passwordRepeat: ref(""),
isSignupRequest: ref(false),
isTermsAndConditionsRequest: ref(false),
inProgress: ref(false),
termsAndConditions: ref(""),
};
},
created() {
async created() {
if (this.$route.query.signup) {
this.isSignupRequest = true;
}
Expand Down Expand Up @@ -208,6 +244,10 @@ export default defineComponent({
await this.login();
}
},
async showTermsAndConditions() {
this.isTermsAndConditionsRequest = true;
this.termsAndConditions = await markdownToHTML(process.env.termsAndConditionsUrl);
},
async signup() {
if (!this.isSignupRequest) {
this.isSignupRequest = true;
Expand All @@ -222,7 +262,9 @@ export default defineComponent({
});
return;
}
this.showTermsAndConditions();
},
async register() {
try {
this.inProgress = true;
await saas.signup(this.username, this.password, this.passwordRepeat);
Expand All @@ -236,7 +278,7 @@ export default defineComponent({
console.warn(error);
this.q.notify({
message: "Failed to register!",
caption: saas.mapErrorToString(error),
caption: error.response?.data?.detail,
color: "negative",
icon: "warning",
});
Expand Down
28 changes: 28 additions & 0 deletions terms_and_conditions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
### Terms and Conditions

Terms and Conditions for Nostr.com Services Provided by LNbits LLC

**Services**: [nostr.com](https://nostr.com)

#### 1. Acceptance of Terms
By accessing and using the services provided by LNbits LLC, you agree to be bound by these Terms and Conditions ("Terms"). If you do not agree with any part of these Terms, you should not use our services.

#### 2. NIP05 Identifiers
- **Ownership**: The NIP05 identifiers provided by LNbits LLC remain the property of LNbits LLC. The use of an identifier by a user does not grant any ownership rights.
- **Revocation and Refund Policy**: LNbits reserves the right to rescind access to any NIP05 identifier at any time and for any reason, at our discretion. In such cases, LNbits may provide a refund for any remaining period of your service, also at our discretion.
- **Renewal**: To continue the use of the NIP05 identifier, you must renew the identifier before the expiry of the current term. Failure to renew on time may result in the termination of service.

#### 3. Nostr Relay Service
- **Usage**: The paid Nostr relay service provided by LNbits LLC must not be used for the transmission or storage of illegal content. Users are responsible for ensuring that all content transmitted via our relays complies with applicable laws and regulations.
- **Service Level and Liability**: LNbits LLC does not offer any Service Level Agreement (SLA) for uptime or continuous availability of the relay service. LNbits will not be liable for any loss, damages, or inconvenience caused due to interruptions or performance issues with the relay service.
- **Illegal Use**: LNbits LLC prohibits the use of its relay service for any illegal activities. Any detected illegal use of the service will result in immediate termination of the service and may lead to legal action.

#### 4. Limitation of Liability
LNbits LLC shall not be liable for any direct, indirect, incidental, special, consequential, or exemplary damages resulting from the use or inability to use our services. This limitation of liability shall apply to the fullest extent permitted by law in the applicable jurisdiction.

#### 5. Modifications to Terms
LNbits LLC reserves the right to modify these Terms at any time. Your continued use of our services after any such changes constitutes your acceptance of the new Terms.

#### 6. Governing Law
These Terms shall be governed by and construed in accordance with the laws of the jurisdiction in which LNbits LLC is incorporated, without regard to its conflict of law provisions.
s

0 comments on commit 3a782b1

Please sign in to comment.