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
eecbefee
Commit
eecbefee
authored
May 17, 2024
by
Anveeg
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
https://git.agamitechnologies.com/ramdayal/tutor-shot-extension
parents
2dd55061
506b1999
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
65 additions
and
3 deletions
+65
-3
background.js
background.js
+5
-0
content.js
content.js
+20
-2
popup.js
popup.js
+40
-1
No files found.
background.js
View file @
eecbefee
...
@@ -289,6 +289,10 @@ var getUserDetails = null
...
@@ -289,6 +289,10 @@ var getUserDetails = null
return
return
}
}
}
}
if
(
loggedIn
&&
request
.
action
===
'limitExceed'
)
{
sendMessageToActiveTab
(
"limitExceed"
)
return
}
if
(
request
.
action
===
'logout'
)
{
if
(
request
.
action
===
'logout'
)
{
loggedIn
=
false
;
loggedIn
=
false
;
recording
=
false
;
recording
=
false
;
...
@@ -335,6 +339,7 @@ var getUserDetails = null
...
@@ -335,6 +339,7 @@ var getUserDetails = null
}
}
chrome
.
tabs
.
query
({
active
:
true
,
currentWindow
:
true
},
function
(
tabs
)
{
chrome
.
tabs
.
query
({
active
:
true
,
currentWindow
:
true
},
function
(
tabs
)
{
if
(
tabs
&&
tabs
.
length
)
{
// if any tab is active
if
(
tabs
&&
tabs
.
length
)
{
// if any tab is active
console
.
log
(
"🚀 ~ tabs:"
,
tabs
)
var
activeTab
=
tabs
[
0
]
var
activeTab
=
tabs
[
0
]
chrome
.
tabs
.
captureVisibleTab
({
format
:
"png"
},
async
function
(
dataUrl
)
{
chrome
.
tabs
.
captureVisibleTab
({
format
:
"png"
},
async
function
(
dataUrl
)
{
let
message
=
{
let
message
=
{
...
...
content.js
View file @
eecbefee
...
@@ -223,7 +223,8 @@ async function login() {
...
@@ -223,7 +223,8 @@ async function login() {
let
userDetails
=
{
let
userDetails
=
{
uid
:
localStorage
.
getItem
(
'userId'
),
uid
:
localStorage
.
getItem
(
'userId'
),
name
:
localStorage
.
getItem
(
'name'
),
name
:
localStorage
.
getItem
(
'name'
),
email
:
localStorage
.
getItem
(
'email'
)
email
:
localStorage
.
getItem
(
'email'
),
userOid
:
localStorage
.
getItem
(
'userOid'
)
}
}
if
(
userDetails
?.
uid
||
userDetails
?.
email
)
{
// can login
if
(
userDetails
?.
uid
||
userDetails
?.
email
)
{
// can login
chrome
.
runtime
.
sendMessage
({
action
:
"login"
,
userDetails
})
chrome
.
runtime
.
sendMessage
({
action
:
"login"
,
userDetails
})
...
@@ -388,7 +389,7 @@ chrome.runtime.onMessage.addListener(async function (message, sender, sendRespon
...
@@ -388,7 +389,7 @@ chrome.runtime.onMessage.addListener(async function (message, sender, sendRespon
document
.
body
.
append
(
finalizingOverlay
)
document
.
body
.
append
(
finalizingOverlay
)
finalizingOverlay
.
innerHTML
=
`
finalizingOverlay
.
innerHTML
=
`
<div>
<div>
No
Image found
.
No
screenshots have been captured for video creation yet
.
</div>
</div>
`
`
setTimeout
(()
=>
{
setTimeout
(()
=>
{
...
@@ -402,6 +403,23 @@ chrome.runtime.onMessage.addListener(async function (message, sender, sendRespon
...
@@ -402,6 +403,23 @@ chrome.runtime.onMessage.addListener(async function (message, sender, sendRespon
},
2000
)
},
2000
)
reRenderFloatingBar
(
data
)
reRenderFloatingBar
(
data
)
}
}
else
if
(
message
.
message
==
'limitExceed'
)
{
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>
Video creation limit reached.
Upgrade to continue or contact support.
</div>
`
setTimeout
(()
=>
{
finalizingOverlay
.
remove
()
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'
)
...
...
popup.js
View file @
eecbefee
...
@@ -22,6 +22,9 @@
...
@@ -22,6 +22,9 @@
let
logoutBtn
=
document
.
getElementById
(
'logout-btn'
)
let
logoutBtn
=
document
.
getElementById
(
'logout-btn'
)
myCapturesBtn
.
addEventListener
(
'click'
,(
e
)
=>
{
window
.
open
(
origin
+
'/tutor-shot-list'
)
})
myCapturesBtn
.
addEventListener
(
'click'
,(
e
)
=>
{
window
.
open
(
origin
+
'/tutor-shot-list'
)
})
let
userDetails
=
{};
let
userDetails
=
{};
let
maxTutorShotLimit
=
{};
let
savedTutorShot
=
{};
let
inProgress
=
false
;
let
inProgress
=
false
;
logoutBtn
.
addEventListener
(
'click'
,
()
=>
{
logoutBtn
.
addEventListener
(
'click'
,
()
=>
{
...
@@ -42,6 +45,17 @@
...
@@ -42,6 +45,17 @@
}
}
inProgress
=
true
inProgress
=
true
try
{
try
{
let
limitExceed
=
await
getSubscriptions
()
if
(
limitExceed
){
window
.
close
()
chrome
.
runtime
.
sendMessage
({
action
:
"limitExceed"
},
async
function
(
response
)
{
loggedIn
=
false
userDetails
.
email
=
""
userDetails
.
uid
=
""
modifyPopupUI
()
})
return
;
}
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
){
chrome
.
runtime
.
sendMessage
({
action
:
"startRecording"
,
tutorShotId
:
data
.
tutorShot
.
_id
},
async
function
(
response
)
{
chrome
.
runtime
.
sendMessage
({
action
:
"startRecording"
,
tutorShotId
:
data
.
tutorShot
.
_id
},
async
function
(
response
)
{
...
@@ -85,7 +99,32 @@
...
@@ -85,7 +99,32 @@
}
}
}
}
let
getAuthHeader
=
function
(){
return
{
headers
:
{
username
:
userDetails
.
name
,
userid
:
userDetails
.
uid
,
useroid
:
userDetails
.
userOid
,
}
}
}
async
function
getSubscriptions
(){
try
{
if
(
!
userDetails
.
uid
)
return
let
{
data
}
=
await
api
.
get
(
"common/subscriptions"
,
{
headers
:
getAuthHeader
().
headers
})
if
(
data
.
success
){
const
moduleObject
=
data
.
subscriptionData
.
feature
.
find
(
obj
=>
obj
.
module
===
'TUTOR_SHOT'
);
maxTutorShotLimit
=
moduleObject
?
moduleObject
.
quantity
:
null
;
api
.
defaults
.
headers
.
userId
=
userDetails
.
uid
const
tutorData
=
await
api
.
get
(
"tutor-shot/"
)
savedTutorShot
=
tutorData
.
data
.
list
.
length
if
(
maxTutorShotLimit
<=
savedTutorShot
)
return
true
else
return
false
}
}
catch
(
err
){
console
.
log
(
err
)
}
}
function
domLoadHandler
()
{
function
domLoadHandler
()
{
chrome
.
runtime
.
sendMessage
({
action
:
"checkStatus"
},
function
(
response
)
{
chrome
.
runtime
.
sendMessage
({
action
:
"checkStatus"
},
function
(
response
)
{
...
...
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