mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-14 13:17:24 +01:00
Compare commits
26 Commits
v5.41.7
...
fiz/item-c
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
872182ce19 | ||
|
|
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);
|
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', () => {
|
describe('Blocking clients', () => {
|
||||||
@@ -194,4 +203,4 @@ describe('Blocker middleware', () => {
|
|||||||
expect(calledWith[0] instanceof Forbidden).to.equal(true);
|
expect(calledWith[0] instanceof Forbidden).to.equal(true);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -130,4 +130,4 @@ export default {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
@@ -120,6 +120,7 @@
|
|||||||
<div
|
<div
|
||||||
slot="drawer-slider"
|
slot="drawer-slider"
|
||||||
class="equipment items items-one-line"
|
class="equipment items items-one-line"
|
||||||
|
:class="getContainerClass()"
|
||||||
>
|
>
|
||||||
<item
|
<item
|
||||||
v-for="(label, group) in gearTypesToStrings"
|
v-for="(label, group) in gearTypesToStrings"
|
||||||
@@ -238,6 +239,86 @@
|
|||||||
background: $gray-10 !important;
|
background: $gray-10 !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@media (max-width: 768px) {
|
||||||
|
.equipment.items.items-one-line {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
justify-content: center;
|
||||||
|
gap: 12px;
|
||||||
|
padding: 0 8px;
|
||||||
|
|
||||||
|
.item-wrapper {
|
||||||
|
flex: 0 0 auto;
|
||||||
|
margin-right: 0;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.equipment-scale-default .item-wrapper {
|
||||||
|
.item {
|
||||||
|
width: 94px;
|
||||||
|
height: 92px;
|
||||||
|
}
|
||||||
|
.item-label {
|
||||||
|
width: 94px;
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&.equipment-scale-small .item-wrapper {
|
||||||
|
.item {
|
||||||
|
width: 70px;
|
||||||
|
height: 70px;
|
||||||
|
}
|
||||||
|
.item-label {
|
||||||
|
width: 70px;
|
||||||
|
font-size: 10px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.item-wrapper:nth-child(4n+1) {
|
||||||
|
clear: left;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (min-width: 769px) and (max-width: 1024px) {
|
||||||
|
.equipment.items.items-one-line {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
justify-content: center;
|
||||||
|
gap: 12px;
|
||||||
|
padding: 0 12px;
|
||||||
|
|
||||||
|
.item-wrapper {
|
||||||
|
flex: 0 0 auto;
|
||||||
|
margin-right: 0;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.equipment-scale-default .item-wrapper {
|
||||||
|
.item {
|
||||||
|
width: 84px;
|
||||||
|
height: 82px;
|
||||||
|
}
|
||||||
|
.item-label {
|
||||||
|
width: 84px;
|
||||||
|
font-size: 11px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&.equipment-scale-small .item-wrapper {
|
||||||
|
.item {
|
||||||
|
width: 65px;
|
||||||
|
height: 65px;
|
||||||
|
}
|
||||||
|
.item-label {
|
||||||
|
width: 65px;
|
||||||
|
font-size: 10px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
@@ -351,6 +432,7 @@ export default {
|
|||||||
searchText: null,
|
searchText: null,
|
||||||
searchTextThrottled: null,
|
searchTextThrottled: null,
|
||||||
costumeMode: false,
|
costumeMode: false,
|
||||||
|
windowWidth: window.innerWidth,
|
||||||
groupByItems: [
|
groupByItems: [
|
||||||
'type', 'class',
|
'type', 'class',
|
||||||
],
|
],
|
||||||
@@ -523,8 +605,27 @@ export default {
|
|||||||
subSection: this.$t('equipment'),
|
subSection: this.$t('equipment'),
|
||||||
section: this.$t('inventory'),
|
section: this.$t('inventory'),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.handleResize = throttle(() => {
|
||||||
|
this.windowWidth = window.innerWidth;
|
||||||
|
}, 250);
|
||||||
|
window.addEventListener('resize', this.handleResize);
|
||||||
|
},
|
||||||
|
beforeDestroy () {
|
||||||
|
window.removeEventListener('resize', this.handleResize);
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
getContainerClass () {
|
||||||
|
const equippedCount = Object.keys(this.gearTypesToStrings).filter(group => {
|
||||||
|
const item = this.flatGear[this.activeItems[group]];
|
||||||
|
return item && item.key.indexOf('_base_0') === -1;
|
||||||
|
}).length;
|
||||||
|
|
||||||
|
if (this.windowWidth <= 1024) {
|
||||||
|
return equippedCount > 4 ? 'equipment-scale-small' : 'equipment-scale-default';
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
},
|
||||||
selectDrawerTab (tabName) {
|
selectDrawerTab (tabName) {
|
||||||
let tabNameValue;
|
let tabNameValue;
|
||||||
if (tabName === 'costume') {
|
if (tabName === 'costume') {
|
||||||
|
|||||||
@@ -111,7 +111,7 @@
|
|||||||
.toggle-switch-inner:before {
|
.toggle-switch-inner:before {
|
||||||
content: "";
|
content: "";
|
||||||
padding-left: 10px;
|
padding-left: 10px;
|
||||||
background-color: $green-50;
|
background-color: $purple-300;
|
||||||
}
|
}
|
||||||
|
|
||||||
.toggle-switch-inner:after {
|
.toggle-switch-inner:after {
|
||||||
|
|||||||
@@ -4,4 +4,4 @@
|
|||||||
"newsroom": "Newsroom",
|
"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.",
|
"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."
|
"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);
|
res.respond(200, savedBlocker);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
export default api;
|
export default api;
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import nconf from 'nconf';
|
||||||
import {
|
import {
|
||||||
Forbidden,
|
Forbidden,
|
||||||
} from '../libs/errors';
|
} 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)
|
// 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.
|
// 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 = [];
|
const blockedClients = [];
|
||||||
|
|
||||||
Blocker.watchBlockers({
|
Blocker.watchBlockers({
|
||||||
@@ -53,4 +66,4 @@ export default function ipBlocker (req, res, next) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return next();
|
return next();
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user