Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend support command to dump log #446 #450

Merged
merged 43 commits into from
Jan 16, 2024
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
cd8a138
Removing the login command, fixes #444
shech2 Dec 21, 2023
5d7a362
Removing login command , #444
shech2 Dec 21, 2023
c1804c9
Restoring to default
shech2 Dec 21, 2023
28ca86b
Extending support command to dump log - added email and log #446
shech2 Dec 21, 2023
b005f51
Fixing some typos and making the code prettier
shech2 Dec 21, 2023
3851f18
Adding another fix i missed
shech2 Dec 21, 2023
88047a6
Merge branch 'master' into Extend_support_command_to_dump_log
shech2 Dec 21, 2023
b18eb77
Updating aatp to match our previous changes (replaced login with subs…
shech2 Dec 23, 2023
8e3084b
Fixing a typo
shech2 Dec 23, 2023
05fbe88
Adding netlify settings for cache
shech2 Dec 25, 2023
fe6c606
Making email shorter and clearer and now its asking for email if its …
shech2 Dec 25, 2023
98a0102
Adding Better feedback
shech2 Dec 25, 2023
cd66ee6
Fixing a typo
shech2 Dec 25, 2023
bd04d08
Changing email to let
shech2 Dec 25, 2023
02f2939
Updating index.html to match other PR's
shech2 Dec 25, 2023
7767f78
Modifing netlify to match all htmls
shech2 Dec 25, 2023
15e91fd
Refactoring dumpLog()
shech2 Dec 25, 2023
abc0d84
Adding a finer menu for support including copy to clipboard and sendi…
shech2 Dec 25, 2023
8aa38f0
Fixing bugs
shech2 Dec 25, 2023
90ceaa3
Fixing issues
shech2 Dec 25, 2023
ab6fe69
Deleting module script
shech2 Dec 25, 2023
577b5df
Restored main.ts
shech2 Dec 25, 2023
a5088d5
Changing writeln to notify
shech2 Dec 25, 2023
20c22ed
Adding Cancel chosise and changed to switch case
shech2 Dec 25, 2023
da10a86
Adding capacitor FileSystem plugin
shech2 Dec 27, 2023
6c4fead
Adding premissions for android
shech2 Dec 27, 2023
32457d3
Changing supportCMD function to check if Platform is native or not
shech2 Dec 28, 2023
cac3390
Adding support tests
shech2 Dec 28, 2023
12a0780
Coderabbit suggestions
shech2 Dec 28, 2023
b0dd275
Fixing all rejects
shech2 Dec 31, 2023
4b8696c
Merge branch 'master' into Extend_support_command_to_dump_log
shech2 Dec 31, 2023
812ef5b
Fixing a space
shech2 Dec 31, 2023
28749d3
Added suggested change
shech2 Dec 31, 2023
7f11b9b
Fixing a typo in support cmd
shech2 Jan 3, 2024
744653c
Deleting get-docker
shech2 Jan 3, 2024
e322124
Adding the required changes
shech2 Jan 3, 2024
539142e
Fixing the structure
shech2 Jan 3, 2024
1586aab
Changing "" with ''
shech2 Jan 3, 2024
723610f
Applying suggestions
shech2 Jan 3, 2024
0c826fe
Applying suggestions
shech2 Jan 3, 2024
faa462c
Fixing new line reject
shech2 Jan 10, 2024
baa13a2
Fixed the issue
shech2 Jan 15, 2024
a85358e
Improving tests stability
daonb Jan 16, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions aatp/peerbook_webrtc/admin.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ test.describe('peerbook administration', () => {
const fromPeerbook = await page.$$('.from-peerbook')
expect(fromPeerbook.length).toBe(0)
})
test('try login with an invalid email', async ({ browser }) => {
test('try subscribe with an invalid email', async ({ browser }) => {
// TODO: rename to context2
context = await browser.newContext()
page = await context.newPage()
Expand All @@ -261,7 +261,7 @@ test.describe('peerbook administration', () => {
await sleep(100)
if (await page.locator('[data-test="twr-minimized"]').isVisible())
await page.click('[data-test="twr-minimized"]')
await page.keyboard.type('login')
await page.keyboard.type('subscribe')
await page.keyboard.press("Enter")
await sleep(100)
let twr = await getTWRBuffer(page)
Expand All @@ -279,9 +279,9 @@ test.describe('peerbook administration', () => {
twr = await getTWRBuffer(page)
expect(twr).toMatch(/Invalid credentials/)
})
test('try login with an invalid OTP', async () => {
test('try subscribe with an invalid OTP', async () => {
await sleep(100)
await page.keyboard.type('login')
await page.keyboard.type('subscribe')
await page.keyboard.press("Enter")
await sleep(100)
let twr = await getTWRBuffer(page)
Expand All @@ -299,9 +299,9 @@ test.describe('peerbook administration', () => {
twr = await getTWRBuffer(page)
expect(twr).toMatch(/Invalid credentials/)
})
test('login with a valid email & OTP', async () => {
test('subscribe with a valid email & OTP', async () => {
await sleep(100)
await page.keyboard.type('login')
await page.keyboard.type('subscribe')
await page.keyboard.press("Enter")
await sleep(100)
let twr = await getTWRBuffer(page)
Expand Down
36 changes: 32 additions & 4 deletions src/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -712,7 +712,7 @@ async function subscribeCMD(shell: Shell) {
}
if (!terminal7.pb.isOpen()) {
if (!Capacitor.isNativePlatform()) {
loginCMD(shell);
await loginCMD(shell);
shech2 marked this conversation as resolved.
Show resolved Hide resolved
return
}
terminal7.pb.startSpinner()
Expand Down Expand Up @@ -981,9 +981,37 @@ async function configCMD(shell: Shell) {
await shell.openConfig()
}
async function supportCMD(shell: Shell) {
shell.t.write("Sorry things are not working well. Please ")
shell.t.writeln("\x1B]8;;https://github.com/tuzig/terminal7/issues/new?template=bug_report.md\x07report a bug\x1B]8;;\x07")
shell.t.writeln("or talk to us on our \x1B]8;;https://discord.gg/Puu2afdUtr\x07discord server\x1B]8;;\x07")
shell.t.write("Apologies. Have you tried resetting the App?\n")
shell.t.writeln("If that doesn't work, please send us a log of the error.")
const insecure = terminal7.conf.peerbook.insecure,
schema = insecure?"http":"https"

// ask for email address + check validity
const email = terminal7.conf.peerbook.email ? terminal7.conf.peerbook.email : (await shell.askValue("Enter your email address:"))
shech2 marked this conversation as resolved.
Show resolved Hide resolved
if (!email.includes("@")) {
shech2 marked this conversation as resolved.
Show resolved Hide resolved
shell.t.writeln("Invalid email address")
return
}

// Saving the log to the clipboard
terminal7.dumpLog()
shech2 marked this conversation as resolved.
Show resolved Hide resolved

// send the log to the server
const res = await fetch(`${schema}://${terminal7.conf.net.peerbook}/support`, {
method: "POST",
body: JSON.stringify({
email,
log: (await Clipboard.read()).value,
}),
})

// check the response
if (res.ok) {
shell.t.writeln("Thank you for your feedback")
}
else {
shell.t.writeln("Error sending feedback")
shech2 marked this conversation as resolved.
Show resolved Hide resolved
}
}
async function loginCMD(shell: Shell) {
if (terminal7.pb.isOpen()) {
Expand Down