mirror of
https://github.com/calzoneman/sync.git
synced 2024-09-13 04:32:09 +00:00

Camo: https://github.com/atmos/camo. This has a couple advantages over just allowing images to be dumped as-is: - Prevents mixed-content warnings by allowing the server to proxy HTTP images to an HTTPS camo instance - Protects users' privacy by not exposing their browser directly to the image host - Allows the camo proxy to intercept and reject bad image sources (URLs that are not actually images, gigapixel-sized images likely to DoS users' browsers, etc.) Whitelisting specific domains is supported for cases where the source is known to be trustworthy.
26 lines
813 B
JavaScript
26 lines
813 B
JavaScript
const assert = require('assert');
|
|
const CamoConfig = require('../../lib/configuration/camoconfig').CamoConfig;
|
|
|
|
describe('CamoConfig', () => {
|
|
describe('#constructor', () => {
|
|
it('strips trailing slashes from the server', () => {
|
|
const config = new CamoConfig({
|
|
camo: {
|
|
server: 'http://abc.xyz/'
|
|
}
|
|
});
|
|
assert.strictEqual(config.getServer(), 'http://abc.xyz');
|
|
});
|
|
|
|
it('defaults to enabled=false', () => {
|
|
assert.strictEqual(new CamoConfig().isEnabled(), false);
|
|
});
|
|
});
|
|
|
|
describe('#getWhitelistedDomains', () => {
|
|
it('defaults to an empty array', () => {
|
|
assert.deepStrictEqual(new CamoConfig().getWhitelistedDomains(), []);
|
|
});
|
|
});
|
|
});
|