Skip to content

Commit 9d8417c

Browse files
committed
proxy version 0.012
1 parent d25a620 commit 9d8417c

File tree

14 files changed

+1691
-1635
lines changed

14 files changed

+1691
-1635
lines changed

assets_js_bitrequest_config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const glob_apptitle = "Bitrequest",
1717
"https://www.bitrequest.app/"
1818
],
1919
glob_hosted_proxy = random_array_item(glob_proxy_list), // load balance proxies
20-
glob_proxy_version = "0.010",
20+
glob_proxy_version = "0.012",
2121
glob_firebase_dynamic_link_domain = "bitrequest.page.link",
2222
glob_firebase_shortlink = "https://" + glob_firebase_dynamic_link_domain + "/",
2323
glob_androidpackagename = "io.bitrequest.app",

assets_js_bitrequest_core.js

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -908,11 +908,9 @@ function ios_redirections(url) {
908908
}
909909
if (gets.i) {
910910
// expand shorturl don't open page
911-
}
912-
else if (gets.data) {
911+
} else if (gets.data) {
913912
glob_w_loc.href = url;
914-
}
915-
else {
913+
} else {
916914
const pagename = gets.p || "prompt";
917915
openpage(url, pagename, "page");
918916
}
@@ -4539,7 +4537,9 @@ function resetchanges() {
45394537
glob_changes = {};
45404538
savechangesstats();
45414539
glob_body.removeClass("haschanges");
4542-
$("#alert > span").text("0").attr("title", translate("nochanges"));
4540+
if (!glob_html.hasClass("proxyupdate")) {
4541+
$("#alert > span").text("0").attr("title", translate("nochanges"));
4542+
}
45434543
}
45444544

45454545
// Saves the changes statistics to local storage
@@ -4559,9 +4559,11 @@ function change_alert() {
45594559
}
45604560
const total_changes = get_total_changes();
45614561
if (total_changes > 0) {
4562-
$("#alert > span").text(total_changes).attr("title", translate("totalchanges", {
4563-
"total_changes": total_changes
4564-
}));
4562+
if (!glob_html.hasClass("proxyupdate")) {
4563+
$("#alert > span").text(total_changes).attr("title", translate("totalchanges", {
4564+
"total_changes": total_changes
4565+
}));
4566+
}
45654567
setTimeout(function() {
45664568
glob_body.addClass("haschanges");
45674569
}, 2500);
@@ -4685,6 +4687,7 @@ function get_alchemy_apikey() {
46854687
// Displays an alert for proxy updates
46864688
function proxy_alert(version) {
46874689
if (version) {
4690+
glob_html.addClass("proxyupdate");
46884691
glob_body.addClass("haschanges");
46894692
$("#alert > span").text("!").attr("title", translate("updateproxy", {
46904693
"version": version,

assets_styles_styles.css

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -319,20 +319,20 @@ html.hidemain header {
319319
transition: all 400ms cubic-bezier(0.5, -0.5, 0.5, 1.5);
320320
}
321321

322-
html:not(.gdauth) body.haschanges #alert {
322+
html:not(.gdauth .proxyupdate) body.haschanges #alert {
323323
opacity: 1;
324324
-webkit-transform: translate(0%, 0);
325325
-ms-transform: translate(0%, 0);
326326
transform: translate(0%, 0);
327327
}
328328

329-
html:not(.gdauth) body.haschanges #header h1 {
329+
html:not(.gdauth .proxyupdate) body.haschanges #header h1 {
330330
-webkit-transform: translate(1em, 0);
331331
-ms-transform: translate(1em, 0);
332332
transform: translate(1em, 0);
333333
}
334334

335-
html.gdauth #alert {
335+
html:not(.proxyupdate).gdauth #alert {
336336
display: none!important;
337337
}
338338

@@ -2068,9 +2068,11 @@ input:invalid {
20682068
}
20692069

20702070
.warning {
2071+
display:inline-block;
20712072
color: #FFF;
20722073
background-color: #B33A3A !important;
2073-
padding-left: 1em;
2074+
padding: 1em;
2075+
margin-bottom:0.5em;
20742076
}
20752077

20762078
.error {

proxy/README.md

Lines changed: 99 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,30 @@
1+
# Lightning Proxy README
2+
13
## Update
24

3-
Replace the 'v1' folder, make sure you leave the config.php file.
5+
Replace the 'v1' folder, making sure to leave the config.php file intact.
46

57
## API Proxy
68

79
* Control your own keys and request limits.
810
* Host this folder on your webserver as your personal API proxy.
911
* Enter your API keys in the config.php file.
10-
* In the bitrequest app go to Settings -> Advanced -> API Proxy and connect to your webserver.
12+
* In the Bitrequest app, go to Settings -> Advanced -> API Proxy and connect to your webserver.
1113

1214
## URL Shortener
1315

1416
* Use your webserver for your personal shortlinks.
15-
* In the bitrequest app go to Settings -> Advanced -> URL Shortener and connect to your proxy server.
17+
* In the Bitrequest app, go to Settings -> Advanced -> URL Shortener and connect to your proxy server.
1618

17-
## Lightning RPC proxy
19+
## Lightning RPC Proxy
1820

19-
* Connect your lightning node to the bitrequest app securely.
21+
* Connect your Lightning node to the Bitrequest app securely.
2022
* Host this folder on your webserver as your personal Lightning RPC proxy.
21-
* Enter your lightning Host and keys in the config.php file.
22-
* In the bitrequest app go to Currencies -> Bitcoin -> Settings -> Lightning Network and connect to your webserver.
23-
* Select your lightning node.
23+
* Enter your Lightning host and keys in the config.php file.
24+
* In the Bitrequest app, go to Currencies -> Bitcoin -> Settings -> Lightning Network and connect to your webserver.
25+
* Select your Lightning node.
2426

25-
## Lightning setup:
27+
## Lightning Setup:
2628

2729
### Connect:
2830

@@ -33,22 +35,23 @@ Replace the 'v1' folder, make sure you leave the config.php file.
3335

3436
### Settings:
3537

36-
* **API key:** Secure your lightning proxy calls with your personal key. (optional)
37-
* **successAction:** Display a personal message in your clients wallet after a succesfull payment. (optional)
38-
* **callback:** Set callback url to receive status updates. [Documentation and sample templates](https://github.com/bitrequest/webshop-integration/). (optional)
39-
* **local_tracking:** receive callbacks for point of sale requests.
40-
* **remote_tracking:** receive callbacks for shared requests.
41-
* **logo:** Display your logo on lnurl enabled lightning wallets. (512x512px / base-64 encoded)
38+
* **API key:** Secure your Lightning proxy calls with your personal key. (optional)
39+
* **successAction:** Display a personal message in your client's wallet after a successful payment. (optional)
40+
* **callback:** Set callback URL to receive status updates. [Documentation and sample templates](https://github.com/bitrequest/webshop-integration/). (optional)
41+
* **local_tracking:** Receive callbacks for point-of-sale requests.
42+
* **remote_tracking:** Receive callbacks for shared requests.
43+
* **logo:** Display your logo on LNURL-enabled Lightning wallets. (512x512px / base64-encoded)
4244

4345
## Lightning API:
4446

47+
Available endpoints:
4548
* ln-create-invoice
4649
* ln-invoice-status
4750
* ln-request-status
4851
* ln-invoice-decode
4952
* ln-list-invoices
5053

51-
**Endpoint:** {Api proxy} /proxy/v1/ln/api/
54+
**Endpoint:** {API proxy}/proxy/v1/ln/api/
5255

5356
imp {$implementation} : "lnd" / "eclair" / "c-lightning" / "lnbits"
5457

@@ -58,107 +61,126 @@ POST
5861

5962
Payload:
6063

61-
{
62-
"fn": "ln-create-invoice",
63-
"imp": {$implementation},
64-
"amount": {$amount},
65-
"memo": {$memo},
66-
"id": {$unique id} (required for c-lightning label),
67-
"expiry": {$expiry} (in seconds),
68-
"x-api": {$api-key} (optional),
69-
}
64+
```json
65+
{
66+
"fn": "ln-create-invoice",
67+
"imp": "{$implementation}",
68+
"amount": "{$amount}",
69+
"memo": "{$memo}",
70+
"id": "{$unique id}", // required for c-lightning label
71+
"expiry": "{$expiry}", // in seconds
72+
"x-api": "{$api-key}" // optional
73+
}
74+
```
7075

7176
Response:
7277

73-
{
74-
"bolt11": "lnbcrt100n1p3r3zvnpp59xxgzarekeh0dg0qa5hu4ap4xlpjl3jd7v4yhx6cqq5668vv8c8qdp8w3jhxapqd9h8vmmfvdjjqctsdyszsnzw24fyc2gcqzpgxqz95sp5cq3lu0kgawn2djhfa7rq34v539t5lnslnyrsdt7zpxqa4z2zx0kq9qyyssqs6akvn2wsx6wjratycg0wmwqhtmgl0cqw4m0xqhj7cgy4uxk6alsln578y8x66utkch7vkav0kz2zc6yx4pygre27h2vtzrat803pqcqj8wzxp",
75-
"hash": "298c817479b66ef6a1e0ed2fcaf43537c32fc64df32a4b9b580029ad1d8c3e0e",
76-
"invoice": $decoded bolt11,
77-
"proxy": "app.bitrequest.io",
78-
}
78+
```json
79+
{
80+
"bolt11": "lnbcrt100n1p3r3zvnpp59xxgzarekeh0dg0qa5hu4ap4xlpjl3jd7v4yhx6cqq5668vv8c8qdp8w3jhxapqd9h8vmmfvdjjqctsdyszsnzw24fyc2gcqzpgxqz95sp5cq3lu0kgawn2djhfa7rq34v539t5lnslnyrsdt7zpxqa4z2zx0kq9qyyssqs6akvn2wsx6wjratycg0wmwqhtmgl0cqw4m0xqhj7cgy4uxk6alsln578y8x66utkch7vkav0kz2zc6yx4pygre27h2vtzrat803pqcqj8wzxp",
81+
"hash": "298c817479b66ef6a1e0ed2fcaf43537c32fc64df32a4b9b580029ad1d8c3e0e",
82+
"invoice": "$decoded bolt11",
83+
"proxy": "app.bitrequest.io"
84+
}
85+
```
7986

8087
### ln-request-status:
8188

8289
POST
8390

8491
Payload:
8592

86-
{
87-
"fn": "ln-request-status",
88-
"id": {$payment-id},
89-
"x-api": {$api-key} (optional),
90-
}
93+
```json
94+
{
95+
"fn": "ln-request-status",
96+
"id": "{$payment-id}",
97+
"x-api": "{$api-key}" // optional
98+
}
99+
```
91100

92101
Response:
93102

94-
{
95-
"pid": {$payment-id},
96-
"status": "waiting" / "pending" / "paid" / "canceled",
97-
"rqtype": "local" / "checkout" / "outgoing" / "incoming",
98-
"proxy": "app.bitrequest.io",
99-
"version": "0.001"
100-
}
101-
103+
```json
104+
{
105+
"pid": "{$payment-id}",
106+
"status": "waiting" | "pending" | "paid" | "canceled",
107+
"rqtype": "local" | "checkout" | "outgoing" | "incoming",
108+
"proxy": "app.bitrequest.io",
109+
"version": "0.001"
110+
}
111+
```
102112

103113
### ln-invoice-status:
104114

105115
POST
106116

107117
Payload:
108118

109-
{
110-
"fn": "ln-invoice-status",
111-
"imp": {$implementation},
112-
"hash": {$payment-hash},
113-
"x-api": {$api-key} (optional),
114-
}
119+
```json
120+
{
121+
"fn": "ln-invoice-status",
122+
"imp": "{$implementation}",
123+
"hash": "{$payment-hash}",
124+
"x-api": "{$api-key}" // optional
125+
}
126+
```
115127

116128
Response:
117129

118-
{
119-
"status": "pending" / "paid" / "canceled",
120-
"bolt11": "lnbc3u1p3rvxtvpp5ff3a7s2ltau6y23zm3l7xchk95k98wx0ey5l3jyd5ddzz9u97msqhp5a5y3dq8ac8zusau6wwlm927da6cqvxzzqr70rjtvzqf3q2dhwuxscqpjxqyjw5qrzjqftzw4d5r9nsau4nkakrxxdvkm0xgl6yxwuk4lp9yykz5kql0j5vzzkcgvqq8tgqqqqqqqqqqqqqphgq9qsp52kfc2x26ngwp55g0atdv626d2gqaelww6zm7gsv69nnevucy5shq9qy9qsqqeryqqec8gdlfnmvqcs4swwupw0wv2vzhgdzaew9hmgs3z50gfrr3r6lrkfyrxc2gv92sz7cg8hau40s3n5qwdc6a4s2l4fnh7fv2wgqc3zcsn",
121-
"hash": "4a63df415f5f79a22a22dc7fe362f62d2c53b8cfc929f8c88da35a211785f6e0",
122-
"amount": "300000",
123-
"amount_paid": "300000",
124-
"timestamp": "1647712620000",
125-
"txtime": "1647712620000",
126-
"conf": "1",
127-
"proxy": "app.bitrequest.io",
128-
"version": "0.001"
129-
}
130+
```json
131+
{
132+
"status": "pending" | "paid" | "canceled",
133+
"bolt11": "lnbc3u1p3rvxtvpp5ff3a7s2ltau6y23zm3l7xchk95k98wx0ey5l3jyd5ddzz9u97msqhp5a5y3dq8ac8zusau6wwlm927da6cqvxzzqr70rjtvzqf3q2dhwuxscqpjxqyjw5qrzjqftzw4d5r9nsau4nkakrxxdvkm0xgl6yxwuk4lp9yykz5kql0j5vzzkcgvqq8tgqqqqqqqqqqqqqphgq9qsp52kfc2x26ngwp55g0atdv626d2gqaelww6zm7gsv69nnevucy5shq9qy9qsqqeryqqec8gdlfnmvqcs4swwupw0wv2vzhgdzaew9hmgs3z50gfrr3r6lrkfyrxc2gv92sz7cg8hau40s3n5qwdc6a4s2l4fnh7fv2wgqc3zcsn",
134+
"hash": "4a63df415f5f79a22a22dc7fe362f62d2c53b8cfc929f8c88da35a211785f6e0",
135+
"amount": "300000",
136+
"amount_paid": "300000",
137+
"timestamp": "1647712620000",
138+
"txtime": "1647712620000",
139+
"conf": "1",
140+
"proxy": "app.bitrequest.io",
141+
"version": "0.001"
142+
}
143+
```
130144

131145
### ln-invoice-decode:
132146

133147
POST
134148

135149
Payload:
136150

137-
{
138-
"fn": "ln-invoice-decode",
139-
"imp": {$implementation},
140-
"hash": {$payment-hash},
141-
"x-api": {$api-key} (optional),
142-
}
151+
```json
152+
{
153+
"fn": "ln-invoice-decode",
154+
"imp": "{$implementation}",
155+
"hash": "{$payment-hash}",
156+
"x-api": "{$api-key}" // optional
157+
}
158+
```
143159

144160
Response:
145161

146-
{
147-
"decoded bolt11 invoice"
148-
}
162+
```json
163+
{
164+
"decoded bolt11 invoice"
165+
}
166+
```
149167

150168
### ln-list-invoices:
151169

152170
POST
153171

154172
Payload:
155173

156-
{
157-
"fn": "ln-list-invoices",
158-
"imp": {$implementation},
159-
"x-api": {$api-key} (optional),
160-
}
174+
```json
175+
{
176+
"fn": "ln-list-invoices",
177+
"imp": "{$implementation}",
178+
"x-api": "{$api-key}" // optional
179+
}
180+
```
161181

162182
Response:
163183

164-
[{bolt 11 invoices}]
184+
```json
185+
[{bolt11 invoices}]
186+
```

0 commit comments

Comments
 (0)