Skip to content

Commit

Permalink
Remove maze utils symlink
Browse files Browse the repository at this point in the history
  • Loading branch information
ajayyy committed Aug 2, 2023
1 parent 8840dba commit 16005e4
Show file tree
Hide file tree
Showing 26 changed files with 58 additions and 66 deletions.
9 changes: 1 addition & 8 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,4 @@ Make sure to pull and update all submodules
`git submodule update --init --recursive`

"? property does not exist on type ConfigClass"
> Make sure to copy `config.json.example` to `config.json` and remove comments
# Windows
"Cannot find module "../maze-utils"
- Enable "Developer Mode" in windows for symlinks
- `src/maze-utils` will not appear properly and builds will fail since it is is only rendered as a file
- Enable symlink support in git `git config --global core.symlinks true`
- run `git checkout -- src/maze-utils` in order to create a symlink instead of a text file
> Make sure to copy `config.json.example` to `config.json` and remove comments
10 changes: 5 additions & 5 deletions src/background.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ import * as CompileConfig from "../config.json";
import Config from "./config";
import { Registration } from "./types";
import "content-scripts-register-polyfill";
import { sendRealRequestToCustomServer, setupBackgroundRequestProxy } from "./maze-utils/background-request-proxy";
import { setupTabUpdates } from "./maze-utils/tab-updates";
import { generateUserID } from "./maze-utils/setup";
import { sendRealRequestToCustomServer, setupBackgroundRequestProxy } from "../maze-utils/src/background-request-proxy";
import { setupTabUpdates } from "../maze-utils/src/tab-updates";
import { generateUserID } from "../maze-utils/src/setup";

// Make the config public for debugging purposes

window.SB = Config;

import Utils from "./utils";
import { getExtensionIdsToImportFrom } from "./utils/crossExtension";
import { isFirefoxOrSafari } from "./maze-utils";
import { injectUpdatedScripts } from "./maze-utils/cleanup";
import { isFirefoxOrSafari } from "../maze-utils/src";
import { injectUpdatedScripts } from "../maze-utils/src/cleanup";
import { logWarn } from "./utils/logger";
const utils = new Utils({
registerFirefoxContentScript,
Expand Down
2 changes: 1 addition & 1 deletion src/components/CategoryPillComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { downvoteButtonColor, SkipNoticeAction } from "../utils/noticeUtils";
import { VoteResponse } from "../messageTypes";
import { AnimationUtils } from "../utils/animationUtils";
import { Tooltip } from "../render/Tooltip";
import { getErrorMessage } from "../maze-utils/formating";
import { getErrorMessage } from "../../maze-utils/src/formating";

export interface CategoryPillProps {
vote: (type: number, UUID: SegmentUUID, category?: Category) => Promise<VoteResponse>;
Expand Down
2 changes: 1 addition & 1 deletion src/components/ChapterVoteComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { downvoteButtonColor, SkipNoticeAction } from "../utils/noticeUtils";
import { VoteResponse } from "../messageTypes";
import { AnimationUtils } from "../utils/animationUtils";
import { Tooltip } from "../render/Tooltip";
import { getErrorMessage } from "../maze-utils/formating";
import { getErrorMessage } from "../../maze-utils/src/formating";

export interface ChapterVoteProps {
vote: (type: number, UUID: SegmentUUID, category?: Category) => Promise<VoteResponse>;
Expand Down
4 changes: 2 additions & 2 deletions src/components/SkipNoticeComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import ThumbsUpSvg from "../svg-icons/thumbs_up_svg";
import ThumbsDownSvg from "../svg-icons/thumbs_down_svg";
import PencilSvg from "../svg-icons/pencil_svg";
import { downvoteButtonColor, SkipNoticeAction } from "../utils/noticeUtils";
import { generateUserID } from "../maze-utils/setup";
import { keybindToString } from "../maze-utils/config";
import { generateUserID } from "../../maze-utils/src/setup";
import { keybindToString } from "../../maze-utils/src/config";

enum SkipButtonState {
Undo, // Unskip
Expand Down
2 changes: 1 addition & 1 deletion src/components/SponsorTimeEditComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import SubmissionNoticeComponent from "./SubmissionNoticeComponent";
import { RectangleTooltip } from "../render/RectangleTooltip";
import SelectorComponent, { SelectorOption } from "./SelectorComponent";
import { DEFAULT_CATEGORY } from "../utils/categoryUtils";
import { getFormattedTime, getFormattedTimeToSeconds } from "../maze-utils/formating";
import { getFormattedTime, getFormattedTimeToSeconds } from "../../maze-utils/src/formating";

const utils = new Utils();

Expand Down
2 changes: 1 addition & 1 deletion src/components/options/KeybindComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as React from "react";
import { createRoot, Root } from 'react-dom/client';
import Config from "../../config";
import KeybindDialogComponent from "./KeybindDialogComponent";
import { formatKey, Keybind, keybindEquals, keybindToString } from "../../maze-utils/config";
import { formatKey, Keybind, keybindEquals, keybindToString } from "../../../maze-utils/src/config";

export interface KeybindProps {
option: string;
Expand Down
2 changes: 1 addition & 1 deletion src/components/options/KeybindDialogComponent.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from "react";
import { ChangeEvent } from "react";
import Config from "../../config";
import { Keybind, formatKey, keybindEquals } from "../../maze-utils/config";
import { Keybind, formatKey, keybindEquals } from "../../../maze-utils/src/config";

export interface KeybindDialogProps {
option: string;
Expand Down
4 changes: 2 additions & 2 deletions src/config.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import * as CompileConfig from "../config.json";
import * as invidiousList from "../ci/invidiouslist.json";
import { Category, CategorySelection, CategorySkipOption, NoticeVisbilityMode, PreviewBarOption, SponsorTime, VideoID, SponsorHideType } from "./types";
import { Keybind, ProtoConfig, keybindEquals } from "./maze-utils/config";
import { HashedValue } from "./maze-utils/hash";
import { Keybind, ProtoConfig, keybindEquals } from "../maze-utils/src/config";
import { HashedValue } from "../maze-utils/src/hash";

export interface Permission {
canSubmit: boolean;
Expand Down
18 changes: 9 additions & 9 deletions src/content.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,21 @@ import { logDebug } from "./utils/logger";
import { importTimes } from "./utils/exporter";
import { ChapterVote } from "./render/ChapterVote";
import { openWarningDialog } from "./utils/warnings";
import { isFirefoxOrSafari, waitFor } from "./maze-utils";
import { getErrorMessage, getFormattedTime } from "./maze-utils/formating";
import { getChannelIDInfo, getVideo, getIsAdPlaying, getIsLivePremiere, setIsAdPlaying, checkVideoIDChange, getVideoID, getYouTubeVideoID, setupVideoModule, checkIfNewVideoID, isOnInvidious, isOnMobileYouTube } from "./maze-utils/video";
import { Keybind, StorageChangesObject, isSafari, keybindEquals } from "./maze-utils/config";
import { findValidElement, waitForElement } from "./maze-utils/dom"
import { getHash, HashedValue } from "./maze-utils/hash";
import { generateUserID } from "./maze-utils/setup";
import { updateAll } from "./maze-utils/thumbnailManagement";
import { isFirefoxOrSafari, waitFor } from "../maze-utils/src";
import { getErrorMessage, getFormattedTime } from "../maze-utils/src/formating";
import { getChannelIDInfo, getVideo, getIsAdPlaying, getIsLivePremiere, setIsAdPlaying, checkVideoIDChange, getVideoID, getYouTubeVideoID, setupVideoModule, checkIfNewVideoID, isOnInvidious, isOnMobileYouTube } from "../maze-utils/src/video";
import { Keybind, StorageChangesObject, isSafari, keybindEquals } from "../maze-utils/src/config";
import { findValidElement, waitForElement } from "../maze-utils/src/dom"
import { getHash, HashedValue } from "../maze-utils/src/hash";
import { generateUserID } from "../maze-utils/src/setup";
import { updateAll } from "../maze-utils/src/thumbnailManagement";
import { setupThumbnailListener } from "./utils/thumbnails";
import * as documentScript from "../dist/js/document.js";
import { Tooltip } from "./render/Tooltip";
import { isDeArrowInstalled } from "./utils/crossExtension";
import { runCompatibilityChecks } from "./utils/compatibility";
import { cleanPage } from "./utils/pageCleaner";
import { addCleanupListener } from "./maze-utils/cleanup";
import { addCleanupListener } from "../maze-utils/src/cleanup";

cleanPage();

Expand Down
2 changes: 1 addition & 1 deletion src/document.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import { init } from "./maze-utils/injected/document";
import { init } from "../maze-utils/src/injected/document";

init();
4 changes: 2 additions & 2 deletions src/help.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { localizeHtmlPage } from "./maze-utils/setup";
import { localizeHtmlPage } from "../maze-utils/src/setup";
import Config from "./config";
import { showDonationLink } from "./utils/configUtils";

import { waitFor } from "./maze-utils";
import { waitFor } from "../maze-utils/src";

if (document.readyState === "complete") {
init();
Expand Down
6 changes: 3 additions & 3 deletions src/js-components/previewBar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import { ActionType, Category, SegmentContainer, SponsorHideType, SponsorSourceT
import { partition } from "../utils/arrayUtils";
import { DEFAULT_CATEGORY, shortCategoryName } from "../utils/categoryUtils";
import { normalizeChapterName } from "../utils/exporter";
import { getFormattedTimeToSeconds } from "../maze-utils/formating";
import { findValidElement } from "../maze-utils/dom";
import { addCleanupListener } from "../maze-utils/cleanup";
import { getFormattedTimeToSeconds } from "../../maze-utils/src/formating";
import { findValidElement } from "../../maze-utils/src/dom";
import { addCleanupListener } from "../../maze-utils/src/cleanup";

const TOOLTIP_VISIBLE_CLASS = 'sponsorCategoryTooltipVisible';
const MIN_CHAPTER_SIZE = 0.003;
Expand Down
2 changes: 1 addition & 1 deletion src/js-components/skipButtonControlBar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Config from "../config";
import { SponsorTime } from "../types";
import { getSkippingText } from "../utils/categoryUtils";
import { AnimationUtils } from "../utils/animationUtils";
import { keybindToString } from "../maze-utils/config";
import { keybindToString } from "../../maze-utils/src/config";

export interface SkipButtonControlBarProps {
skip: (segment: SponsorTime) => void;
Expand Down
1 change: 0 additions & 1 deletion src/maze-utils

This file was deleted.

8 changes: 4 additions & 4 deletions src/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ import CategoryChooser from "./render/CategoryChooser";
import UnsubmittedVideos from "./render/UnsubmittedVideos";
import KeybindComponent from "./components/options/KeybindComponent";
import { showDonationLink } from "./utils/configUtils";
import { localizeHtmlPage } from "./maze-utils/setup";
import { StorageChangesObject } from "./maze-utils/config";
import { getHash } from "./maze-utils/hash";
import { isFirefoxOrSafari } from "./maze-utils";
import { localizeHtmlPage } from "../maze-utils/src/setup";
import { StorageChangesObject } from "../maze-utils/src/config";
import { getHash } from "../maze-utils/src/hash";
import { isFirefoxOrSafari } from "../maze-utils/src";
import { isDeArrowInstalled } from "./utils/crossExtension";
const utils = new Utils();
let embed = false;
Expand Down
2 changes: 1 addition & 1 deletion src/permissions.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Config from "./config";
import Utils from "./utils";
import { localizeHtmlPage } from "./maze-utils/setup";
import { localizeHtmlPage } from "../maze-utils/src/setup";
const utils = new Utils();

// This is needed, if Config is not imported before Utils, things break.
Expand Down
8 changes: 4 additions & 4 deletions src/popup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ import {
import { showDonationLink } from "./utils/configUtils";
import { AnimationUtils } from "./utils/animationUtils";
import { shortCategoryName } from "./utils/categoryUtils";
import { localizeHtmlPage } from "./maze-utils/setup";
import { localizeHtmlPage } from "../maze-utils/src/setup";
import { exportTimes } from "./utils/exporter";
import GenericNotice from "./render/GenericNotice";
import { getErrorMessage, getFormattedTime } from "./maze-utils/formating";
import { StorageChangesObject } from "./maze-utils/config";
import { getHash } from "./maze-utils/hash";
import { getErrorMessage, getFormattedTime } from "../maze-utils/src/formating";
import { StorageChangesObject } from "../maze-utils/src/config";
import { getHash } from "../maze-utils/src/hash";

const utils = new Utils();

Expand Down
6 changes: 3 additions & 3 deletions src/render/CategoryPill.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import Config from "../config";
import { VoteResponse } from "../messageTypes";
import { Category, SegmentUUID, SponsorTime } from "../types";
import { Tooltip } from "./Tooltip";
import { waitFor } from "../maze-utils";
import { getYouTubeTitleNode } from "../maze-utils/elements";
import { addCleanupListener } from "../maze-utils/cleanup";
import { waitFor } from "../../maze-utils/src";
import { getYouTubeTitleNode } from "../../maze-utils/src/elements";
import { addCleanupListener } from "../../maze-utils/src/cleanup";

const id = "categoryPill";

Expand Down
10 changes: 5 additions & 5 deletions src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import Config, { VideoDownvotes } from "./config";
import { CategorySelection, SponsorTime, BackgroundScriptContainer, Registration, VideoID, SponsorHideType, CategorySkipOption } from "./types";

import { getHash, HashedValue } from "./maze-utils/hash";
import { getHash, HashedValue } from "../maze-utils/src/hash";
import * as CompileConfig from "../config.json";
import { isFirefoxOrSafari, waitFor } from "./maze-utils";
import { findValidElementFromSelector } from "./maze-utils/dom";
import { FetchResponse, sendRequestToCustomServer } from "./maze-utils/background-request-proxy"
import { isSafari } from "./maze-utils/config";
import { isFirefoxOrSafari, waitFor } from "../maze-utils/src";
import { findValidElementFromSelector } from "../maze-utils/src/dom";
import { FetchResponse, sendRequestToCustomServer } from "../maze-utils/src/background-request-proxy"
import { isSafari } from "../maze-utils/src/config";

export default class Utils {

Expand Down
4 changes: 2 additions & 2 deletions src/utils/crossExtension.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import * as CompileConfig from "../../config.json";

import Config from "../config";
import { isSafari } from "../maze-utils/config";
import { isFirefoxOrSafari } from "../maze-utils";
import { isSafari } from "../../maze-utils/src/config";
import { isFirefoxOrSafari } from "../../maze-utils/src";

export function isDeArrowInstalled(): Promise<boolean> {
if (Config.config.deArrowInstalled) {
Expand Down
4 changes: 2 additions & 2 deletions src/utils/exporter.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { ActionType, Category, SegmentUUID, SponsorSourceType, SponsorTime } from "../types";
import { shortCategoryName } from "./categoryUtils";
import * as CompileConfig from "../../config.json";
import { getFormattedTime, getFormattedTimeToSeconds } from "../maze-utils/formating";
import { generateUserID } from "../maze-utils/setup";
import { getFormattedTime, getFormattedTimeToSeconds } from "../../maze-utils/src/formating";
import { generateUserID } from "../../maze-utils/src/setup";

const inTest = typeof chrome === "undefined";

Expand Down
2 changes: 1 addition & 1 deletion src/utils/pageUtils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ActionType, Category, SponsorSourceType, SponsorTime, VideoID } from "../types";
import { getFormattedTimeToSeconds } from "../maze-utils/formating";
import { getFormattedTimeToSeconds } from "../../maze-utils/src/formating";

export function getControls(): HTMLElement {
const controlsSelectors = [
Expand Down
4 changes: 2 additions & 2 deletions src/utils/thumbnails.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { isOnInvidious, parseYouTubeVideoIDFromURL } from "../maze-utils/video";
import { isOnInvidious, parseYouTubeVideoIDFromURL } from "../../maze-utils/src/video";
import Config from "../config";
import { getVideoLabel } from "./videoLabels";
import { setThumbnailListener } from "../maze-utils/thumbnailManagement";
import { setThumbnailListener } from "../../maze-utils/src/thumbnailManagement";

export async function labelThumbnails(thumbnails: HTMLImageElement[]): Promise<void> {
await Promise.all(thumbnails.map((t) => labelThumbnail(t)));
Expand Down
2 changes: 1 addition & 1 deletion src/utils/videoLabels.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Category, CategorySkipOption, VideoID } from "../types";
import { getHash } from "../maze-utils/hash";
import { getHash } from "../../maze-utils/src/hash";
import Utils from "../utils";
import { logWarn } from "./logger";

Expand Down
4 changes: 2 additions & 2 deletions src/utils/warnings.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { objectToURI } from "../maze-utils";
import { getHash } from "../maze-utils/hash";
import { objectToURI } from "../../maze-utils/src";
import { getHash } from "../../maze-utils/src/hash";
import Config from "../config";
import GenericNotice, { NoticeOptions } from "../render/GenericNotice";
import { ContentContainer } from "../types";
Expand Down

0 comments on commit 16005e4

Please sign in to comment.