mirror of
https://github.com/yzernik/squeaknode.git
synced 2026-08-13 12:33:25 +02:00
Remove whitelisted attribute, use following to build whitelist (#386)
* Remove whitelisted attribute, use following to build whitelist * Fix update whitelist on set profile following method * Remove whitelist feature toggle from fronted * Update frontend build
This commit is contained in:
parent
ab3284dafc
commit
b29a8ca8ea
19 changed files with 81 additions and 196 deletions
|
|
@ -23,7 +23,6 @@ import {
|
|||
getSqueakProfileRequest,
|
||||
setSqueakProfileFollowingRequest,
|
||||
setSqueakProfileSharingRequest,
|
||||
setSqueakProfileWhitelistedRequest,
|
||||
} from "../../squeakclient/requests"
|
||||
|
||||
|
||||
|
|
@ -47,11 +46,6 @@ export default function ProfilePage() {
|
|||
getSqueakProfile(id);
|
||||
})
|
||||
};
|
||||
const setWhitelisted = (id, whitelisted) => {
|
||||
setSqueakProfileWhitelistedRequest(id, whitelisted, () => {
|
||||
getSqueakProfile(id);
|
||||
})
|
||||
};
|
||||
|
||||
|
||||
useEffect(()=>{
|
||||
|
|
@ -78,12 +72,6 @@ export default function ProfilePage() {
|
|||
setSharing(id, event.target.checked);
|
||||
};
|
||||
|
||||
const handleSettingsWhitelistedChange = (event) => {
|
||||
console.log("Whitelisted changed for profile id: " + id);
|
||||
console.log("Whitelisted changed to: " + event.target.checked);
|
||||
setWhitelisted(id, event.target.checked);
|
||||
};
|
||||
|
||||
function NoProfileContent() {
|
||||
return (
|
||||
<p>
|
||||
|
|
@ -117,10 +105,6 @@ export default function ProfilePage() {
|
|||
control={<Switch checked={squeakProfile.getSharing()} onChange={handleSettingsSharingChange} />}
|
||||
label="Sharing"
|
||||
/>
|
||||
<FormControlLabel
|
||||
control={<Switch checked={squeakProfile.getWhitelisted()} onChange={handleSettingsWhitelistedChange} />}
|
||||
label="Whitelisted"
|
||||
/>
|
||||
</FormGroup>
|
||||
</FormControl>
|
||||
)
|
||||
|
|
|
|||
|
|
@ -28,7 +28,6 @@ import {
|
|||
GetFollowedSqueakDisplaysRequest,
|
||||
SetSqueakProfileFollowingRequest,
|
||||
SetSqueakProfileSharingRequest,
|
||||
SetSqueakProfileWhitelistedRequest,
|
||||
GetPeersRequest,
|
||||
PayOfferRequest,
|
||||
GetBuyOffersRequest,
|
||||
|
|
@ -53,7 +52,6 @@ import {
|
|||
SetSqueakProfileSharingReply,
|
||||
GetSqueakProfileReply,
|
||||
SetSqueakProfileFollowingReply,
|
||||
SetSqueakProfileWhitelistedReply,
|
||||
GetPeersReply,
|
||||
PayOfferReply,
|
||||
GetBuyOffersReply,
|
||||
|
|
@ -300,25 +298,6 @@ export function setSqueakProfileSharingRequest(id, sharing, handleResponse) {
|
|||
});
|
||||
};
|
||||
|
||||
// export function setSqueakProfileWhitelistedRequest(id, whitelisted, handleResponse) {
|
||||
// var request = new SetSqueakProfileWhitelistedRequest()
|
||||
// request.setProfileId(id);
|
||||
// request.setWhitelisted(whitelisted);
|
||||
// client.setSqueakProfileWhitelisted(request, {}, (err, response) => {
|
||||
// handleResponse(response);
|
||||
// });
|
||||
// };
|
||||
|
||||
export function setSqueakProfileWhitelistedRequest(id, whitelisted, handleResponse) {
|
||||
var request = new SetSqueakProfileWhitelistedRequest()
|
||||
request.setProfileId(id);
|
||||
request.setWhitelisted(whitelisted);
|
||||
makeRequest('setsqueakprofilewhitelisted', request, (data) => {
|
||||
var response = SetSqueakProfileWhitelistedReply.deserializeBinary(data);
|
||||
handleResponse(response);
|
||||
});
|
||||
};
|
||||
|
||||
// export function lndConnectPeerRequest(pubkey, host, handleResponse) {
|
||||
// var request = new ConnectPeerRequest()
|
||||
// var address = new LightningAddress();
|
||||
|
|
|
|||
|
|
@ -42,12 +42,12 @@ def lightning_client():
|
|||
|
||||
|
||||
@pytest.fixture
|
||||
def whitelisted_signing_key(server_stub, admin_stub):
|
||||
def following_signing_key(server_stub, admin_stub):
|
||||
# Create a signing key
|
||||
signing_key = generate_signing_key()
|
||||
|
||||
# Create a new contact profile
|
||||
profile_name = "whitelisted_contact"
|
||||
profile_name = "following_contact"
|
||||
profile_address = get_address(signing_key)
|
||||
create_contact_profile_response = admin_stub.CreateContactProfile(
|
||||
squeak_admin_pb2.CreateContactProfileRequest(
|
||||
|
|
@ -57,11 +57,11 @@ def whitelisted_signing_key(server_stub, admin_stub):
|
|||
)
|
||||
contact_profile_id = create_contact_profile_response.profile_id
|
||||
|
||||
# Set the profile to be whitelisted
|
||||
admin_stub.SetSqueakProfileWhitelisted(
|
||||
squeak_admin_pb2.SetSqueakProfileWhitelistedRequest(
|
||||
# Set the profile to be following
|
||||
admin_stub.SetSqueakProfileFollowing(
|
||||
squeak_admin_pb2.SetSqueakProfileFollowingRequest(
|
||||
profile_id=contact_profile_id,
|
||||
whitelisted=True,
|
||||
following=True,
|
||||
)
|
||||
)
|
||||
|
||||
|
|
@ -70,7 +70,7 @@ def whitelisted_signing_key(server_stub, admin_stub):
|
|||
|
||||
|
||||
@pytest.fixture
|
||||
def nonwhitelisted_signing_key(server_stub, admin_stub):
|
||||
def nonfollowing_signing_key(server_stub, admin_stub):
|
||||
# Create a signing key
|
||||
signing_key = generate_signing_key()
|
||||
|
||||
|
|
|
|||
|
|
@ -25,12 +25,12 @@ from tests.util import (
|
|||
|
||||
|
||||
def test_post_squeak(
|
||||
server_stub, admin_stub, lightning_client, whitelisted_signing_key
|
||||
server_stub, admin_stub, lightning_client, following_signing_key
|
||||
):
|
||||
# Post a squeak with a direct request to the server
|
||||
block_height, block_hash = get_latest_block_info(lightning_client)
|
||||
squeak = make_squeak(
|
||||
whitelisted_signing_key, "hello from itest!", block_hash, block_height
|
||||
following_signing_key, "hello from itest!", block_hash, block_height
|
||||
)
|
||||
squeak_hash = get_hash(squeak)
|
||||
|
||||
|
|
@ -52,13 +52,13 @@ def test_post_squeak(
|
|||
assert get_hash(get_response_squeak) == get_hash(squeak)
|
||||
|
||||
|
||||
def test_post_squeak_not_whitelisted(
|
||||
server_stub, admin_stub, lightning_client, nonwhitelisted_signing_key
|
||||
def test_post_squeak_not_following(
|
||||
server_stub, admin_stub, lightning_client, nonfollowing_signing_key
|
||||
):
|
||||
# Post a squeak with a direct request to the server
|
||||
block_height, block_hash = get_latest_block_info(lightning_client)
|
||||
squeak = make_squeak(
|
||||
nonwhitelisted_signing_key, "hello from itest!", block_hash, block_height
|
||||
nonfollowing_signing_key, "hello from itest!", block_hash, block_height
|
||||
)
|
||||
squeak_hash = get_hash(squeak)
|
||||
|
||||
|
|
@ -294,13 +294,13 @@ def test_make_reply_squeak(
|
|||
assert len(get_ancestors_response.squeak_display_entries) == 3
|
||||
|
||||
|
||||
def test_post_squeak_rate_limit(server_stub, admin_stub, whitelisted_signing_key):
|
||||
def test_post_squeak_rate_limit(server_stub, admin_stub, following_signing_key):
|
||||
# Make 10 squeak
|
||||
for i in range(10):
|
||||
try:
|
||||
block_height, block_hash = get_latest_block_info(lightning_client)
|
||||
squeak = make_squeak(
|
||||
nonwhitelisted_signing_key,
|
||||
nonfollowing_signing_key,
|
||||
"hello from itest!",
|
||||
block_hash,
|
||||
block_height,
|
||||
|
|
@ -376,32 +376,6 @@ def test_make_contact_profile(server_stub, admin_stub):
|
|||
assert contact_name in contact_profile_names
|
||||
|
||||
|
||||
def test_set_profile_whitelisted(server_stub, admin_stub, contact_profile_id):
|
||||
# Get the existing profile
|
||||
get_squeak_profile_response = admin_stub.GetSqueakProfile(
|
||||
squeak_admin_pb2.GetSqueakProfileRequest(
|
||||
profile_id=contact_profile_id,
|
||||
)
|
||||
)
|
||||
assert get_squeak_profile_response.squeak_profile.whitelisted == False
|
||||
|
||||
# Set the profile to be whitelisted
|
||||
admin_stub.SetSqueakProfileWhitelisted(
|
||||
squeak_admin_pb2.SetSqueakProfileWhitelistedRequest(
|
||||
profile_id=contact_profile_id,
|
||||
whitelisted=True,
|
||||
)
|
||||
)
|
||||
|
||||
# Get the squeak profile again
|
||||
get_squeak_profile_response = admin_stub.GetSqueakProfile(
|
||||
squeak_admin_pb2.GetSqueakProfileRequest(
|
||||
profile_id=contact_profile_id,
|
||||
)
|
||||
)
|
||||
assert get_squeak_profile_response.squeak_profile.whitelisted == True
|
||||
|
||||
|
||||
def test_set_profile_following(server_stub, admin_stub, contact_profile_id):
|
||||
# Get the existing profile
|
||||
get_squeak_profile_response = admin_stub.GetSqueakProfile(
|
||||
|
|
@ -487,7 +461,7 @@ def test_get_following_squeaks(
|
|||
get_followed_squeak_display_response = admin_stub.GetFollowedSqueakDisplays(
|
||||
squeak_admin_pb2.GetFollowedSqueakDisplaysRequest()
|
||||
)
|
||||
assert len(get_followed_squeak_display_response.squeak_display_entries) == 1
|
||||
assert len(get_followed_squeak_display_response.squeak_display_entries) >= 1
|
||||
for (
|
||||
squeak_display_entry
|
||||
) in get_followed_squeak_display_response.squeak_display_entries:
|
||||
|
|
|
|||
|
|
@ -84,10 +84,6 @@ service SqueakAdmin {
|
|||
*/
|
||||
rpc GetSqueakProfileByAddress (GetSqueakProfileByAddressRequest) returns (GetSqueakProfileByAddressReply) {}
|
||||
|
||||
/** sqkadmin: `setsqueakprofilewhitelisted`
|
||||
*/
|
||||
rpc SetSqueakProfileWhitelisted (SetSqueakProfileWhitelistedRequest) returns (SetSqueakProfileWhitelistedReply) {}
|
||||
|
||||
/** sqkadmin: `setsqueakprofilefollowing`
|
||||
*/
|
||||
rpc SetSqueakProfileFollowing (SetSqueakProfileFollowingRequest) returns (SetSqueakProfileFollowingReply) {}
|
||||
|
|
@ -237,17 +233,6 @@ message GetSqueakProfileByAddressReply {
|
|||
SqueakProfile squeak_profile = 1;
|
||||
}
|
||||
|
||||
message SetSqueakProfileWhitelistedRequest {
|
||||
/// The profile id
|
||||
int32 profile_id = 1;
|
||||
|
||||
/// Whitelisted
|
||||
bool whitelisted = 2;
|
||||
}
|
||||
|
||||
message SetSqueakProfileWhitelistedReply {
|
||||
}
|
||||
|
||||
message SetSqueakProfileFollowingRequest {
|
||||
/// The profile id
|
||||
int32 profile_id = 1;
|
||||
|
|
@ -296,9 +281,6 @@ message SqueakProfile {
|
|||
|
||||
/// Following
|
||||
bool following = 6;
|
||||
|
||||
/// Whitelisted
|
||||
bool whitelisted = 7;
|
||||
}
|
||||
|
||||
message MakeSqueakRequest {
|
||||
|
|
|
|||
|
|
@ -136,18 +136,6 @@ class SqueakAdminServerHandler(object):
|
|||
squeak_profile_msg = squeak_profile_to_message(squeak_profile)
|
||||
return squeak_admin_pb2.GetSqueakProfileReply(squeak_profile=squeak_profile_msg)
|
||||
|
||||
def handle_set_squeak_profile_whitelisted(self, request):
|
||||
profile_id = request.profile_id
|
||||
whitelisted = request.whitelisted
|
||||
logger.info(
|
||||
"Handle set squeak profile whitelisted with profile id: {}, whitelisted: {}".format(
|
||||
profile_id,
|
||||
whitelisted,
|
||||
)
|
||||
)
|
||||
self.squeak_node.set_squeak_profile_whitelisted(profile_id, whitelisted)
|
||||
return squeak_admin_pb2.SetSqueakProfileWhitelistedReply()
|
||||
|
||||
def handle_set_squeak_profile_following(self, request):
|
||||
profile_id = request.profile_id
|
||||
following = request.following
|
||||
|
|
|
|||
|
|
@ -77,9 +77,6 @@ class SqueakAdminServerServicer(squeak_admin_pb2_grpc.SqueakAdminServicer):
|
|||
def GetSqueakProfileByAddress(self, request, context):
|
||||
return self.handler.handle_get_squeak_profile_by_address(request)
|
||||
|
||||
def SetSqueakProfileWhitelisted(self, request, context):
|
||||
return self.handler.handle_set_squeak_profile_whitelisted(request)
|
||||
|
||||
def SetSqueakProfileFollowing(self, request, context):
|
||||
return self.handler.handle_set_squeak_profile_following(request)
|
||||
|
||||
|
|
|
|||
|
|
@ -42,7 +42,6 @@ def squeak_profile_to_message(squeak_profile):
|
|||
address=squeak_profile.address,
|
||||
sharing=squeak_profile.sharing,
|
||||
following=squeak_profile.following,
|
||||
whitelisted=squeak_profile.whitelisted,
|
||||
)
|
||||
|
||||
def squeak_peer_to_message(squeak_peer):
|
||||
|
|
|
|||
|
|
@ -222,14 +222,6 @@ def create_app(handler, username, password):
|
|||
handler.handle_set_squeak_profile_sharing,
|
||||
)
|
||||
|
||||
@app.route('/setsqueakprofilewhitelisted', methods=["POST"])
|
||||
@login_required
|
||||
def setsqueakprofilewhitelisted():
|
||||
return handle_request(
|
||||
squeak_admin_pb2.SetSqueakProfileWhitelistedRequest(),
|
||||
handler.handle_set_squeak_profile_whitelisted,
|
||||
)
|
||||
|
||||
@app.route('/getpeers', methods=["POST"])
|
||||
@login_required
|
||||
def getpeers():
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
{
|
||||
"files": {
|
||||
"main.js": "/static/js/main.90eaf1a7.chunk.js",
|
||||
"main.js.map": "/static/js/main.90eaf1a7.chunk.js.map",
|
||||
"main.js": "/static/js/main.8120f4c0.chunk.js",
|
||||
"main.js.map": "/static/js/main.8120f4c0.chunk.js.map",
|
||||
"runtime-main.js": "/static/js/runtime-main.9f0ba400.js",
|
||||
"runtime-main.js.map": "/static/js/runtime-main.9f0ba400.js.map",
|
||||
"static/css/2.68adb498.chunk.css": "/static/css/2.68adb498.chunk.css",
|
||||
"static/js/2.c0c66919.chunk.js": "/static/js/2.c0c66919.chunk.js",
|
||||
"static/js/2.c0c66919.chunk.js.map": "/static/js/2.c0c66919.chunk.js.map",
|
||||
"index.html": "/index.html",
|
||||
"precache-manifest.d66c6b7ce69ca1dca505f5d6ac0b498b.js": "/precache-manifest.d66c6b7ce69ca1dca505f5d6ac0b498b.js",
|
||||
"precache-manifest.1682d456d446080d2b1ae9a13ea89627.js": "/precache-manifest.1682d456d446080d2b1ae9a13ea89627.js",
|
||||
"service-worker.js": "/service-worker.js",
|
||||
"static/css/2.68adb498.chunk.css.map": "/static/css/2.68adb498.chunk.css.map",
|
||||
"static/js/2.c0c66919.chunk.js.LICENSE.txt": "/static/js/2.c0c66919.chunk.js.LICENSE.txt",
|
||||
|
|
@ -20,6 +20,6 @@
|
|||
"static/js/runtime-main.9f0ba400.js",
|
||||
"static/css/2.68adb498.chunk.css",
|
||||
"static/js/2.c0c66919.chunk.js",
|
||||
"static/js/main.90eaf1a7.chunk.js"
|
||||
"static/js/main.8120f4c0.chunk.js"
|
||||
]
|
||||
}
|
||||
|
|
@ -1 +1 @@
|
|||
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="shortcut icon" href="/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"/><meta name="theme-color" content="#000000"/><link rel="manifest" href="/manifest.json"/><title>Squeak Node</title><meta name="description" content="Squeak Node is a frontend for accessing a squeak node"><meta name="keywords" content="squeak, bitcoin, lightning"><meta name="author" content="Flatlogic LLC."><link href="/static/css/2.68adb498.chunk.css" rel="stylesheet"></head><body style="font-family:Roboto,sans-serif"><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script>!function(e){function r(r){for(var n,f,l=r[0],a=r[1],i=r[2],c=0,s=[];c<l.length;c++)f=l[c],Object.prototype.hasOwnProperty.call(o,f)&&o[f]&&s.push(o[f][0]),o[f]=0;for(n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n]);for(p&&p(r);s.length;)s.shift()();return u.push.apply(u,i||[]),t()}function t(){for(var e,r=0;r<u.length;r++){for(var t=u[r],n=!0,l=1;l<t.length;l++){var a=t[l];0!==o[a]&&(n=!1)}n&&(u.splice(r--,1),e=f(f.s=t[0]))}return e}var n={},o={1:0},u=[];function f(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,f),t.l=!0,t.exports}f.m=e,f.c=n,f.d=function(e,r,t){f.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},f.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},f.t=function(e,r){if(1&r&&(e=f(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(f.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)f.d(t,n,function(r){return e[r]}.bind(null,n));return t},f.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return f.d(r,"a",r),r},f.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},f.p="/";var l=this["webpackJsonpsqueak-node-frontend"]=this["webpackJsonpsqueak-node-frontend"]||[],a=l.push.bind(l);l.push=r,l=l.slice();for(var i=0;i<l.length;i++)r(l[i]);var p=a;t()}([])</script><script src="/static/js/2.c0c66919.chunk.js"></script><script src="/static/js/main.90eaf1a7.chunk.js"></script></body></html>
|
||||
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="shortcut icon" href="/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"/><meta name="theme-color" content="#000000"/><link rel="manifest" href="/manifest.json"/><title>Squeak Node</title><meta name="description" content="Squeak Node is a frontend for accessing a squeak node"><meta name="keywords" content="squeak, bitcoin, lightning"><meta name="author" content="Flatlogic LLC."><link href="/static/css/2.68adb498.chunk.css" rel="stylesheet"></head><body style="font-family:Roboto,sans-serif"><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script>!function(e){function r(r){for(var n,f,l=r[0],a=r[1],i=r[2],c=0,s=[];c<l.length;c++)f=l[c],Object.prototype.hasOwnProperty.call(o,f)&&o[f]&&s.push(o[f][0]),o[f]=0;for(n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n]);for(p&&p(r);s.length;)s.shift()();return u.push.apply(u,i||[]),t()}function t(){for(var e,r=0;r<u.length;r++){for(var t=u[r],n=!0,l=1;l<t.length;l++){var a=t[l];0!==o[a]&&(n=!1)}n&&(u.splice(r--,1),e=f(f.s=t[0]))}return e}var n={},o={1:0},u=[];function f(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,f),t.l=!0,t.exports}f.m=e,f.c=n,f.d=function(e,r,t){f.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},f.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},f.t=function(e,r){if(1&r&&(e=f(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(f.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)f.d(t,n,function(r){return e[r]}.bind(null,n));return t},f.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return f.d(r,"a",r),r},f.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},f.p="/";var l=this["webpackJsonpsqueak-node-frontend"]=this["webpackJsonpsqueak-node-frontend"]||[],a=l.push.bind(l);l.push=r,l=l.slice();for(var i=0;i<l.length;i++)r(l[i]);var p=a;t()}([])</script><script src="/static/js/2.c0c66919.chunk.js"></script><script src="/static/js/main.8120f4c0.chunk.js"></script></body></html>
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
self.__precacheManifest = (self.__precacheManifest || []).concat([
|
||||
{
|
||||
"revision": "86ceef30391d470058ac570ba641c7cc",
|
||||
"url": "/index.html"
|
||||
},
|
||||
{
|
||||
"revision": "6db26d2dba2210235e0d",
|
||||
"url": "/static/css/2.68adb498.chunk.css"
|
||||
},
|
||||
{
|
||||
"revision": "6db26d2dba2210235e0d",
|
||||
"url": "/static/js/2.c0c66919.chunk.js"
|
||||
},
|
||||
{
|
||||
"revision": "d92829c3e9f72dcd719b3bd85bf36851",
|
||||
"url": "/static/js/2.c0c66919.chunk.js.LICENSE.txt"
|
||||
},
|
||||
{
|
||||
"revision": "50484a25f670f52fa89d",
|
||||
"url": "/static/js/main.8120f4c0.chunk.js"
|
||||
},
|
||||
{
|
||||
"revision": "cc9816de5a8639d377ea",
|
||||
"url": "/static/js/runtime-main.9f0ba400.js"
|
||||
},
|
||||
{
|
||||
"revision": "674f50d287a8c48dc19ba404d20fe713",
|
||||
"url": "/static/media/fontawesome-webfont.674f50d2.eot"
|
||||
},
|
||||
{
|
||||
"revision": "912ec66d7572ff821749319396470bde",
|
||||
"url": "/static/media/fontawesome-webfont.912ec66d.svg"
|
||||
},
|
||||
{
|
||||
"revision": "af7ae505a9eed503f8b8e6982036873e",
|
||||
"url": "/static/media/fontawesome-webfont.af7ae505.woff2"
|
||||
},
|
||||
{
|
||||
"revision": "b06871f281fee6b241d60582ae9369b9",
|
||||
"url": "/static/media/fontawesome-webfont.b06871f2.ttf"
|
||||
},
|
||||
{
|
||||
"revision": "fee66e712a8a08eef5805a46892932ad",
|
||||
"url": "/static/media/fontawesome-webfont.fee66e71.woff"
|
||||
},
|
||||
{
|
||||
"revision": "695a31606b1abb167b03fb1f6375831d",
|
||||
"url": "/static/media/google.695a3160.svg"
|
||||
},
|
||||
{
|
||||
"revision": "a0185b043dee68a72aebffdcc939e21e",
|
||||
"url": "/static/media/logo.a0185b04.svg"
|
||||
}
|
||||
]);
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
importScripts("https://storage.googleapis.com/workbox-cdn/releases/4.3.1/workbox-sw.js");
|
||||
|
||||
importScripts(
|
||||
"/precache-manifest.d66c6b7ce69ca1dca505f5d6ac0b498b.js"
|
||||
"/precache-manifest.1682d456d446080d2b1ae9a13ea89627.js"
|
||||
);
|
||||
|
||||
self.addEventListener('message', (event) => {
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -71,7 +71,6 @@ class SqueakDb:
|
|||
Column("address", String(35), nullable=False),
|
||||
Column("sharing", Boolean, nullable=False),
|
||||
Column("following", Boolean, nullable=False),
|
||||
Column("whitelisted", Boolean, nullable=False),
|
||||
)
|
||||
|
||||
self.peers = Table(
|
||||
|
|
@ -501,35 +500,12 @@ class SqueakDb:
|
|||
address=squeak_profile.address,
|
||||
sharing=squeak_profile.sharing,
|
||||
following=squeak_profile.following,
|
||||
whitelisted=squeak_profile.whitelisted,
|
||||
)
|
||||
with self.get_connection() as connection:
|
||||
res = connection.execute(ins)
|
||||
profile_id = res.inserted_primary_key[0]
|
||||
return profile_id
|
||||
|
||||
# sql = """
|
||||
# INSERT INTO profile(profile_name, private_key, address, sharing, following, whitelisted)
|
||||
# VALUES(%s, %s, %s, %s, %s, %s)
|
||||
# RETURNING profile_id;
|
||||
# """
|
||||
# with self.get_cursor() as curs:
|
||||
# # execute the INSERT statement
|
||||
# curs.execute(
|
||||
# sql,
|
||||
# (
|
||||
# squeak_profile.profile_name,
|
||||
# squeak_profile.private_key,
|
||||
# squeak_profile.address,
|
||||
# squeak_profile.sharing,
|
||||
# squeak_profile.following,
|
||||
# squeak_profile.whitelisted,
|
||||
# ),
|
||||
# )
|
||||
# # get the new profile id back
|
||||
# row = curs.fetchone()
|
||||
# return row["profile_id"]
|
||||
|
||||
def get_signing_profiles(self):
|
||||
""" Get all signing profiles. """
|
||||
s = select([self.profiles]).where(self.profiles.c.private_key != None)
|
||||
|
|
@ -568,25 +544,6 @@ class SqueakDb:
|
|||
# profiles = [self._parse_squeak_profile(row) for row in rows]
|
||||
# return profiles
|
||||
|
||||
def get_whitelisted_profiles(self):
|
||||
""" Get all whitelisted profiles. """
|
||||
s = select([self.profiles]).where(self.profiles.c.whitelisted)
|
||||
with self.get_connection() as connection:
|
||||
result = connection.execute(s)
|
||||
rows = result.fetchall()
|
||||
profiles = [self._parse_squeak_profile(row) for row in rows]
|
||||
return profiles
|
||||
|
||||
# sql = """
|
||||
# SELECT * FROM profile
|
||||
# WHERE whitelisted;
|
||||
# """
|
||||
# with self.get_cursor() as curs:
|
||||
# curs.execute(sql)
|
||||
# rows = curs.fetchall()
|
||||
# profiles = [self._parse_squeak_profile(row) for row in rows]
|
||||
# return profiles
|
||||
|
||||
def get_following_profiles(self):
|
||||
""" Get all following profiles. """
|
||||
s = select([self.profiles]).where(self.profiles.c.following)
|
||||
|
|
@ -657,24 +614,6 @@ class SqueakDb:
|
|||
# row = curs.fetchone()
|
||||
# return self._parse_squeak_profile(row)
|
||||
|
||||
def set_profile_whitelisted(self, profile_id, whitelisted):
|
||||
""" Set a profile is whitelisted. """
|
||||
stmt = (
|
||||
self.profiles.update()
|
||||
.where(self.profiles.c.profile_id == profile_id)
|
||||
.values(whitelisted=whitelisted)
|
||||
)
|
||||
with self.get_connection() as connection:
|
||||
connection.execute(stmt)
|
||||
|
||||
# sql = """
|
||||
# UPDATE profile
|
||||
# SET whitelisted=%s
|
||||
# WHERE profile_id=%s;
|
||||
# """
|
||||
# with self.get_cursor() as curs:
|
||||
# curs.execute(sql, (whitelisted, profile_id,))
|
||||
|
||||
def set_profile_following(self, profile_id, following):
|
||||
""" Set a profile is following. """
|
||||
stmt = (
|
||||
|
|
@ -1075,7 +1014,6 @@ class SqueakDb:
|
|||
address=row["address"],
|
||||
sharing=row["sharing"],
|
||||
following=row["following"],
|
||||
whitelisted=row["whitelisted"],
|
||||
)
|
||||
|
||||
def _parse_squeak_entry_with_profile(self, row):
|
||||
|
|
|
|||
|
|
@ -160,7 +160,6 @@ class SqueakNode:
|
|||
address=str(address),
|
||||
sharing=False,
|
||||
following=False,
|
||||
whitelisted=False,
|
||||
)
|
||||
return self.postgres_db.insert_profile(squeak_profile)
|
||||
|
||||
|
|
@ -175,7 +174,6 @@ class SqueakNode:
|
|||
address=squeak_address,
|
||||
sharing=False,
|
||||
following=False,
|
||||
whitelisted=False,
|
||||
)
|
||||
return self.postgres_db.insert_profile(squeak_profile)
|
||||
|
||||
|
|
@ -191,12 +189,9 @@ class SqueakNode:
|
|||
def get_squeak_profile_by_address(self, address):
|
||||
return self.postgres_db.get_profile_by_address(address)
|
||||
|
||||
def set_squeak_profile_whitelisted(self, profile_id, whitelisted):
|
||||
self.postgres_db.set_profile_whitelisted(profile_id, whitelisted)
|
||||
self.squeak_whitelist.refresh()
|
||||
|
||||
def set_squeak_profile_following(self, profile_id, following):
|
||||
self.postgres_db.set_profile_following(profile_id, following)
|
||||
self.squeak_whitelist.refresh()
|
||||
|
||||
def set_squeak_profile_sharing(self, profile_id, sharing):
|
||||
self.postgres_db.set_profile_sharing(profile_id, sharing)
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ class SqueakWhitelist:
|
|||
self.allowed_addresses = whitelisted_addresses
|
||||
|
||||
def _get_whitelisted_addresses(self):
|
||||
whitelisted_profiles = self.postgres_db.get_whitelisted_profiles()
|
||||
whitelisted_profiles = self.postgres_db.get_following_profiles()
|
||||
return [profile.address for profile in whitelisted_profiles]
|
||||
|
||||
def get_allowed_addresses(self, addresses):
|
||||
|
|
|
|||
|
|
@ -2,5 +2,5 @@ from collections import namedtuple
|
|||
|
||||
SqueakProfile = namedtuple(
|
||||
"SqueakProfile",
|
||||
"profile_id, profile_name, private_key, address, sharing, following, whitelisted",
|
||||
"profile_id, profile_name, private_key, address, sharing, following",
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue