mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-14 05:07:22 +01:00
Compare commits
28 Commits
qa/turtle
...
fiz/task-m
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
17caa2159d | ||
|
|
36520ae6a5 | ||
|
|
315a942c69 | ||
|
|
9a1fb18959 | ||
|
|
2ea0b64603 | ||
|
|
bd1aa1e417 | ||
|
|
7c49b845d6 | ||
|
|
1ee172139d | ||
|
|
6447b9ab4b | ||
|
|
5c414099d9 | ||
|
|
5e8e1179aa | ||
|
|
7e86a62624 | ||
|
|
1ba9dda0ed | ||
|
|
227e5ceaa8 | ||
|
|
f77ab5a3ab | ||
|
|
1916faf647 | ||
|
|
80ecb5cef1 | ||
|
|
75c36e6622 | ||
|
|
78330c975a | ||
|
|
95266f6cb3 | ||
|
|
e9b2c1b51a | ||
|
|
2a2bea07ab | ||
|
|
ea60ddbf4c | ||
|
|
1c2ca0e478 | ||
|
|
ef2b7eb928 | ||
|
|
3d16387a61 | ||
|
|
93b7770eaa | ||
|
|
a9f84d3307 |
Submodule habitica-images updated: 992d838120...aa72332019
@@ -117,6 +117,15 @@ describe('Blocker middleware', () => {
|
||||
|
||||
checkIPBlockedErrorThrown(next);
|
||||
});
|
||||
|
||||
it('throws when the ip is blocked', () => {
|
||||
req.ip = '192.168.1.1';
|
||||
sandbox.stub(nconf, 'get').withArgs('BLOCKED_IPS').returns('192.168.1.1');
|
||||
const attachBlocker = requireAgain(pathToBlocker).default;
|
||||
attachBlocker(req, res, next);
|
||||
|
||||
checkIPBlockedErrorThrown(next);
|
||||
});
|
||||
});
|
||||
|
||||
describe('Blocking clients', () => {
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
</button>
|
||||
<button
|
||||
class="btn btn-secondary d-flex align-items-center justify-content-center"
|
||||
:class="{disabled: !canSave}"
|
||||
:class="{'btn-disabled': !canSave}"
|
||||
type="button"
|
||||
@click="submit()"
|
||||
>
|
||||
@@ -162,13 +162,13 @@
|
||||
>
|
||||
<div
|
||||
class="habit-option-icon svg-icon no-transition"
|
||||
:class="task.up ? '' : 'disabled'"
|
||||
:class="task.up ? '' : 'icon-disabled'"
|
||||
v-html="icons.positive"
|
||||
></div>
|
||||
</div>
|
||||
<div
|
||||
class="habit-option-label no-transition"
|
||||
:class="task.up ? cssClass('icon') : 'disabled'"
|
||||
:class="task.up ? cssClass('icon') : 'label-disabled'"
|
||||
>
|
||||
{{ $t('positive') }}
|
||||
</div>
|
||||
@@ -188,13 +188,13 @@
|
||||
>
|
||||
<div
|
||||
class="habit-option-icon no-transition svg-icon negative mx-auto"
|
||||
:class="task.down ? '' : 'disabled'"
|
||||
:class="task.down ? '' : 'icon-disabled'"
|
||||
v-html="icons.negative"
|
||||
></div>
|
||||
</div>
|
||||
<div
|
||||
class="habit-option-label no-transition"
|
||||
:class="task.down ? cssClass('icon') : 'disabled'"
|
||||
:class="task.down ? cssClass('icon') : 'label-disabled'"
|
||||
>
|
||||
{{ $t('negative') }}
|
||||
</div>
|
||||
@@ -592,7 +592,7 @@
|
||||
<button
|
||||
class="btn btn-primary btn-footer
|
||||
d-flex align-items-center justify-content-center"
|
||||
:class="{disabled: !canSave}"
|
||||
:class="{'btn-disabled': !canSave}"
|
||||
type="button"
|
||||
@click="submit()"
|
||||
>
|
||||
@@ -881,12 +881,14 @@
|
||||
}
|
||||
}
|
||||
|
||||
.disabled {
|
||||
.btn-disabled {
|
||||
background-color: $white;
|
||||
border: 2px solid transparent;
|
||||
color: $gray-200;
|
||||
line-height: 1.714;
|
||||
box-shadow: 0px 1px 3px 0px rgba(26, 24, 29, 0.12), 0px 1px 2px 0px rgba(26, 24, 29, 0.24);
|
||||
cursor: not-allowed;
|
||||
opacity: 0.6;
|
||||
|
||||
&:focus {
|
||||
background-color: $white;
|
||||
@@ -948,7 +950,7 @@
|
||||
height: 10px;
|
||||
color: $white;
|
||||
|
||||
&.disabled {
|
||||
&.icon-disabled {
|
||||
color: $gray-200;
|
||||
}
|
||||
|
||||
@@ -962,7 +964,7 @@
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
|
||||
&.disabled {
|
||||
&.label-disabled {
|
||||
color: $gray-100;
|
||||
font-weight: normal;
|
||||
}
|
||||
@@ -1018,7 +1020,7 @@
|
||||
border: 0;
|
||||
}
|
||||
|
||||
.disabled .input-group-text {
|
||||
.input-group-outer.disabled .input-group-text {
|
||||
color: $gray-200;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,4 +4,4 @@
|
||||
"newsroom": "Newsroom",
|
||||
"adminBlockerTypeDescription": "<b>IP-Address</b> - Block access for a specific IP-Address\n\nClient - Block access for a client based on the \"x-client\" header.\n\nE-Mail - Blocks e-mails from being used for signup.",
|
||||
"adminBlockerAreaDescription": "A blocker can either apply to the full site, completely blocking any access. Or it can apply to purchases, which still allows the site to be accessed."
|
||||
}
|
||||
}
|
||||
@@ -187,5 +187,4 @@ api.deleteBlocker = {
|
||||
res.respond(200, savedBlocker);
|
||||
},
|
||||
};
|
||||
|
||||
export default api;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import nconf from 'nconf';
|
||||
import {
|
||||
Forbidden,
|
||||
} from '../libs/errors';
|
||||
@@ -9,7 +10,19 @@ import { model as Blocker } from '../models/blocker';
|
||||
// NOTE: it's meant to be used behind a proxy (for example a load balancer)
|
||||
// that uses the 'x-forwarded-for' header to forward the original IP addresses.
|
||||
|
||||
const blockedIps = [];
|
||||
// A list of comma separated IPs to block
|
||||
// It works fine as long as the list is short,
|
||||
// if the list becomes too long for an env variable we'll switch to Redis.
|
||||
const BLOCKED_IPS_RAW = nconf.get('BLOCKED_IPS');
|
||||
|
||||
const blockedIps = BLOCKED_IPS_RAW
|
||||
? BLOCKED_IPS_RAW
|
||||
.trim()
|
||||
.split(',')
|
||||
.map(blockedIp => blockedIp.trim())
|
||||
.filter(blockedIp => Boolean(blockedIp))
|
||||
: [];
|
||||
|
||||
const blockedClients = [];
|
||||
|
||||
Blocker.watchBlockers({
|
||||
|
||||
Reference in New Issue
Block a user