stash
This commit is contained in:
parent
a85c3c3296
commit
c7c91f87ba
4 changed files with 51 additions and 28 deletions
|
@ -35,7 +35,7 @@ class FallBackResolver {
|
|||
const key = domain + ':' + type;
|
||||
if (key in this._cache && this._cache[key].time > Date.now() - 1000 * 60 * 60) {
|
||||
const age_seconds = Math.ceil(Date.now() / 1000 - this._cache[key].time / 1000);
|
||||
console.log('cache hit', key, this._cache[key].ttl - age_seconds);
|
||||
//console.log('cache hit', key, this._cache[key].ttl - age_seconds);
|
||||
return [this._cache[key].data];
|
||||
}
|
||||
const result = await query(
|
||||
|
@ -48,7 +48,7 @@ class FallBackResolver {
|
|||
const first = result.answers[0];
|
||||
this._cache[key] = {time: Date.now(), ...first}; // TODO hadle multiple answers
|
||||
localStorage.setItem('dns-cache', JSON.stringify(this._cache));
|
||||
console.log('cache miss', key, first.ttl);
|
||||
//console.log('cache miss', key, first.ttl);
|
||||
return [first.data];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -130,16 +130,12 @@ export default createStore({
|
|||
},
|
||||
async lookupServer({state}, {username}) {
|
||||
const domain = username.split('@')[1]
|
||||
if (domain === 'example.eleon')
|
||||
return ['10.23.42.186:8000'];
|
||||
if (domain === 'localhost')
|
||||
return ['127.0.0.1:8000'];
|
||||
return ['localhost:5173'];
|
||||
if (domain === 'example.com')
|
||||
return ['10.23.42.128:8000', '10.23.42.128:8000'];
|
||||
return ['localhost:5173'];
|
||||
if (domain === 'example.jedi')
|
||||
return ['10.23.42.128:8000'];
|
||||
if (domain === 'example2.com')
|
||||
return ['10.23.42.128:9000'];
|
||||
return ['localhost:5173'];
|
||||
const request = '_toolshed-server._tcp.' + domain + '.'
|
||||
return await state.resolver.query(request, 'SRV').then(
|
||||
(result) => result.map(
|
||||
|
|
|
@ -20,9 +20,10 @@
|
|||
<div class="card-body">
|
||||
<div class="m-sm-4">
|
||||
<form role="form" method="post" @submit.prevent="do_register">
|
||||
<div :class="errors.username||errors.domain?['mb-3','is-invalid']:['mb-3']">
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Username</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group"
|
||||
:class="errors.username||errors.domain?['is-invalid']:[]">
|
||||
<input class="form-control form-control-lg"
|
||||
type="text" v-model="form.username" id="validationCustomUsername"
|
||||
placeholder="Enter your username" required/>
|
||||
|
@ -41,7 +42,7 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div :class="errors.email?['mb-3','is-invalid']:['mb-3']">
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Email</label>
|
||||
<input class="form-control form-control-lg" type="email"
|
||||
:class="errors.email?['is-invalid']:[]"
|
||||
|
@ -49,7 +50,7 @@
|
|||
<div class="invalid-feedback">{{ errors.email }}</div>
|
||||
</div>
|
||||
|
||||
<div :class="errors.password?['mb-3','is-invalid']:['mb-3']">
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Password</label>
|
||||
<input class="form-control form-control-lg" type="password"
|
||||
:class="errors.password?['is-invalid']:[]"
|
||||
|
@ -57,7 +58,7 @@
|
|||
<div class="invalid-feedback">{{ errors.password }}</div>
|
||||
</div>
|
||||
|
||||
<div :class="errors.password2?['mb-3','is-invalid']:['mb-3']">
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Password Check</label>
|
||||
<input class="form-control form-control-lg" type="password"
|
||||
:class="errors.password2?['is-invalid']:[]"
|
||||
|
|
|
@ -25,26 +25,52 @@ export default defineConfig({
|
|||
+ ' img-src \'self\' https://* data:;'
|
||||
+ ' connect-src * data:', // TODO: change * to https://* for production
|
||||
},
|
||||
/*https: {
|
||||
key: fs.readFileSync('privkey.pem'),
|
||||
cert: fs.readFileSync('fullchain.pem')
|
||||
},*/
|
||||
https: {
|
||||
key: fs.readFileSync('.local/privkey.pem'),
|
||||
cert: fs.readFileSync('.local/fullchain.pem')
|
||||
},
|
||||
proxy: {
|
||||
'^/api/': {
|
||||
target: "https://toolshed.j3d1.de:8000/",
|
||||
target: "http://127.0.0.1:8000/",
|
||||
headers: {
|
||||
'Host': 'localhost:5173',
|
||||
'Origin': 'https://localhost:5173',
|
||||
'X-Forwarded-Host': 'localhost:5173',
|
||||
'X-Forwarded-Proto': 'https',
|
||||
}
|
||||
},
|
||||
'^/auth/': {
|
||||
target: "https://toolshed.j3d1.de:8000/",
|
||||
secure: false,
|
||||
},
|
||||
'^/docs/': {
|
||||
target: "https://toolshed.j3d1.de:8000/",
|
||||
},
|
||||
'^/static/': {
|
||||
target: "https://toolshed.j3d1.de:8000/",
|
||||
target: "http://127.0.0.1:8000/",
|
||||
headers: {
|
||||
'Host': 'localhost:5173',
|
||||
'Origin': 'https://localhost:5173',
|
||||
'X-Forwarded-Host': 'localhost:5173',
|
||||
'X-Forwarded-Proto': 'https',
|
||||
}
|
||||
// target: "https://toolshed.j3d1.de:8000/",
|
||||
// secure: false,
|
||||
// },
|
||||
// '^/docs/': {
|
||||
// target: "https://toolshed.j3d1.de:8000/",
|
||||
// },
|
||||
// '^/static/': {
|
||||
// target: "https://toolshed.j3d1.de:8000/",
|
||||
//>>>>>>> busti/proto/frontend
|
||||
},
|
||||
'^/media/': {
|
||||
target: "https://toolshed.j3d1.de:8000/",
|
||||
target: "http://127.0.0.1:8000/",
|
||||
headers: {
|
||||
'Host': 'localhost:5173',
|
||||
'Origin': 'https://localhost:5173',
|
||||
'X-Forwarded-Host': 'localhost:5173',
|
||||
'X-Forwarded-Proto': 'https',
|
||||
}
|
||||
},
|
||||
'^/docs/': {
|
||||
target: "http://127.0.0.1:8000/",
|
||||
},
|
||||
'^/static/': {
|
||||
target: "http://127.0.0.1:8000/",
|
||||
},
|
||||
'^/wiki/': {
|
||||
target: "http://127.0.0.1:8080/",
|
||||
|
|
Loading…
Reference in a new issue