custom user-agent: rename "auto-fill" button to "Disguise as"

- Give Firefox and Chrome alternatives
- Update firefox user-agent to 78
This commit is contained in:
Alice Gaudon 2020-07-14 09:49:30 +02:00
parent e9b1b973c1
commit 03f275e6e8
3 changed files with 38 additions and 19 deletions

View File

@ -71,22 +71,28 @@ form {
margin: 8px; margin: 8px;
grid-template-columns: 0fr auto 0fr; grid-template-columns: 0fr auto 0fr;
&.no-expand {
display: flex;
flex-direction: row;
justify-content: center;
} }
.form-group > * { > * {
margin: 8px; margin: 8px;
padding: 8px; padding: 8px;
white-space: nowrap; white-space: nowrap;
align-self: center; align-self: center;
} }
.form-group > :first-child { > :first-child {
justify-self: end; justify-self: end;
} }
.form-group > :not(:first-child) { > :not(:first-child) {
margin-left: 8px; margin-left: 8px;
} }
}
label.form-group { label.form-group {
line-height: 29px; line-height: 29px;

View File

@ -42,12 +42,19 @@
<textarea name="customCSS" id="custom-css" rows="3"></textarea> <textarea name="customCSS" id="custom-css" rows="3"></textarea>
</div> </div>
<fieldset>
<legend>Disguise</legend>
<div class="form-group"> <div class="form-group">
<label for="custom-user-agent">Custom UserAgent (i.e. google services)</label> <label for="custom-user-agent">Custom UserAgent (i.e. google services)</label>
<input type="text" name="customUserAgent" id="custom-user-agent"> <input type="text" name="customUserAgent" id="custom-user-agent">
<button type="button" id="userAgentAutoFill">Auto-fill</button>
</div> </div>
<div class="form-group no-expand">
<button type="button" id="userAgentAutoFillFirefox">Disguise as firefox</button>
<button type="button" id="userAgentAutoFillChrome">Disguise as chrome</button>
</div>
</fieldset>
<div id="icon-choice"> <div id="icon-choice">
<div class="form-group-header"> <div class="form-group-header">
<h2>Service icon</h2> <h2>Service icon</h2>

View File

@ -72,10 +72,16 @@ document.addEventListener('DOMContentLoaded', () => {
ipcRenderer.send('sync-settings'); ipcRenderer.send('sync-settings');
document.getElementById('userAgentAutoFill')?.addEventListener('click', () => { document.getElementById('userAgentAutoFillFirefox')?.addEventListener('click', () => {
let customUserAgent = document.getElementById('custom-user-agent'); let customUserAgent = document.getElementById('custom-user-agent');
if (customUserAgent) { if (customUserAgent) {
(<HTMLInputElement>customUserAgent).value = 'Mozilla/5.0 (X11; Linux x86_64; rv:73.0) Gecko/20100101 Firefox/73.0'; (<HTMLInputElement>customUserAgent).value = 'Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0';
}
});
document.getElementById('userAgentAutoFillChrome')?.addEventListener('click', () => {
let customUserAgent = document.getElementById('custom-user-agent');
if (customUserAgent) {
(<HTMLInputElement>customUserAgent).value = 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36';
} }
}); });
}); });