mirror of
https://github.com/yzernik/squeaknode.git
synced 2026-08-13 12:33:25 +02:00
Simplify add peer UI (#1999)
* Remove non-null constraint on peer name * Remove validation requiring non-empty name for peer * Update database to use autoconnect true by default * Remove connect peer button and modal from peers page * Show saved peers tab by default in peers page * Update frontend build
This commit is contained in:
parent
e1ce759e15
commit
4d349005d4
22 changed files with 164 additions and 147 deletions
|
|
@ -27,9 +27,8 @@ import {
|
|||
|
||||
|
||||
const Peers = (props) => {
|
||||
const [tab, setTab] = useState('Connected Peers')
|
||||
const [tab, setTab] = useState('Saved Peers')
|
||||
const [savePeerModalOpen, setSavePeerModalOpen] = useState(false)
|
||||
const [connectPeerModalOpen, setconnectPeerModalOpen] = useState(false)
|
||||
const [showExternalAddressModalOpen, setShowExternalAddressModalOpen] = useState(false)
|
||||
const [styleBody, setStyleBody] = useState(false)
|
||||
const [name, setName] = useState('')
|
||||
|
|
@ -73,11 +72,6 @@ const Peers = (props) => {
|
|||
setTimeout(()=>{ setSavePeerModalOpen(!savePeerModalOpen) },20)
|
||||
}
|
||||
|
||||
const toggleconnectPeerModal = (param, type) => {
|
||||
setStyleBody(!styleBody)
|
||||
setTimeout(()=>{ setconnectPeerModalOpen(!connectPeerModalOpen) },20)
|
||||
}
|
||||
|
||||
const toggleShowExternalAddressModalOpen = () => {
|
||||
setStyleBody(!styleBody)
|
||||
setTimeout(()=>{ setShowExternalAddressModalOpen(!showExternalAddressModalOpen) },20)
|
||||
|
|
@ -106,17 +100,6 @@ const Peers = (props) => {
|
|||
toggleSavePeerModal();
|
||||
}
|
||||
|
||||
const connectPeer = () => {
|
||||
const network = getNetwork();
|
||||
const strippedHost = removeHttp(host);
|
||||
dispatch(setConnectPeer({
|
||||
host: strippedHost,
|
||||
port: port,
|
||||
network: network,
|
||||
}));
|
||||
toggleconnectPeerModal();
|
||||
}
|
||||
|
||||
const handleChangeUseTor = () => {
|
||||
setUseTor(!useTor);
|
||||
};
|
||||
|
|
@ -143,24 +126,20 @@ const Peers = (props) => {
|
|||
className='profiles-create-button'>
|
||||
<span>Show External Address</span>
|
||||
</div>
|
||||
<div onClick={(e)=>toggleconnectPeerModal('edit')}
|
||||
className='profiles-create-button'>
|
||||
<span>Connect Peer</span>
|
||||
</div>
|
||||
<div onClick={(e)=>toggleSavePeerModal('edit')}
|
||||
className='profiles-create-button'>
|
||||
<span>Add Saved Peer</span>
|
||||
<span>Add Peer</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<div className="explore-nav-menu">
|
||||
<div onClick={()=>setTab('Connected Peers')} className={tab === 'Connected Peers' ? `explore-nav-item activeTab` : `explore-nav-item`}>
|
||||
Connected Peers
|
||||
</div>
|
||||
<div onClick={()=>setTab('Saved Peers')} className={tab === 'Saved Peers' ? `explore-nav-item activeTab` : `explore-nav-item`}>
|
||||
Saved Peers
|
||||
</div>
|
||||
<div onClick={()=>setTab('Connected Peers')} className={tab === 'Connected Peers' ? `explore-nav-item activeTab` : `explore-nav-item`}>
|
||||
Connected Peers
|
||||
</div>
|
||||
</div>
|
||||
{tab === 'Saved Peers' ?
|
||||
peers.map(sp=>{
|
||||
|
|
@ -279,7 +258,7 @@ const Peers = (props) => {
|
|||
<form className="edit-form">
|
||||
<div className="edit-input-wrap">
|
||||
<div className="edit-input-content">
|
||||
<label>Name</label>
|
||||
<label>Name (not required)</label>
|
||||
<input onChange={(e)=>setName(e.target.value)} type="text" name="name" className="edit-input"/>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -312,55 +291,6 @@ const Peers = (props) => {
|
|||
</div>
|
||||
</div>
|
||||
|
||||
{/* Modal for connect peer */}
|
||||
<div onClick={()=>toggleconnectPeerModal()} style={{display: connectPeerModalOpen ? 'block' : 'none'}} className="modal-edit">
|
||||
<div onClick={(e)=>handleModalClick(e)} className="modal-content">
|
||||
<div className="modal-header">
|
||||
<div className="modal-closeIcon">
|
||||
<div onClick={()=>toggleconnectPeerModal()} className="modal-closeIcon-wrap">
|
||||
<ICON_CLOSE />
|
||||
</div>
|
||||
</div>
|
||||
<p className="modal-title">Connect Peer</p>
|
||||
|
||||
<div className="save-modal-wrapper">
|
||||
<div onClick={connectPeer} className="save-modal-btn">
|
||||
Submit
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="modal-body">
|
||||
<form className="edit-form">
|
||||
<div className="edit-input-wrap">
|
||||
<div className="edit-input-content">
|
||||
<label>Host</label>
|
||||
<input onChange={(e)=>setHost(e.target.value)} type="text" name="name" className="edit-input"/>
|
||||
</div>
|
||||
</div>
|
||||
<div className="edit-input-wrap">
|
||||
<div className="edit-input-content">
|
||||
<label>Port</label>
|
||||
<input onChange={(e)=>setPort(e.target.value)} type="text" name="name" className="edit-input"/>
|
||||
</div>
|
||||
</div>
|
||||
<div className="edit-input-wrap">
|
||||
<div className="edit-input-content">
|
||||
<label>
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={useTor}
|
||||
onChange={handleChangeUseTor}
|
||||
/>
|
||||
Use Tor
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
)
|
||||
|
|
|
|||
|
|
@ -556,29 +556,10 @@ def test_create_peer(admin_stub):
|
|||
port=1234,
|
||||
)
|
||||
assert get_peer_by_address_response.peer_name == "fake_peer_name"
|
||||
|
||||
|
||||
def test_create_peer_empty_name(admin_stub):
|
||||
# Try to create a new signing profile with an empty name
|
||||
with pytest.raises(Exception) as excinfo:
|
||||
create_saved_peer(
|
||||
admin_stub,
|
||||
"",
|
||||
"another_fake_host",
|
||||
1234,
|
||||
)
|
||||
assert "Peer name cannot be empty." in str(excinfo.value)
|
||||
assert get_peer_response.squeak_peer.autoconnect
|
||||
|
||||
|
||||
def test_set_peer_autoconnect(admin_stub, peer_id):
|
||||
# Get the peer
|
||||
get_peer_response = admin_stub.GetPeer(
|
||||
squeak_admin_pb2.GetPeerRequest(
|
||||
peer_id=peer_id,
|
||||
)
|
||||
)
|
||||
assert not get_peer_response.squeak_peer.autoconnect
|
||||
|
||||
# Set the peer to be autoconnect
|
||||
admin_stub.SetPeerAutoconnect(
|
||||
squeak_admin_pb2.SetPeerAutoconnectRequest(
|
||||
|
|
@ -595,6 +576,22 @@ def test_set_peer_autoconnect(admin_stub, peer_id):
|
|||
)
|
||||
assert get_peer_response.squeak_peer.autoconnect
|
||||
|
||||
# Set the peer to be not autoconnect
|
||||
admin_stub.SetPeerAutoconnect(
|
||||
squeak_admin_pb2.SetPeerAutoconnectRequest(
|
||||
peer_id=peer_id,
|
||||
autoconnect=False,
|
||||
)
|
||||
)
|
||||
|
||||
# Get the peer again
|
||||
get_peer_response = admin_stub.GetPeer(
|
||||
squeak_admin_pb2.GetPeerRequest(
|
||||
peer_id=peer_id,
|
||||
)
|
||||
)
|
||||
assert not get_peer_response.squeak_peer.autoconnect
|
||||
|
||||
|
||||
def test_rename_peer(admin_stub, peer_id, random_name):
|
||||
# Rename the peer
|
||||
|
|
|
|||
|
|
@ -1,35 +1,35 @@
|
|||
{
|
||||
"files": {
|
||||
"main.css": "/static/css/main.2db21378.chunk.css",
|
||||
"main.js": "/static/js/main.8343c419.chunk.js",
|
||||
"main.js.map": "/static/js/main.8343c419.chunk.js.map",
|
||||
"runtime-main.js": "/static/js/runtime-main.2ae99013.js",
|
||||
"runtime-main.js.map": "/static/js/runtime-main.2ae99013.js.map",
|
||||
"static/js/2.7e46f2c7.chunk.js": "/static/js/2.7e46f2c7.chunk.js",
|
||||
"static/js/2.7e46f2c7.chunk.js.map": "/static/js/2.7e46f2c7.chunk.js.map",
|
||||
"main.js": "/static/js/main.7c510e8d.chunk.js",
|
||||
"main.js.map": "/static/js/main.7c510e8d.chunk.js.map",
|
||||
"runtime-main.js": "/static/js/runtime-main.1eacdecd.js",
|
||||
"runtime-main.js.map": "/static/js/runtime-main.1eacdecd.js.map",
|
||||
"static/js/2.babe843f.chunk.js": "/static/js/2.babe843f.chunk.js",
|
||||
"static/js/2.babe843f.chunk.js.map": "/static/js/2.babe843f.chunk.js.map",
|
||||
"static/css/3.1f6bb621.chunk.css": "/static/css/3.1f6bb621.chunk.css",
|
||||
"static/js/3.043ad63d.chunk.js": "/static/js/3.043ad63d.chunk.js",
|
||||
"static/js/3.043ad63d.chunk.js.map": "/static/js/3.043ad63d.chunk.js.map",
|
||||
"static/css/4.6512f3a3.chunk.css": "/static/css/4.6512f3a3.chunk.css",
|
||||
"static/js/4.0c88bd8a.chunk.js": "/static/js/4.0c88bd8a.chunk.js",
|
||||
"static/js/4.0c88bd8a.chunk.js.map": "/static/js/4.0c88bd8a.chunk.js.map",
|
||||
"static/js/4.5466ca1a.chunk.js": "/static/js/4.5466ca1a.chunk.js",
|
||||
"static/js/4.5466ca1a.chunk.js.map": "/static/js/4.5466ca1a.chunk.js.map",
|
||||
"static/css/5.3aaab79d.chunk.css": "/static/css/5.3aaab79d.chunk.css",
|
||||
"static/js/5.93db42e1.chunk.js": "/static/js/5.93db42e1.chunk.js",
|
||||
"static/js/5.93db42e1.chunk.js.map": "/static/js/5.93db42e1.chunk.js.map",
|
||||
"index.html": "/index.html",
|
||||
"precache-manifest.ff477efaf72aa2eba4b32430984c8df9.js": "/precache-manifest.ff477efaf72aa2eba4b32430984c8df9.js",
|
||||
"precache-manifest.d63830f90b931c5de8f0960d699a1571.js": "/precache-manifest.d63830f90b931c5de8f0960d699a1571.js",
|
||||
"service-worker.js": "/service-worker.js",
|
||||
"static/css/3.1f6bb621.chunk.css.map": "/static/css/3.1f6bb621.chunk.css.map",
|
||||
"static/css/4.6512f3a3.chunk.css.map": "/static/css/4.6512f3a3.chunk.css.map",
|
||||
"static/css/5.3aaab79d.chunk.css.map": "/static/css/5.3aaab79d.chunk.css.map",
|
||||
"static/css/main.2db21378.chunk.css.map": "/static/css/main.2db21378.chunk.css.map",
|
||||
"static/js/2.7e46f2c7.chunk.js.LICENSE.txt": "/static/js/2.7e46f2c7.chunk.js.LICENSE.txt",
|
||||
"static/js/2.babe843f.chunk.js.LICENSE.txt": "/static/js/2.babe843f.chunk.js.LICENSE.txt",
|
||||
"static/media/icon.a0c2d343.svg": "/static/media/icon.a0c2d343.svg"
|
||||
},
|
||||
"entrypoints": [
|
||||
"static/js/runtime-main.2ae99013.js",
|
||||
"static/js/2.7e46f2c7.chunk.js",
|
||||
"static/js/runtime-main.1eacdecd.js",
|
||||
"static/js/2.babe843f.chunk.js",
|
||||
"static/css/main.2db21378.chunk.css",
|
||||
"static/js/main.8343c419.chunk.js"
|
||||
"static/js/main.7c510e8d.chunk.js"
|
||||
]
|
||||
}
|
||||
|
|
@ -1 +1 @@
|
|||
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#1da1f2"/><meta nam="description" content="Squeaknode!"/><meta name="og:title" content="Squeaknode"/><meta name="og:description" content="check out my the Squeaknode I made"/><link href="https://fonts.googleapis.com/css2?family=Assistant&display=swap" rel="stylesheet"><link rel="apple-touch-icon" href="/logo192.png"/><link rel="manifest" href="/manifest.json"/><title>Squeaknode</title><link href="/static/css/main.2db21378.chunk.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script>!function(e){function t(t){for(var n,o,i=t[0],c=t[1],l=t[2],s=0,d=[];s<i.length;s++)o=i[s],Object.prototype.hasOwnProperty.call(a,o)&&a[o]&&d.push(a[o][0]),a[o]=0;for(n in c)Object.prototype.hasOwnProperty.call(c,n)&&(e[n]=c[n]);for(f&&f(t);d.length;)d.shift()();return u.push.apply(u,l||[]),r()}function r(){for(var e,t=0;t<u.length;t++){for(var r=u[t],n=!0,o=1;o<r.length;o++){var c=r[o];0!==a[c]&&(n=!1)}n&&(u.splice(t--,1),e=i(i.s=r[0]))}return e}var n={},o={1:0},a={1:0},u=[];function i(t){if(n[t])return n[t].exports;var r=n[t]={i:t,l:!1,exports:{}};return e[t].call(r.exports,r,r.exports,i),r.l=!0,r.exports}i.e=function(e){var t=[];o[e]?t.push(o[e]):0!==o[e]&&{3:1,4:1,5:1}[e]&&t.push(o[e]=new Promise((function(t,r){for(var n="static/css/"+({}[e]||e)+"."+{3:"1f6bb621",4:"6512f3a3",5:"3aaab79d"}[e]+".chunk.css",a=i.p+n,u=document.getElementsByTagName("link"),c=0;c<u.length;c++){var l=(f=u[c]).getAttribute("data-href")||f.getAttribute("href");if("stylesheet"===f.rel&&(l===n||l===a))return t()}var s=document.getElementsByTagName("style");for(c=0;c<s.length;c++){var f;if((l=(f=s[c]).getAttribute("data-href"))===n||l===a)return t()}var d=document.createElement("link");d.rel="stylesheet",d.type="text/css",d.onload=t,d.onerror=function(t){var n=t&&t.target&&t.target.src||a,u=new Error("Loading CSS chunk "+e+" failed.\n("+n+")");u.code="CSS_CHUNK_LOAD_FAILED",u.request=n,delete o[e],d.parentNode.removeChild(d),r(u)},d.href=a,document.getElementsByTagName("head")[0].appendChild(d)})).then((function(){o[e]=0})));var r=a[e];if(0!==r)if(r)t.push(r[2]);else{var n=new Promise((function(t,n){r=a[e]=[t,n]}));t.push(r[2]=n);var u,c=document.createElement("script");c.charset="utf-8",c.timeout=120,i.nc&&c.setAttribute("nonce",i.nc),c.src=function(e){return i.p+"static/js/"+({}[e]||e)+"."+{3:"043ad63d",4:"0c88bd8a",5:"93db42e1"}[e]+".chunk.js"}(e);var l=new Error;u=function(t){c.onerror=c.onload=null,clearTimeout(s);var r=a[e];if(0!==r){if(r){var n=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;l.message="Loading chunk "+e+" failed.\n("+n+": "+o+")",l.name="ChunkLoadError",l.type=n,l.request=o,r[1](l)}a[e]=void 0}};var s=setTimeout((function(){u({type:"timeout",target:c})}),12e4);c.onerror=c.onload=u,document.head.appendChild(c)}return Promise.all(t)},i.m=e,i.c=n,i.d=function(e,t,r){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(i.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)i.d(r,n,function(t){return e[t]}.bind(null,n));return r},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="/",i.oe=function(e){throw console.error(e),e};var c=this["webpackJsonptwitter-frontend"]=this["webpackJsonptwitter-frontend"]||[],l=c.push.bind(c);c.push=t,c=c.slice();for(var s=0;s<c.length;s++)t(c[s]);var f=l;r()}([])</script><script src="/static/js/2.7e46f2c7.chunk.js"></script><script src="/static/js/main.8343c419.chunk.js"></script></body></html>
|
||||
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#1da1f2"/><meta nam="description" content="Squeaknode!"/><meta name="og:title" content="Squeaknode"/><meta name="og:description" content="check out my the Squeaknode I made"/><link href="https://fonts.googleapis.com/css2?family=Assistant&display=swap" rel="stylesheet"><link rel="apple-touch-icon" href="/logo192.png"/><link rel="manifest" href="/manifest.json"/><title>Squeaknode</title><link href="/static/css/main.2db21378.chunk.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script>!function(e){function t(t){for(var n,o,i=t[0],c=t[1],l=t[2],s=0,d=[];s<i.length;s++)o=i[s],Object.prototype.hasOwnProperty.call(a,o)&&a[o]&&d.push(a[o][0]),a[o]=0;for(n in c)Object.prototype.hasOwnProperty.call(c,n)&&(e[n]=c[n]);for(f&&f(t);d.length;)d.shift()();return u.push.apply(u,l||[]),r()}function r(){for(var e,t=0;t<u.length;t++){for(var r=u[t],n=!0,o=1;o<r.length;o++){var c=r[o];0!==a[c]&&(n=!1)}n&&(u.splice(t--,1),e=i(i.s=r[0]))}return e}var n={},o={1:0},a={1:0},u=[];function i(t){if(n[t])return n[t].exports;var r=n[t]={i:t,l:!1,exports:{}};return e[t].call(r.exports,r,r.exports,i),r.l=!0,r.exports}i.e=function(e){var t=[];o[e]?t.push(o[e]):0!==o[e]&&{3:1,4:1,5:1}[e]&&t.push(o[e]=new Promise((function(t,r){for(var n="static/css/"+({}[e]||e)+"."+{3:"1f6bb621",4:"6512f3a3",5:"3aaab79d"}[e]+".chunk.css",a=i.p+n,u=document.getElementsByTagName("link"),c=0;c<u.length;c++){var l=(f=u[c]).getAttribute("data-href")||f.getAttribute("href");if("stylesheet"===f.rel&&(l===n||l===a))return t()}var s=document.getElementsByTagName("style");for(c=0;c<s.length;c++){var f;if((l=(f=s[c]).getAttribute("data-href"))===n||l===a)return t()}var d=document.createElement("link");d.rel="stylesheet",d.type="text/css",d.onload=t,d.onerror=function(t){var n=t&&t.target&&t.target.src||a,u=new Error("Loading CSS chunk "+e+" failed.\n("+n+")");u.code="CSS_CHUNK_LOAD_FAILED",u.request=n,delete o[e],d.parentNode.removeChild(d),r(u)},d.href=a,document.getElementsByTagName("head")[0].appendChild(d)})).then((function(){o[e]=0})));var r=a[e];if(0!==r)if(r)t.push(r[2]);else{var n=new Promise((function(t,n){r=a[e]=[t,n]}));t.push(r[2]=n);var u,c=document.createElement("script");c.charset="utf-8",c.timeout=120,i.nc&&c.setAttribute("nonce",i.nc),c.src=function(e){return i.p+"static/js/"+({}[e]||e)+"."+{3:"043ad63d",4:"5466ca1a",5:"93db42e1"}[e]+".chunk.js"}(e);var l=new Error;u=function(t){c.onerror=c.onload=null,clearTimeout(s);var r=a[e];if(0!==r){if(r){var n=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;l.message="Loading chunk "+e+" failed.\n("+n+": "+o+")",l.name="ChunkLoadError",l.type=n,l.request=o,r[1](l)}a[e]=void 0}};var s=setTimeout((function(){u({type:"timeout",target:c})}),12e4);c.onerror=c.onload=u,document.head.appendChild(c)}return Promise.all(t)},i.m=e,i.c=n,i.d=function(e,t,r){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(i.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)i.d(r,n,function(t){return e[t]}.bind(null,n));return r},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="/",i.oe=function(e){throw console.error(e),e};var c=this["webpackJsonptwitter-frontend"]=this["webpackJsonptwitter-frontend"]||[],l=c.push.bind(c);c.push=t,c=c.slice();for(var s=0;s<c.length;s++)t(c[s]);var f=l;r()}([])</script><script src="/static/js/2.babe843f.chunk.js"></script><script src="/static/js/main.7c510e8d.chunk.js"></script></body></html>
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
self.__precacheManifest = (self.__precacheManifest || []).concat([
|
||||
{
|
||||
"revision": "cfcd5740a8ae966c08a4f9c5e228c4e1",
|
||||
"revision": "0b255a98c80cf51b2c371c1f6f24fd8a",
|
||||
"url": "/index.html"
|
||||
},
|
||||
{
|
||||
|
|
@ -8,7 +8,7 @@ self.__precacheManifest = (self.__precacheManifest || []).concat([
|
|||
"url": "/static/css/3.1f6bb621.chunk.css"
|
||||
},
|
||||
{
|
||||
"revision": "df35692a3771eae60516",
|
||||
"revision": "e412fb479d10e72daad6",
|
||||
"url": "/static/css/4.6512f3a3.chunk.css"
|
||||
},
|
||||
{
|
||||
|
|
@ -16,36 +16,36 @@ self.__precacheManifest = (self.__precacheManifest || []).concat([
|
|||
"url": "/static/css/5.3aaab79d.chunk.css"
|
||||
},
|
||||
{
|
||||
"revision": "aebac4fdb8fdeeecb551",
|
||||
"revision": "c36a7f4ae9e7eccf5a4b",
|
||||
"url": "/static/css/main.2db21378.chunk.css"
|
||||
},
|
||||
{
|
||||
"revision": "4955e18ffa3434bb3610",
|
||||
"url": "/static/js/2.7e46f2c7.chunk.js"
|
||||
"revision": "552e6884ef83ffe7b186",
|
||||
"url": "/static/js/2.babe843f.chunk.js"
|
||||
},
|
||||
{
|
||||
"revision": "a569361d31625f49e7e30aea21628ed5",
|
||||
"url": "/static/js/2.7e46f2c7.chunk.js.LICENSE.txt"
|
||||
"url": "/static/js/2.babe843f.chunk.js.LICENSE.txt"
|
||||
},
|
||||
{
|
||||
"revision": "8cc1987a8af1ab54b6a5",
|
||||
"url": "/static/js/3.043ad63d.chunk.js"
|
||||
},
|
||||
{
|
||||
"revision": "df35692a3771eae60516",
|
||||
"url": "/static/js/4.0c88bd8a.chunk.js"
|
||||
"revision": "e412fb479d10e72daad6",
|
||||
"url": "/static/js/4.5466ca1a.chunk.js"
|
||||
},
|
||||
{
|
||||
"revision": "98f588d1fdf51e73593e",
|
||||
"url": "/static/js/5.93db42e1.chunk.js"
|
||||
},
|
||||
{
|
||||
"revision": "aebac4fdb8fdeeecb551",
|
||||
"url": "/static/js/main.8343c419.chunk.js"
|
||||
"revision": "c36a7f4ae9e7eccf5a4b",
|
||||
"url": "/static/js/main.7c510e8d.chunk.js"
|
||||
},
|
||||
{
|
||||
"revision": "225aa98f6e6625289fb2",
|
||||
"url": "/static/js/runtime-main.2ae99013.js"
|
||||
"revision": "af7b71b81945c699d35d",
|
||||
"url": "/static/js/runtime-main.1eacdecd.js"
|
||||
},
|
||||
{
|
||||
"revision": "a0c2d343127a93b025409da6fd970700",
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
importScripts("https://storage.googleapis.com/workbox-cdn/releases/4.3.1/workbox-sw.js");
|
||||
|
||||
importScripts(
|
||||
"/precache-manifest.ff477efaf72aa2eba4b32430984c8df9.js"
|
||||
"/precache-manifest.d63830f90b931c5de8f0960d699a1571.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
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -1,2 +1,2 @@
|
|||
!function(e){function t(t){for(var n,o,i=t[0],c=t[1],l=t[2],s=0,d=[];s<i.length;s++)o=i[s],Object.prototype.hasOwnProperty.call(a,o)&&a[o]&&d.push(a[o][0]),a[o]=0;for(n in c)Object.prototype.hasOwnProperty.call(c,n)&&(e[n]=c[n]);for(f&&f(t);d.length;)d.shift()();return u.push.apply(u,l||[]),r()}function r(){for(var e,t=0;t<u.length;t++){for(var r=u[t],n=!0,o=1;o<r.length;o++){var c=r[o];0!==a[c]&&(n=!1)}n&&(u.splice(t--,1),e=i(i.s=r[0]))}return e}var n={},o={1:0},a={1:0},u=[];function i(t){if(n[t])return n[t].exports;var r=n[t]={i:t,l:!1,exports:{}};return e[t].call(r.exports,r,r.exports,i),r.l=!0,r.exports}i.e=function(e){var t=[];o[e]?t.push(o[e]):0!==o[e]&&{3:1,4:1,5:1}[e]&&t.push(o[e]=new Promise((function(t,r){for(var n="static/css/"+({}[e]||e)+"."+{3:"1f6bb621",4:"6512f3a3",5:"3aaab79d"}[e]+".chunk.css",a=i.p+n,u=document.getElementsByTagName("link"),c=0;c<u.length;c++){var l=(f=u[c]).getAttribute("data-href")||f.getAttribute("href");if("stylesheet"===f.rel&&(l===n||l===a))return t()}var s=document.getElementsByTagName("style");for(c=0;c<s.length;c++){var f;if((l=(f=s[c]).getAttribute("data-href"))===n||l===a)return t()}var d=document.createElement("link");d.rel="stylesheet",d.type="text/css",d.onload=t,d.onerror=function(t){var n=t&&t.target&&t.target.src||a,u=new Error("Loading CSS chunk "+e+" failed.\n("+n+")");u.code="CSS_CHUNK_LOAD_FAILED",u.request=n,delete o[e],d.parentNode.removeChild(d),r(u)},d.href=a,document.getElementsByTagName("head")[0].appendChild(d)})).then((function(){o[e]=0})));var r=a[e];if(0!==r)if(r)t.push(r[2]);else{var n=new Promise((function(t,n){r=a[e]=[t,n]}));t.push(r[2]=n);var u,c=document.createElement("script");c.charset="utf-8",c.timeout=120,i.nc&&c.setAttribute("nonce",i.nc),c.src=function(e){return i.p+"static/js/"+({}[e]||e)+"."+{3:"043ad63d",4:"0c88bd8a",5:"93db42e1"}[e]+".chunk.js"}(e);var l=new Error;u=function(t){c.onerror=c.onload=null,clearTimeout(s);var r=a[e];if(0!==r){if(r){var n=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;l.message="Loading chunk "+e+" failed.\n("+n+": "+o+")",l.name="ChunkLoadError",l.type=n,l.request=o,r[1](l)}a[e]=void 0}};var s=setTimeout((function(){u({type:"timeout",target:c})}),12e4);c.onerror=c.onload=u,document.head.appendChild(c)}return Promise.all(t)},i.m=e,i.c=n,i.d=function(e,t,r){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},i.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"===typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(i.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)i.d(r,n,function(t){return e[t]}.bind(null,n));return r},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="/",i.oe=function(e){throw console.error(e),e};var c=this["webpackJsonptwitter-frontend"]=this["webpackJsonptwitter-frontend"]||[],l=c.push.bind(c);c.push=t,c=c.slice();for(var s=0;s<c.length;s++)t(c[s]);var f=l;r()}([]);
|
||||
//# sourceMappingURL=runtime-main.2ae99013.js.map
|
||||
!function(e){function t(t){for(var n,o,i=t[0],c=t[1],l=t[2],s=0,d=[];s<i.length;s++)o=i[s],Object.prototype.hasOwnProperty.call(a,o)&&a[o]&&d.push(a[o][0]),a[o]=0;for(n in c)Object.prototype.hasOwnProperty.call(c,n)&&(e[n]=c[n]);for(f&&f(t);d.length;)d.shift()();return u.push.apply(u,l||[]),r()}function r(){for(var e,t=0;t<u.length;t++){for(var r=u[t],n=!0,o=1;o<r.length;o++){var c=r[o];0!==a[c]&&(n=!1)}n&&(u.splice(t--,1),e=i(i.s=r[0]))}return e}var n={},o={1:0},a={1:0},u=[];function i(t){if(n[t])return n[t].exports;var r=n[t]={i:t,l:!1,exports:{}};return e[t].call(r.exports,r,r.exports,i),r.l=!0,r.exports}i.e=function(e){var t=[];o[e]?t.push(o[e]):0!==o[e]&&{3:1,4:1,5:1}[e]&&t.push(o[e]=new Promise((function(t,r){for(var n="static/css/"+({}[e]||e)+"."+{3:"1f6bb621",4:"6512f3a3",5:"3aaab79d"}[e]+".chunk.css",a=i.p+n,u=document.getElementsByTagName("link"),c=0;c<u.length;c++){var l=(f=u[c]).getAttribute("data-href")||f.getAttribute("href");if("stylesheet"===f.rel&&(l===n||l===a))return t()}var s=document.getElementsByTagName("style");for(c=0;c<s.length;c++){var f;if((l=(f=s[c]).getAttribute("data-href"))===n||l===a)return t()}var d=document.createElement("link");d.rel="stylesheet",d.type="text/css",d.onload=t,d.onerror=function(t){var n=t&&t.target&&t.target.src||a,u=new Error("Loading CSS chunk "+e+" failed.\n("+n+")");u.code="CSS_CHUNK_LOAD_FAILED",u.request=n,delete o[e],d.parentNode.removeChild(d),r(u)},d.href=a,document.getElementsByTagName("head")[0].appendChild(d)})).then((function(){o[e]=0})));var r=a[e];if(0!==r)if(r)t.push(r[2]);else{var n=new Promise((function(t,n){r=a[e]=[t,n]}));t.push(r[2]=n);var u,c=document.createElement("script");c.charset="utf-8",c.timeout=120,i.nc&&c.setAttribute("nonce",i.nc),c.src=function(e){return i.p+"static/js/"+({}[e]||e)+"."+{3:"043ad63d",4:"5466ca1a",5:"93db42e1"}[e]+".chunk.js"}(e);var l=new Error;u=function(t){c.onerror=c.onload=null,clearTimeout(s);var r=a[e];if(0!==r){if(r){var n=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;l.message="Loading chunk "+e+" failed.\n("+n+": "+o+")",l.name="ChunkLoadError",l.type=n,l.request=o,r[1](l)}a[e]=void 0}};var s=setTimeout((function(){u({type:"timeout",target:c})}),12e4);c.onerror=c.onload=u,document.head.appendChild(c)}return Promise.all(t)},i.m=e,i.c=n,i.d=function(e,t,r){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},i.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"===typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(i.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)i.d(r,n,function(t){return e[t]}.bind(null,n));return r},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="/",i.oe=function(e){throw console.error(e),e};var c=this["webpackJsonptwitter-frontend"]=this["webpackJsonptwitter-frontend"]||[],l=c.push.bind(c);c.push=t,c=c.slice();for(var s=0;s<c.length;s++)t(c[s]);var f=l;r()}([]);
|
||||
//# sourceMappingURL=runtime-main.1eacdecd.js.map
|
||||
File diff suppressed because one or more lines are too long
|
|
@ -32,13 +32,13 @@ def create_saved_peer(
|
|||
peer_id=None,
|
||||
peer_name=peer_name,
|
||||
address=peer_address,
|
||||
autoconnect=False,
|
||||
autoconnect=True,
|
||||
share_for_free=False,
|
||||
)
|
||||
|
||||
|
||||
def validate_saved_peer_name(peer_name: str) -> None:
|
||||
if len(peer_name) == 0:
|
||||
raise Exception(
|
||||
"Peer name cannot be empty.",
|
||||
)
|
||||
"""Check if the given name is valid for a peer.
|
||||
|
||||
Raise exception if name is invalid.
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -0,0 +1,41 @@
|
|||
# MIT License
|
||||
#
|
||||
# Copyright (c) 2020 Jonathan Zernik
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
"""Set autoconnect to true by default
|
||||
|
||||
Revision ID: 0e3b79a31b58
|
||||
Revises: a2122c4711cc
|
||||
Create Date: 2022-03-15 16:39:53.615791
|
||||
|
||||
"""
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '0e3b79a31b58'
|
||||
down_revision = 'a2122c4711cc'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
pass
|
||||
|
||||
|
||||
def downgrade():
|
||||
pass
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
# MIT License
|
||||
#
|
||||
# Copyright (c) 2020 Jonathan Zernik
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
"""Allow peer name to be null
|
||||
|
||||
Revision ID: a2122c4711cc
|
||||
Revises: 691c8a25cda5
|
||||
Create Date: 2022-03-15 14:31:38.050091
|
||||
|
||||
"""
|
||||
import sqlalchemy as sa
|
||||
from alembic import op
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'a2122c4711cc'
|
||||
down_revision = '691c8a25cda5'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
with op.batch_alter_table('peer', schema=None) as batch_op:
|
||||
batch_op.alter_column('peer_name',
|
||||
existing_type=sa.VARCHAR(),
|
||||
nullable=True)
|
||||
|
||||
|
||||
def downgrade():
|
||||
with op.batch_alter_table('peer', schema=None) as batch_op:
|
||||
batch_op.alter_column('peer_name',
|
||||
existing_type=sa.VARCHAR(),
|
||||
nullable=False)
|
||||
|
|
@ -102,11 +102,11 @@ class Models:
|
|||
self.metadata,
|
||||
Column("peer_id", Integer, primary_key=True),
|
||||
Column("created_time_ms", SLBigInteger, nullable=False),
|
||||
Column("peer_name", String, nullable=False),
|
||||
Column("peer_name", String, nullable=True),
|
||||
Column("network", String(10), nullable=False),
|
||||
Column("host", String, nullable=False),
|
||||
Column("port", Integer, nullable=False),
|
||||
Column("autoconnect", Boolean, nullable=False),
|
||||
Column("autoconnect", Boolean, nullable=False, default=True),
|
||||
Column("share_for_free", Boolean, nullable=False, default=False),
|
||||
UniqueConstraint('host', 'port',
|
||||
name='uq_peer_host_port'),
|
||||
|
|
|
|||
|
|
@ -69,9 +69,7 @@ def test_create_saved_peer(peer_name, peer_address):
|
|||
|
||||
|
||||
def test_create_saved_peer_empty_name(peer_address):
|
||||
with pytest.raises(Exception) as excinfo:
|
||||
create_saved_peer("", peer_address)
|
||||
assert "Peer name cannot be empty." in str(excinfo.value)
|
||||
create_saved_peer("", peer_address)
|
||||
|
||||
|
||||
def test_create_saved_peer_use_tor(peer_name, peer_address_with_tor):
|
||||
|
|
|
|||
|
|
@ -1208,7 +1208,7 @@ def test_get_autoconnect_squeak_peers_none(
|
|||
):
|
||||
peers = squeak_db.get_autoconnect_peers()
|
||||
|
||||
assert len(peers) == 0
|
||||
assert len(peers) == len(inserted_squeak_peer_ids)
|
||||
|
||||
|
||||
def test_set_peer_name(squeak_db, peer_with_new_name_id, new_peer_name):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue