Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tutor-shot-extension
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ramdayal Munda
tutor-shot-extension
Commits
69f0af17
Commit
69f0af17
authored
Mar 15, 2024
by
Pragati Upadhyay
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
change branch
parent
1b29ea7b
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
66 additions
and
30 deletions
+66
-30
background.js
background.js
+39
-26
content.js
content.js
+25
-2
manifest.json
manifest.json
+1
-1
popup.js
popup.js
+1
-1
No files found.
background.js
View file @
69f0af17
var
getUserDetails
=
null
var
getUserDetails
=
null
!
function
()
{
!
function
()
{
var
origin
=
"http
s://begenieus.online
"
var
origin
=
"http
://localhost:3003
"
var
tutorShotId
=
null
var
tutorShotId
=
null
var
imageNumber
=
0
;
var
imageNumber
=
0
;
var
recording
=
false
;
var
recording
=
false
;
...
@@ -37,22 +37,22 @@ var getUserDetails = null
...
@@ -37,22 +37,22 @@ var getUserDetails = null
})
})
}
}
getData
(
'userDetails'
,
async
(
data
)
=>
{
getData
(
'userDetails'
,
async
(
data
)
=>
{
if
(
data
){
if
(
data
)
{
let
tso
=
await
getData
(
'tutorShotId'
)
let
tso
=
await
getData
(
'tutorShotId'
)
tutorShotId
=
tso
?
tso
:
null
tutorShotId
=
tso
?
tso
:
null
let
imgNum
=
await
getData
(
'imageNumber'
)
let
imgNum
=
await
getData
(
'imageNumber'
)
imageNumber
=
imgNum
?
imgNum
:
0
imageNumber
=
imgNum
?
imgNum
:
0
let
rec
=
await
getData
(
'recording'
)
let
rec
=
await
getData
(
'recording'
)
recording
=
rec
?
rec
:
false
recording
=
rec
?
rec
:
false
userDetails
=
data
userDetails
=
data
loggedIn
=
(
userDetails
.
email
||
userDetails
.
uid
)
?
true
:
false
;
loggedIn
=
(
userDetails
.
email
||
userDetails
.
uid
)
?
true
:
false
;
}
}
})
})
function
getStatus
(){
function
getStatus
()
{
return
tutorShotId
?
(
recording
?
"recording"
:
"paused"
)
:
"stopped"
return
tutorShotId
?
(
recording
?
"recording"
:
"paused"
)
:
"stopped"
}
}
...
@@ -261,20 +261,33 @@ var getUserDetails = null
...
@@ -261,20 +261,33 @@ var getUserDetails = null
if
(
loggedIn
&&
request
.
action
===
'stopRecording'
)
{
if
(
loggedIn
&&
request
.
action
===
'stopRecording'
)
{
recording
=
false
;
recording
=
false
;
let
generatingOid
=
tutorShotId
let
generatingOid
=
tutorShotId
tutorShotId
=
null
if
(
imageNumber
<
1
)
{
sendResponse
({
let
{
data
}
=
await
api
.
delete
(
"tutor-shot"
,
{
userDetails
,
params
:
{
_id
:
tutorShotId
},
loggedIn
,
headers
:
{
userid
:
userDetails
.
uid
}
recording
,
})
status
:
"generatingVideo"
tutorShotId
=
null
});
sendMessageToActiveTab
(
"showRestartProcess"
)
sendMessageToActiveTab
(
"generatingVideo"
)
setData
(
"recording"
,
false
)
await
api
.
post
(
'/tutor-shot/finalize'
,
{
_id
:
generatingOid
},
{
headers
:
{
userid
:
userDetails
.
uid
}
})
setData
(
"tutorShotId"
,
null
)
setData
(
"recording"
,
false
)
return
setData
(
"imageNumber"
,
0
)
}
setData
(
"tutorShotId"
,
null
)
else
{
imageNumber
=
0
;
tutorShotId
=
null
return
sendResponse
({
userDetails
,
loggedIn
,
recording
,
status
:
"generatingVideo"
});
sendMessageToActiveTab
(
"generatingVideo"
)
await
api
.
post
(
'/tutor-shot/finalize'
,
{
_id
:
generatingOid
},
{
headers
:
{
userid
:
userDetails
.
uid
}
})
setData
(
"recording"
,
false
)
setData
(
"imageNumber"
,
0
)
setData
(
"tutorShotId"
,
null
)
imageNumber
=
0
;
return
}
}
}
if
(
request
.
action
===
'logout'
)
{
if
(
request
.
action
===
'logout'
)
{
loggedIn
=
false
;
loggedIn
=
false
;
...
@@ -369,9 +382,9 @@ var getUserDetails = null
...
@@ -369,9 +382,9 @@ var getUserDetails = null
status
:
getStatus
(),
status
:
getStatus
(),
message
:
messageObj
message
:
messageObj
}
}
try
{
try
{
chrome
.
tabs
.
sendMessage
(
activeTab
?.
id
,
message
);
chrome
.
tabs
.
sendMessage
(
activeTab
?.
id
,
message
);
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
log
(
'error while sending data'
,
activeTab
,
message
)
console
.
log
(
'error while sending data'
,
activeTab
,
message
)
console
.
log
(
err
)
console
.
log
(
err
)
}
}
...
...
content.js
View file @
69f0af17
...
@@ -6,7 +6,7 @@ var floatingBar = null;
...
@@ -6,7 +6,7 @@ var floatingBar = null;
var
startingOverlay
=
null
;
var
startingOverlay
=
null
;
var
finalizingOverlay
=
null
;
var
finalizingOverlay
=
null
;
var
overlayInterval
=
null
;
var
overlayInterval
=
null
;
const
origin
=
"http
s://begenieus.online
"
const
origin
=
"http
://localhost:3003
"
var
userDetails
=
{};
var
userDetails
=
{};
var
btn
=
{};
var
btn
=
{};
var
tutorShotOid
=
null
;
var
tutorShotOid
=
null
;
...
@@ -335,7 +335,6 @@ window.addEventListener('mousedown', async function (e) {
...
@@ -335,7 +335,6 @@ window.addEventListener('mousedown', async function (e) {
}
}
let
newLineBreakIndex
=
captureInfo
.
text
.
search
(
'
\
n'
)
let
newLineBreakIndex
=
captureInfo
.
text
.
search
(
'
\
n'
)
if
(
newLineBreakIndex
!=
-
1
)
captureInfo
.
text
=
captureInfo
.
text
.
slice
(
0
,
newLineBreakIndex
)
if
(
newLineBreakIndex
!=
-
1
)
captureInfo
.
text
=
captureInfo
.
text
.
slice
(
0
,
newLineBreakIndex
)
// console.log('sending capture info', captureInfo)
chrome
.
runtime
.
sendMessage
({
action
:
"captureSS"
,
captureInfo
})
chrome
.
runtime
.
sendMessage
({
action
:
"captureSS"
,
captureInfo
})
let
data
=
await
getCaptureData
()
let
data
=
await
getCaptureData
()
reRenderFloatingBar
(
data
)
reRenderFloatingBar
(
data
)
...
@@ -382,6 +381,27 @@ chrome.runtime.onMessage.addListener(async function (message, sender, sendRespon
...
@@ -382,6 +381,27 @@ chrome.runtime.onMessage.addListener(async function (message, sender, sendRespon
}
}
}
}
else
if
(
message
.
message
==
'showRestartProcess'
)
{
finalizingOverlay
=
document
.
createElement
(
'div'
)
finalizingOverlay
.
setAttribute
(
'class'
,
'tutor-shot-overlay'
)
finalizingOverlay
.
setAttribute
(
'style'
,
`all: unset; position: fixed; top: 0px; bottom: 0px; left: 0px; right: 0px; background-color: #000000a0; pointer-events: inherit; z-index: 101; display: flex; color: white; justify-content: center; align-items: center; font-size: 28px;`
)
document
.
body
.
append
(
finalizingOverlay
)
finalizingOverlay
.
innerHTML
=
`
<div>
No Image found.
</div>
`
setTimeout
(()
=>
{
finalizingOverlay
.
remove
()
if
(
window
.
location
.
href
==
`
${
origin
}
/tutor-shot-list`
)
{
window
.
location
.
reload
()
}
else
{
window
.
open
(
`
${
origin
}
/tutor-shot-list`
)
}
reRenderFloatingBar
(
data
)
},
2000
)
reRenderFloatingBar
(
data
)
}
else
if
(
message
.
message
==
'generatingVideo'
)
{
else
if
(
message
.
message
==
'generatingVideo'
)
{
finalizingOverlay
=
document
.
createElement
(
'div'
)
finalizingOverlay
=
document
.
createElement
(
'div'
)
finalizingOverlay
.
setAttribute
(
'class'
,
'tutor-shot-overlay'
)
finalizingOverlay
.
setAttribute
(
'class'
,
'tutor-shot-overlay'
)
...
@@ -411,10 +431,13 @@ chrome.runtime.onMessage.addListener(async function (message, sender, sendRespon
...
@@ -411,10 +431,13 @@ chrome.runtime.onMessage.addListener(async function (message, sender, sendRespon
async
function
startRecording
()
{
async
function
startRecording
()
{
try
{
try
{
await
getCaptureData
();
await
getCaptureData
();
if
(
imageNumber
>=
1
){
let
{
data
}
=
await
api
.
post
(
'/tutor-shot'
,
{
title
:
"No Title"
},
{
headers
:
{
userId
:
userDetails
.
uid
}
})
let
{
data
}
=
await
api
.
post
(
'/tutor-shot'
,
{
title
:
"No Title"
},
{
headers
:
{
userId
:
userDetails
.
uid
}
})
if
(
data
.
success
)
{
if
(
data
.
success
)
{
await
chrome
.
runtime
.
sendMessage
({
action
:
"startRecording"
,
tutorShotId
:
data
.
tutorShot
.
_id
})
await
chrome
.
runtime
.
sendMessage
({
action
:
"startRecording"
,
tutorShotId
:
data
.
tutorShot
.
_id
})
}
}
}
else
return
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
log
(
'error while starting to record'
,
err
)
console
.
log
(
'error while starting to record'
,
err
)
inProgress
=
false
inProgress
=
false
...
...
manifest.json
View file @
69f0af17
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
"manifest_version"
:
3
,
"manifest_version"
:
3
,
"name"
:
"Tutor Shot"
,
"name"
:
"Tutor Shot"
,
"version"
:
"1.10"
,
"version"
:
"1.10"
,
"description"
:
"Capture web-page screenshots instantly with a single click. They're saved to your account at http
s://begenieus.online
."
,
"description"
:
"Capture web-page screenshots instantly with a single click. They're saved to your account at http
://localhost:3003
."
,
"permissions"
:
[
"permissions"
:
[
"activeTab"
,
"activeTab"
,
"storage"
"storage"
...
...
popup.js
View file @
69f0af17
!
function
()
{
!
function
()
{
const
origin
=
"http
s://begenieus.online
"
const
origin
=
"http
://localhost:3003
"
const
api
=
axios
.
create
({
const
api
=
axios
.
create
({
baseURL
:
`
${
origin
}
/api`
,
// the base URL for nodeserver is okay but NGINX is giving error
baseURL
:
`
${
origin
}
/api`
,
// the base URL for nodeserver is okay but NGINX is giving error
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment