diff --git a/config.json b/config.json index 268c1fb..78b2727 100644 --- a/config.json +++ b/config.json @@ -2,7 +2,32 @@ "name": "Build your own!", "short_description": "Extension building guide", "tile": "/example/static/bitcoin-extension.png", - "contributors": ["github_username"], "min_lnbits_version": "0.12.6", - "donate": "donate@legend.lnbits.com" + "donate": "donate@legend.lnbits.com", + "contributors": [ + { + "name": "Ben Arc", + "uri": "mailto:ben@lnbits.com", + "role": "Developer" + }, + { + "name": "DNI", + "uri": "https://github.com/dni", + "role": "Developer" + } + ], + "images": [ + { + "uri": "/example/static/1.png" + }, + { + "uri": "/example/static/2.png" + }, + { + "uri": "/example/static/3.png" + } + ], + "descrition_md": "https://raw.githubusercontent.com/lnbits/example/main/README.md", + "terms_and_conditions_md": "https://raw.githubusercontent.com/lnbits/example/main/toc.md", + "license": "MIT" } diff --git a/static/1.png b/static/1.png new file mode 100644 index 0000000..10b3673 Binary files /dev/null and b/static/1.png differ diff --git a/static/2.png b/static/2.png new file mode 100644 index 0000000..c62770f Binary files /dev/null and b/static/2.png differ diff --git a/static/3.png b/static/3.png new file mode 100644 index 0000000..343f926 Binary files /dev/null and b/static/3.png differ diff --git a/templates/example/index.html b/templates/example/index.html index 36d325b..28b2d68 100644 --- a/templates/example/index.html +++ b/templates/example/index.html @@ -358,8 +358,14 @@ -
Submission
- Coming soon... +
+ Submission + (fetched from https://github.com/lnbits/lnbits-extensions) +
+
@@ -394,7 +400,8 @@ exampleData: [], tab: 'frameworks', framworktab: 'fastapi', - usefultab: 'magicalg' + usefultab: 'magicalg', + vettedData: '' } }, ///// Where functions live ///// @@ -414,6 +421,21 @@ LNbits.utils.notifyApiError(error) // Error will be passed to the frontend }) }, + getVettedReadme: function () { + // This is a function that gets the vetted readme from the LNbits repo and converts it from makrdown to html. + LNbits.api + .request( + 'GET', + '/example/api/v1/vetted', + this.g.user.wallets[0].inkey + ) + .then(response => { + this.vettedData = LNbits.utils.convertMarkdown(response.data) + }) + .catch(error => { + LNbits.utils.notifyApiError(error) + }) + }, initWs: async function () { if (location.protocol !== 'http:') { localUrl = @@ -445,6 +467,7 @@ self = this // Often used to run a real object, rather than the event (all a bit confusing really) self.exampleFunction('lorum') self.initWs() + self.getVettedReadme() } }) diff --git a/toc.md b/toc.md new file mode 100644 index 0000000..baa0342 --- /dev/null +++ b/toc.md @@ -0,0 +1,29 @@ +# Terms and Conditions for LNbits Extension + +## 1. Acceptance of Terms + +By installing and using the LNbits extension ("Extension"), you agree to be bound by these terms and conditions ("Terms"). If you do not agree to these Terms, do not use the Extension. + +## 2. License + +The Extension is free and open-source software, released under [specify the FOSS license here, e.g., GPL-3.0, MIT, etc.]. You are permitted to use, copy, modify, and distribute the Extension under the terms of that license. + +## 3. No Warranty + +The Extension is provided "as is" and with all faults, and the developer expressly disclaims all warranties of any kind, whether express, implied, statutory, or otherwise, including but not limited to warranties of merchantability, fitness for a particular purpose, non-infringement, and any warranties arising out of course of dealing or usage of trade. No advice or information, whether oral or written, obtained from the developer or elsewhere will create any warranty not expressly stated in this Terms. + +## 4. Limitation of Liability + +In no event will the developer be liable to you or any third party for any direct, indirect, incidental, special, consequential, or punitive damages, including lost profit, lost revenue, loss of data, or other damages arising out of or in connection with your use of the Extension, even if the developer has been advised of the possibility of such damages. The foregoing limitation of liability shall apply to the fullest extent permitted by law in the applicable jurisdiction. + +## 5. Modification of Terms + +The developer reserves the right to modify these Terms at any time. You are advised to review these Terms periodically for any changes. Changes to these Terms are effective when they are posted on the appropriate location within or associated with the Extension. + +## 6. General Provisions + +If any provision of these Terms is held to be invalid or unenforceable, that provision will be enforced to the maximum extent permissible, and the other provisions of these Terms will remain in full force and effect. These Terms constitute the entire agreement between you and the developer regarding the use of the Extension. + +## 7. Contact Information + +If you have any questions about these Terms, please contact the developer at [developer's contact information]. diff --git a/views_api.py b/views_api.py index 02906ac..e07ff05 100644 --- a/views_api.py +++ b/views_api.py @@ -1,6 +1,10 @@ -from fastapi import APIRouter - +from fastapi import APIRouter, Depends +from loguru import logger from .models import Example +from http import HTTPStatus +import httpx +from fastapi.exceptions import HTTPException +from lnbits.decorators import get_key_type, WalletTypeInfo # views_api.py is for you API endpoints that could be hit by another service @@ -10,7 +14,21 @@ ) -@example_ext_api.get("/{example_data}", description="Example API endpoint") +@example_ext_api.get("/test/{example_data}", description="Example API endpoint") async def api_example(example_data: str) -> Example: # Do some python things and return the data return Example(id="1", wallet=example_data) + + +@example_ext_api.get("/vetted", description="Get the vetted extension readme") +async def api_get_vetted(wallet: WalletTypeInfo = Depends(get_key_type)): + try: + async with httpx.AsyncClient() as client: + resp = await client.get( + "https://raw.githubusercontent.com/lnbits/lnbits-extensions/main/README.md" + ) + return resp.text + except Exception as e: + raise HTTPException( + status_code=HTTPStatus.INTERNAL_SERVER_ERROR, detail=str(e) + ) from e