Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
10 changes: 5 additions & 5 deletions public/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
"version": "0.10.0",
"manifest_version": 3,
"icons": {
"16": "./static/logo/Logo_16.png",
"32": "./static/logo/Logo_32.png",
"48": "./static/logo/Logo_48.png",
"128": "./static/logo/Logo_128.png",
"256": "./static/logo/Logo_256.png"
"16": "./static/Logo_16.png",
"32": "./static/Logo_32.png",
"48": "./static/Logo_48.png",
"128": "./static/Logo_128.png",
"256": "./static/Logo_256.png"
},
"action": {
"default_popup": "./popup.html"
Expand Down
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
10 changes: 6 additions & 4 deletions src/background/background.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import "./controllers/camera_bubble_controller";
import "./controllers/current_window_tab_controller";
import "./controllers/recording_controller";
import "./controllers/storage_controller";
import "./services/active_tab_setter/active_tab_setter";
import "./services/active_window_setter/active_window_setter";
import "./services/camera_bubble_injector/camera_bubble_injector";
import "./services/permissions_giver/permissions_giver";
import "./services/recording_controller/recording_controller";
import "./services/storage_controller/storage_controller";
23 changes: 0 additions & 23 deletions src/background/controllers/current_window_tab_controller.ts

This file was deleted.

2 changes: 1 addition & 1 deletion src/background/offscreen.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
import "./controllers/recorder_controller";
import "./services/recorder_controller/recorder_controller";
12 changes: 12 additions & 0 deletions src/background/services/active_tab_setter/active_tab_setter.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { storage } from "@/shared/storage";

chrome.tabs.onActivated.addListener((activatedTabInfo) => {
console.log("Handle 'chrome.tabs.onActivated'");
(async () => {
await storage.current.tabId.set(activatedTabInfo.tabId);
})().catch((err) => {
console.error(
`Error in 'chrome.tabs.onActivated' handler: ${(err as Error).toString()}`,
);
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { storage } from "@/shared/storage";

chrome.windows.onFocusChanged.addListener((windowId) => {
console.log("Handle 'chrome.windows.onFocusChanged'");
(async () => {
await storage.current.windowId.set(windowId);
})().catch((err) => {
console.error(
`Error in 'chrome.windows.onFocusChanged' handler: ${(err as Error).toString()}`,
);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ import {
MessageResponse,
MessageResponseType,
MessageType,
} from "@/app/messaging";
import { storage } from "@/app/storage";
import { Injection, InjectionElementId } from "@/app/injections";
import { Injector } from "@/background/injector";
} from "@/shared/messaging";
import { storage } from "@/shared/storage";
import { Injection, InjectionElementId } from "@/shared/injections";
import { Injector } from "./injector";

class CameraBubbleController {
class CameraBubbleInjector {
static async show() {
console.log("CameraBubbleController.show()");
console.log("CameraBubbleInjector.show()");
const [currentTab] = await chrome.tabs.query({
active: true,
lastFocusedWindow: true,
Expand All @@ -21,7 +21,7 @@ class CameraBubbleController {
}

static async hide() {
console.log("CameraBubbleController.hide()");
console.log("CameraBubbleInjector.hide()");
await Injector.deinject(
await storage.ui.cameraBubble.tabId.get(),
InjectionElementId.CameraBubble,
Expand All @@ -37,8 +37,8 @@ chrome.tabs.onActivated.addListener((_activeTabInfo) => {
if (!(await storage.ui.cameraBubble.enabled.get())) {
return;
}
await CameraBubbleController.hide();
await CameraBubbleController.show();
await CameraBubbleInjector.hide();
await CameraBubbleInjector.show();
})().catch((err) => {
console.error(
`Error in 'chrome.tabs.onActivated' handler: ${(err as Error).toString()}`,
Expand All @@ -52,7 +52,7 @@ chrome.tabs.onUpdated.addListener((_tabId, _changeInfo, _tab) => {
if (!(await storage.ui.cameraBubble.enabled.get())) {
return;
}
await CameraBubbleController.show();
await CameraBubbleInjector.show();
})().catch((err) => {
console.error(
`Error in 'chrome.tabs.onUpdated' handler: ${(err as Error).toString()}`,
Expand All @@ -66,7 +66,7 @@ chrome.tabs.onRemoved.addListener((_closedTabId, _removeInfo) => {
if (!(await storage.ui.cameraBubble.enabled.get())) {
return;
}
await CameraBubbleController.show();
await CameraBubbleInjector.show();
})().catch((err) => {
console.error(
`Error in 'chrome.tabs.onRemoved' handler: ${(err as Error).toString()}`,
Expand All @@ -80,8 +80,8 @@ chrome.windows.onFocusChanged.addListener((_windowId) => {
if (!(await storage.ui.cameraBubble.enabled.get())) {
return;
}
await CameraBubbleController.hide();
await CameraBubbleController.show();
await CameraBubbleInjector.hide();
await CameraBubbleInjector.show();
})().catch((err) => {
console.error(
`Error in 'chrome.windows.onFocusChanged' handler: ${(err as Error).toString()}`,
Expand All @@ -102,10 +102,10 @@ chrome.runtime.onMessage.addListener(
}
switch (type) {
case MessageType.CameraBubbleShow:
await CameraBubbleController.show();
await CameraBubbleInjector.show();
break;
case MessageType.CameraBubbleHide:
await CameraBubbleController.hide();
await CameraBubbleInjector.hide();
break;
}
})()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Injection, InjectionElementId } from "@/app/injections";
import type { Injection, InjectionElementId } from "@/shared/injections";

export class Injector {
static inject(tabId: number, injection: Injection) {
Expand Down
13 changes: 13 additions & 0 deletions src/background/services/permissions_giver/permissions_giver.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
chrome.runtime.onInstalled.addListener((_details) => {
console.log("Handle 'chrome.runtime.onInstalled'");
(async () => {
await chrome.tabs.create({
active: true,
url: chrome.runtime.getURL("permissions.html"),
});
})().catch((err) => {
console.error(
`Error in 'chrome.runtime.onInstalled' handler: ${(err as Error).toString()}`,
);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
MessageType,
RecorderCreateOptions,
sender,
} from "@/app/messaging";
} from "@/shared/messaging";

class Recorder {
#mimeType: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import {
MessageType,
RecordingSaveOptions,
sender,
} from "@/app/messaging";
import { RecordingState, storage } from "@/app/storage";
} from "@/shared/messaging";
import { RecordingState, storage } from "@/shared/storage";

class RecordingController {
static async start() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { config } from "@/app/config";
import { RecordingState, storage } from "@/app/storage";
import { config } from "@/shared/config";
import { RecordingState, storage } from "@/shared/storage";

chrome.runtime.onInstalled.addListener((_details) => {
console.log("Handle 'chrome.runtime.onInstalled'");
Expand All @@ -23,11 +23,6 @@ chrome.runtime.onInstalled.addListener((_details) => {
console.log(
`Storage: ${JSON.stringify(await storage.getEntireStorage(), undefined, 2)}`,
);

await chrome.tabs.create({
active: true,
url: chrome.runtime.getURL("permissions.html"),
});
})().catch((err) => {
console.error(
`Error in 'chrome.runtime.onInstalled' handler: ${(err as Error).toString()}`,
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/ui/hooks/useStorageValue.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
createStorageSetter,
StorageKey,
StorageValueType,
} from "@/app/storage";
} from "@/shared/storage";

export default function useStorageValue<Key extends StorageKey>(
storageKey: Key,
Expand Down
2 changes: 1 addition & 1 deletion src/ui/pages/camera_bubble/CameraBubble.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { StorageKey } from "@/app/storage";
import { StorageKey } from "@/shared/storage";
import useStorageValue from "@/ui/hooks/useStorageValue";
import { Draggable } from "./components/Draggable";

Expand Down
4 changes: 2 additions & 2 deletions src/ui/pages/camera_bubble/camera_bubble.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";
import ReactDOM from "react-dom/client";
import { Injection, InjectionElementId } from "@/app/injections";
import { storage } from "@/app/storage";
import { Injection, InjectionElementId } from "@/shared/injections";
import { storage } from "@/shared/storage";
import { CameraBubble } from "./CameraBubble";

async function inject() {
Expand Down
8 changes: 4 additions & 4 deletions src/ui/pages/popup/Popup.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { RecordingState, StorageKey } from "@/app/storage";
import { sender } from "@/app/messaging";
import { RecordingState, StorageKey } from "@/shared/storage";
import { sender } from "@/shared/messaging";
import useStorageValue from "@/ui/hooks/useStorageValue";
import { PauseButton } from "./components/PauseButton";
import { PlayButton } from "./components/PlayButton";
Expand All @@ -14,8 +14,8 @@ import {
IconTrash,
IconUserCircle,
} from "@tabler/icons-react";
import background from "/assets/Background.svg";
import lookup128 from "/assets/Lookup_128.png";
import background from "/static/Background.svg";
import lookup128 from "/static/Lookup_128.png";

const Settings = () => {
const [cameraBubbleEnabled] = useStorageValue(
Expand Down
3 changes: 1 addition & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@
"paths": {
/* Specify a set of entries that re-map imports to additional lookup locations. */
"@/*": ["./*"],
"/static/*": ["../public/static/*"],
"/assets/*": ["./ui/assets/*"]
"/static/*": ["../public/static/*"]
},
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
"typeRoots": [
Expand Down