Skip to content

Commit 57cafce

Browse files
committed
Add UAParser
1 parent 3d4abb0 commit 57cafce

File tree

4 files changed

+14
-8
lines changed

4 files changed

+14
-8
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,14 @@ Website for CSSNR GitHub Organization: https://cssnr.github.io/
1010

1111
For more information join us on Discord: https://discord.gg/wXy6m2X8wY
1212

13-
## Development
13+
# Development
1414

1515
Install Jekyll: https://jekyllrb.com/docs/installation/
1616

1717
Run: `jekyll serve -s src -o`
1818

19-
This will build the site from the `src` directory, open it in your browser, watch for file changes, automatically rebuild the site and refresh the site in your browser; enjoy =)
19+
This will build the site from the `src` directory, open it in your browser, watch for file changes, automatically
20+
rebuild the site and refresh the site in your browser; enjoy...
2021

2122
For more information see `jekyll help` and `jekyll serve --help` or visit: https://jekyllrb.com/docs/
2223

src/_config.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,5 @@ menu:
1515
link: /feedback/
1616

1717
github_url: https://github.com/cssnr
18-
1918
discord_invite: https://discord.gg/wXy6m2X8wY
20-
discord_webhook: https://relay.cssnr.com/discord/1258944618389569566
19+
relay_url: https://relay.cssnr.com/discord/1258944618389569566

src/html/feedback.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
---
22
layout: default
33
permalink: /feedback/
4-
noindex: true
54
title: Feedback
65
description: General Feedback and Inquiries.
6+
noindex: true
77
---
88

99
<div class="d-flex align-items-center h-100">
@@ -16,7 +16,7 @@ <h1 class="align-middle mb-0">{{ site.site_name }} {{ page.title }}</h1>
1616
Provide General Feedback or Ask a Question.
1717
</p>
1818
<form id="uninstall-form">
19-
<input type="hidden" value="{{ site.discord_webhook }}" id="discord-webhook" hidden="hidden">
19+
<input type="hidden" value="{{ site.relay_url }}" id="relay-url" hidden="hidden">
2020

2121
<select id="app-list" class="form-select form-select-lg form-control mb-3" aria-label="Select Feedback Reason">
2222
<option value="General Feedback" selected>Select an Application (Optional)</option>
@@ -43,6 +43,7 @@ <h1 class="align-middle mb-0">{{ site.site_name }} {{ page.title }}</h1>
4343
{% comment %}</div>{% endcomment %}
4444
{% comment %}</div>{% endcomment %}
4545

46+
<script src="https://cdnjs.cloudflare.com/ajax/libs/UAParser.js/1.0.37/ua-parser.min.js" integrity="sha512-LAchvH0Y4sxYM1ouOaqHQ6WbSXvOgkioPaiyW0oPOFNNMNfpsBEpvzYmsxgDf8pQM/fMaMdxYP/nFenquTAkdw==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
4647
<script src="https://cdnjs.cloudflare.com/ajax/libs/tsparticles/3.0.2/tsparticles.bundle.min.js" integrity="sha512-MM4W2ywPFL6GyTpBoj7PU6nyv2jJg47rLI8kEAL8vk20RHtAqIe9KdweahKUk+OivrdpZoMYfMi271ZdS6tRnQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
4748

4849
<script type="text/javascript" src="{{ "/js/config.js" | relative_url }}"></script>

src/js/feedback.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ async function formSubmit(event) {
6060
event.preventDefault()
6161
errorAlert.classList.add('d-none')
6262
// error.innerHTML = ''
63-
const url = event.target.elements['discord-webhook'].value
63+
const url = event.target.elements['relay-url'].value
6464
// console.debug('url:', url)
6565
const app = event.target.elements['app-list'].value
6666
// console.debug('app:', app)
@@ -72,9 +72,14 @@ async function formSubmit(event) {
7272
return console.warn('No Feedback Provided to Send.')
7373
}
7474
submitBtn.classList.add('disabled')
75+
const parser = new UAParser()
76+
const r = parser.getResult()
77+
const type = r.browser.type ? ` - ${r.browser.type}` : ''
7578
const lines = [
7679
`CSSNR GitHub Feedback for: **${app}**`,
77-
`\`${navigator.userAgent}\``,
80+
`**Browser**: ${r.browser.name} ${r.browser.major} (${r.engine.name} - ${r.browser.version})`,
81+
`**System**: ${r.os.name} ${r.os.version} (${r.cpu.architecture}${type})`,
82+
`**Referrer**: <${document.referrer || 'no-referrer'}>`,
7883
`\`\`\`\n${text}\n\`\`\``,
7984
]
8085
// console.debug('lines:', lines)

0 commit comments

Comments
 (0)