diff --git a/lnbits/extensions/example/example.config.json b/lnbits/extensions/example/config.json.example
similarity index 55%
rename from lnbits/extensions/example/example.config.json
rename to lnbits/extensions/example/config.json.example
index f69b160..e6e3bbf 100644
--- a/lnbits/extensions/example/example.config.json
+++ b/lnbits/extensions/example/config.json.example
@@ -1,6 +1,6 @@
{
- "name": "SHORT-NAME-FOR-EXTENSIONS-PAGE",
+ "name": "Example",
"short_description": "BLah blah blah.",
- "icon": "calendar",
+ "icon": "info",
"contributors": ["github_username"]
}
diff --git a/lnbits/extensions/example/schema.sql b/lnbits/extensions/example/schema.sql
index 3e02c06..147041b 100644
--- a/lnbits/extensions/example/schema.sql
+++ b/lnbits/extensions/example/schema.sql
@@ -1,7 +1 @@
/* create your extensions table and the variables needed here */
-CREATE TABLE IF NOT EXISTS example (
- key INTEGER PRIMARY KEY AUTOINCREMENT,
- usr TEXT,
- wal TEXT,
- walnme TEXT
-);
diff --git a/lnbits/extensions/example/templates/example/index.html b/lnbits/extensions/example/templates/example/index.html
index 2f69099..6b50734 100644
--- a/lnbits/extensions/example/templates/example/index.html
+++ b/lnbits/extensions/example/templates/example/index.html
@@ -1,103 +1,54 @@
-
-
-{% extends "legacy.html" %} {% block messages %}
-
-
-
- !
-
-
-{% endblock %}
-
-
-{% block menuitems %}
-
-
-
-
-
-
-
-
-
-
-
-
-
*Some content in here
-
-
-
-
-
-
+{% block scripts %}
+ {{ window_vars(user) }}
-
{% endblock %}
diff --git a/lnbits/extensions/example/views.py b/lnbits/extensions/example/views.py
index df3cb01..a70d343 100644
--- a/lnbits/extensions/example/views.py
+++ b/lnbits/extensions/example/views.py
@@ -1,26 +1,11 @@
-#add your dependencies here
+from flask import g, render_template
-from flask import jsonify, render_template, request, redirect, url_for
-from lnbits.db import open_db, open_ext_db
+from lnbits.decorators import check_user_exists, validate_uuids
from lnbits.extensions.example import example_ext
-#add your endpoints here
@example_ext.route("/")
+@validate_uuids(["usr"], required=True)
+@check_user_exists()
def index():
- """Try to add descriptions for others."""
- usr = request.args.get("usr")
-
- if usr:
- if not len(usr) > 20:
- return redirect(url_for("home"))
-
- # Get all the data
- with open_db() as db:
- user_wallets = db.fetchall("SELECT * FROM wallets WHERE user = ?", (usr,))
- user_ext = db.fetchall("SELECT extension FROM extensions WHERE user = ? AND active = 1", (usr,))
- user_ext = [v[0] for v in user_ext]
-
- return render_template(
- "example/index.html"
- )
+ return render_template("example/index.html", user=g.user)
diff --git a/lnbits/extensions/example/views_api.py b/lnbits/extensions/example/views_api.py
index 2eb091c..fc3e894 100644
--- a/lnbits/extensions/example/views_api.py
+++ b/lnbits/extensions/example/views_api.py
@@ -1,18 +1,37 @@
-#views_api.py is for you API endpoints that could be hit by another service
+# views_api.py is for you API endpoints that could be hit by another service
-#add your dependencies here
+# add your dependencies here
-import json
-import requests
-from flask import jsonify, render_template, request, redirect, url_for
-from lnbits.db import open_db, open_ext_db
+# import json
+# import requests
+
+from flask import jsonify
+
+from lnbits.helpers import Status
from lnbits.extensions.example import example_ext
-#add your endpoints here
-@example_ext.route("/api/v1/example", methods=["GET","POST"])
+# add your endpoints here
+
+@example_ext.route("/api/v1/tools", methods=["GET"])
def api_example():
"""Try to add descriptions for others."""
- #YOUR-CODE
-
- return jsonify({"status": "TRUE"}), 200
+ tools = [
+ {
+ "name": "Flask",
+ "url": "https://flask.palletsprojects.com/",
+ "language": "Python",
+ },
+ {
+ "name": "Vue.js",
+ "url": "https://vuejs.org/",
+ "language": "JavaScript",
+ },
+ {
+ "name": "Quasar Framework",
+ "url": "https://vuejs.org/",
+ "language": "JavaScript",
+ }
+ ]
+
+ return jsonify(tools), Status.OK