-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d11e642
commit 3e0e75c
Showing
21 changed files
with
1,192 additions
and
985 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 9 additions & 10 deletions
19
apps/extension/src/content-scripts/injected-request-listener.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
import './message-external'; | ||
import './tabs-updated-prax-init'; | ||
import './message-prax-init'; | ||
import './message-prax-request'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
/* eslint-disable */ | ||
|
||
// this is temporary code to use the externally_connectable permission, | ||
// also providing an easter egg for curious users | ||
chrome.runtime.onMessageExternal.addListener((_, __, response) => { | ||
return response('penumbra is the key'); | ||
response('penumbra is the key'); | ||
return true; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { alreadyApprovedOrigin } from '../origins/approve-origin'; | ||
import { PraxConnection } from '../message/prax'; | ||
import { assertValidSender } from '../origins/valid-sender'; | ||
|
||
// trigger injected-connection-port when a known page inits. | ||
chrome.runtime.onMessage.addListener( | ||
(req: unknown, sender, emptyResponse: (no?: never) => void) => { | ||
if (req !== PraxConnection.Init) return false; | ||
emptyResponse(); | ||
|
||
void (async () => { | ||
const validSender = assertValidSender(sender); | ||
const alreadyApproved = await alreadyApprovedOrigin(validSender.origin); | ||
if (alreadyApproved) | ||
void chrome.runtime.sendMessage(PraxConnection.Init, { documentId: sender.documentId }); | ||
})(); | ||
|
||
return true; | ||
}, | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,4 @@ | ||
export enum PraxConnection { | ||
Init = 'Init', | ||
Request = 'Request', | ||
Denied = 'Denied', | ||
NeedsLogin = 'NeedsLogin', | ||
} |
4 changes: 2 additions & 2 deletions
4
apps/extension/src/approve-origin.test.ts → ...ension/src/origins/approve-origin.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.