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
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
51 additions
and
15 deletions
+51
-15
background.js
background.js
+24
-11
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,6 +261,18 @@ var getUserDetails = null
...
@@ -261,6 +261,18 @@ var getUserDetails = null
if
(
loggedIn
&&
request
.
action
===
'stopRecording'
)
{
if
(
loggedIn
&&
request
.
action
===
'stopRecording'
)
{
recording
=
false
;
recording
=
false
;
let
generatingOid
=
tutorShotId
let
generatingOid
=
tutorShotId
if
(
imageNumber
<
1
)
{
let
{
data
}
=
await
api
.
delete
(
"tutor-shot"
,
{
params
:
{
_id
:
tutorShotId
},
headers
:
{
userid
:
userDetails
.
uid
}
})
tutorShotId
=
null
sendMessageToActiveTab
(
"showRestartProcess"
)
setData
(
"recording"
,
false
)
setData
(
"tutorShotId"
,
null
)
return
}
else
{
tutorShotId
=
null
tutorShotId
=
null
sendResponse
({
sendResponse
({
userDetails
,
userDetails
,
...
@@ -276,6 +288,7 @@ var getUserDetails = null
...
@@ -276,6 +288,7 @@ var getUserDetails = null
imageNumber
=
0
;
imageNumber
=
0
;
return
return
}
}
}
if
(
request
.
action
===
'logout'
)
{
if
(
request
.
action
===
'logout'
)
{
loggedIn
=
false
;
loggedIn
=
false
;
recording
=
false
;
recording
=
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