From c79f52e900023e5c63e313c2db21a4a264ae3fd7 Mon Sep 17 00:00:00 2001
From: DecafDev <40307803+decaf-dev@users.noreply.github.com>
Date: Sun, 30 Mar 2025 08:42:12 -0600
Subject: [PATCH] feat: remove premium features (#380)
---
README.md | 7 -
src/event/types.ts | 1 -
src/main.ts | 8 -
src/obsidian/styles.css | 3 -
src/obsidian/vault-explorer-settings-tab.ts | 11 --
src/svelte/app/components/feed-card.svelte | 10 +-
src/svelte/app/components/feed-view.svelte | 2 -
src/svelte/app/components/grid-card.svelte | 22 +--
src/svelte/app/components/grid-view.svelte | 2 -
src/svelte/app/components/list-item.svelte | 28 ++--
src/svelte/app/components/list-view.svelte | 2 -
src/svelte/app/components/table-view.svelte | 10 +-
src/svelte/app/index.svelte | 26 +---
src/svelte/app/services/context-menu.ts | 9 +-
.../components/content-filter.svelte | 20 ---
.../components/filter-rule.svelte | 15 +-
src/svelte/license-key-app/index.svelte | 129 ----------------
.../shared/components/premium-link.svelte | 3 -
.../shared/components/premium-message.svelte | 9 --
src/svelte/shared/services/license.ts | 142 ------------------
20 files changed, 23 insertions(+), 436 deletions(-)
delete mode 100644 src/obsidian/styles.css
delete mode 100644 src/svelte/license-key-app/index.svelte
delete mode 100644 src/svelte/shared/components/premium-link.svelte
delete mode 100644 src/svelte/shared/components/premium-message.svelte
delete mode 100644 src/svelte/shared/services/license.ts
diff --git a/README.md b/README.md
index 9f5bf59..6c35010 100644
--- a/README.md
+++ b/README.md
@@ -21,7 +21,6 @@ Vault Explorer is a work in progress. Please check the GitHub repository and doc
- [Screenshots](#screenshots)
- [Installation](#installation)
- [Usage](#usage)
-- [Premium](#premium)
- [Features](#features)
- [Network use](#network-use)
- [Contributing](#contributing)
@@ -79,12 +78,6 @@ Vault Explorer is a work in progress. Please check the GitHub repository and doc
Click the compass button on the left-hand sidebar to open the vault explorer view.
-## Premium
-
-Premium features are available to users who purchase a [Vault Explorer license](https://vaultexplorer.com/docs/premium/).
-
-Please do not share your license key with anyone. Shared license keys will be deactivated.
-
## Features
| Name | Categories | Documented |
diff --git a/src/event/types.ts b/src/event/types.ts
index 5d92567..737858b 100644
--- a/src/event/types.ts
+++ b/src/event/types.ts
@@ -14,7 +14,6 @@ export enum PluginEvent {
FEED_CONTENT_SETTING_CHANGE = "feed-content-setting-change",
COVER_IMAGE_SOURCE_SETTING_CHANGE = "cover-image-source-setting-change",
PROPERTY_SETTING_CHANGE = "property-setting-change",
- LICENSE_KEY_VALIDATION_CHANGE = "license-key-validation-change",
CLOCK_UPDATES_SETTING_CHANGE = "clock-updates-setting-change",
FILTER_TOGGLE_SETTING_CHANGE = "filter-toggle-setting-change",
SCROLL_BUTTONS_SETTING_CHANGE = "scroll-buttons-setting-change",
diff --git a/src/main.ts b/src/main.ts
index 9443970..d880aba 100644
--- a/src/main.ts
+++ b/src/main.ts
@@ -16,7 +16,6 @@ import { formatMessageForLogger, stringToLogLevel } from "./logger";
import { preformMigrations } from "./migrations";
import "./styles.css";
import { clearSMICache } from "./svelte/app/services/smi-cache";
-import License from "./svelte/shared/services/license";
import store from "./svelte/shared/services/store";
import type { VaultExplorerPluginSettings } from "./types";
import { isVersionLessThan } from "./utils";
@@ -31,8 +30,6 @@ export default class VaultExplorerPlugin extends Plugin {
store.plugin.set(this);
- await License.getInstance().loadStoredKey();
-
this.registerView(
VAULT_EXPLORER_VIEW,
(leaf) => new VaultExplorerView(leaf, this)
@@ -202,11 +199,6 @@ export default class VaultExplorerPlugin extends Plugin {
//Clean up the old device id from the versioning system
const LOCAL_STORAGE_ID = "vault-explorer-id";
localStorage.removeItem(LOCAL_STORAGE_ID);
-
- //Clean up the old device id from the versioning system
- const LOCAL_STORAGE_LICENSE_KEY =
- "vault-explorer-license-key";
- localStorage.removeItem(LOCAL_STORAGE_LICENSE_KEY);
}
if (isVersionLessThan(loadedVersion, "1.37.1")) {
console.log("Clearing image cache");
diff --git a/src/obsidian/styles.css b/src/obsidian/styles.css
deleted file mode 100644
index 95b4876..0000000
--- a/src/obsidian/styles.css
+++ /dev/null
@@ -1,3 +0,0 @@
-.vault-explorer-premium-setting {
- color: var(--text-accent);
-}
diff --git a/src/obsidian/vault-explorer-settings-tab.ts b/src/obsidian/vault-explorer-settings-tab.ts
index fcadee1..35e2846 100644
--- a/src/obsidian/vault-explorer-settings-tab.ts
+++ b/src/obsidian/vault-explorer-settings-tab.ts
@@ -24,21 +24,17 @@ import EventManager from "src/event/event-manager";
import { PluginEvent } from "src/event/types";
import { TExplorerView } from "src/types";
import ImageSourceApp from "../svelte/image-source-app/index.svelte";
-import LicenseKeyApp from "../svelte/license-key-app/index.svelte";
import { clearSMICache } from "src/svelte/app/services/smi-cache";
-import "./styles.css";
export default class VaultExplorerSettingsTab extends PluginSettingTab {
plugin: VaultExplorerPlugin;
- licenseKeyApp: LicenseKeyApp | null;
imageSourceApp: ImageSourceApp | null;
constructor(app: App, plugin: VaultExplorerPlugin) {
super(app, plugin);
this.plugin = plugin;
- this.licenseKeyApp = null;
this.imageSourceApp = null;
}
@@ -629,12 +625,6 @@ export default class VaultExplorerSettingsTab extends PluginSettingTab {
})
);
- new Setting(containerEl).setName("Premium").setHeading();
-
- this.licenseKeyApp = new LicenseKeyApp({
- target: containerEl,
- });
-
new Setting(containerEl).setName("Debugging").setHeading();
new Setting(containerEl)
.setName("Log level")
@@ -693,7 +683,6 @@ export default class VaultExplorerSettingsTab extends PluginSettingTab {
}
onClose() {
- this.licenseKeyApp?.$destroy();
this.imageSourceApp?.$destroy();
}
diff --git a/src/svelte/app/components/feed-card.svelte b/src/svelte/app/components/feed-card.svelte
index 6f8a0e9..18f9303 100644
--- a/src/svelte/app/components/feed-card.svelte
+++ b/src/svelte/app/components/feed-card.svelte
@@ -35,7 +35,6 @@
export let path: string;
export let createdMillis: number;
export let content: string | null;
- export let enablePremiumFeatures: boolean;
let ref: HTMLElement | null = null;
let enableFileIcons = false;
@@ -147,14 +146,7 @@
function handleCardContextMenu(e: Event) {
const nativeEvent = e as MouseEvent;
const { app, settings } = plugin;
- openContextMenu(
- nativeEvent,
- path,
- app,
- settings,
- enablePremiumFeatures,
- {},
- );
+ openContextMenu(nativeEvent, path, app, settings, {});
}
function handleCardMouseOver(e: MouseEvent) {
diff --git a/src/svelte/app/components/feed-view.svelte b/src/svelte/app/components/feed-view.svelte
index 586af68..b610739 100644
--- a/src/svelte/app/components/feed-view.svelte
+++ b/src/svelte/app/components/feed-view.svelte
@@ -5,7 +5,6 @@
export let data: FileRenderData[] = [];
export let startIndex;
export let pageLength;
- export let enablePremiumFeatures: boolean;
let filteredItems: FileRenderData[] = [];
@@ -24,7 +23,6 @@
{#each filteredItems as fileRenderData (fileRenderData.id)}
{#each filteredItems as fileRenderData (fileRenderData.id)}
- import VaultExplorerPlugin from "src/main";
- import store from "../../shared/services/store";
- import Tag from "src/svelte/shared/components/tag.svelte";
- import Wrap from "src/svelte/shared/components/wrap.svelte";
- import Icon from "src/svelte/shared/components/icon.svelte";
- import Stack from "src/svelte/shared/components/stack.svelte";
- import { getIconIdForFile } from "../services/file-icon";
- import { onMount } from "svelte";
+ import { HOVER_LINK_SOURCE_ID } from "src/constants";
import EventManager from "src/event/event-manager";
import { PluginEvent } from "src/event/types";
+ import VaultExplorerPlugin from "src/main";
+ import Icon from "src/svelte/shared/components/icon.svelte";
+ import Stack from "src/svelte/shared/components/stack.svelte";
+ import Tag from "src/svelte/shared/components/tag.svelte";
+ import Wrap from "src/svelte/shared/components/wrap.svelte";
+ import { onMount } from "svelte";
+ import store from "../../shared/services/store";
import { openContextMenu } from "../services/context-menu";
+ import { getIconIdForFile } from "../services/file-icon";
import { openInCurrentTab } from "../services/open-file";
- import { HOVER_LINK_SOURCE_ID } from "src/constants";
export let displayName: string;
export let baseName: string;
@@ -21,7 +21,6 @@
let showTags: boolean;
export let isSmallScreenSize: boolean;
- export let enablePremiumFeatures: boolean;
let enableFileIcons: boolean = false;
let ref: HTMLElement | null = null;
@@ -78,14 +77,7 @@
function handleItemContextMenu(e: Event) {
const nativeEvent = e as MouseEvent;
const { app, settings } = plugin;
- openContextMenu(
- nativeEvent,
- path,
- app,
- settings,
- enablePremiumFeatures,
- {},
- );
+ openContextMenu(nativeEvent, path, app, settings, {});
}
function handleItemMouseOver(e: MouseEvent) {
diff --git a/src/svelte/app/components/list-view.svelte b/src/svelte/app/components/list-view.svelte
index a778e27..a1b21a9 100644
--- a/src/svelte/app/components/list-view.svelte
+++ b/src/svelte/app/components/list-view.svelte
@@ -7,7 +7,6 @@
export let startIndex: number;
export let pageLength: number;
export let isSmallScreenSize: boolean;
- export let enablePremiumFeatures: boolean;
let filteredItems: FileRenderData[] = [];
@@ -26,7 +25,6 @@
{#each filteredItems as fileRenderData (fileRenderData.id)}
{
- enablePremiumFeatures = hasValidKey;
- });
-
randomFileSortStore.subscribe((value) => {
randomSortCache = value;
});
@@ -1046,7 +1038,6 @@
data={renderData}
{startIndex}
{pageLength}
- {enablePremiumFeatures}
on:coverImageFitChange={handleCoverImageFitChange}
/>
{:else if currentView === "list"}
@@ -1055,22 +1046,11 @@
{isSmallScreenSize}
{startIndex}
{pageLength}
- {enablePremiumFeatures}
/>
{:else if currentView === "table"}
-
+
{:else if currentView === "feed"}
-
+
{/if}
{
item.setTitle("Delete");
item.onClick(async () => {
- if (!enablePremiumFeatures) {
- new Notice(
- "This feature requires a premium Vault Explorer license."
- );
- return;
- }
if (confirmBeforeDelete) {
if (confirm("Are you sure you want to delete this file?")) {
await deleteFile(app, filePath);
diff --git a/src/svelte/custom-filter-app/components/content-filter.svelte b/src/svelte/custom-filter-app/components/content-filter.svelte
index e8c36d0..33a27c8 100644
--- a/src/svelte/custom-filter-app/components/content-filter.svelte
+++ b/src/svelte/custom-filter-app/components/content-filter.svelte
@@ -15,20 +15,9 @@
export let condition: FilterCondition;
export let isEnabled: boolean;
- import PremiumLink from "src/svelte/shared/components/premium-link.svelte";
- import PremiumMessage from "src/svelte/shared/components/premium-message.svelte";
- import License from "src/svelte/shared/services/license";
import { createEventDispatcher } from "svelte";
const dispatch = createEventDispatcher();
- let hasValidLicenseKey = false;
-
- License.getInstance()
- .getHasValidKeyStore()
- .subscribe((hasValidKey) => {
- hasValidLicenseKey = hasValidKey;
- });
-
function handleValueChange(e: Event) {
const value = (e.target as HTMLInputElement).value;
dispatch("ruleValueChange", { id, value });
@@ -54,21 +43,12 @@
{#if condition !== ContentFilterCondition.IS_EMPTY && condition !== ContentFilterCondition.IS_NOT_EMPTY}
{/if}
-
- {#if type === FilterRuleType.CONTENT && !hasValidLicenseKey}
-
- {/if}
-
diff --git a/src/svelte/shared/components/premium-link.svelte b/src/svelte/shared/components/premium-link.svelte
deleted file mode 100644
index 4eb6f55..0000000
--- a/src/svelte/shared/components/premium-link.svelte
+++ /dev/null
@@ -1,3 +0,0 @@
-Learn more
diff --git a/src/svelte/shared/components/premium-message.svelte b/src/svelte/shared/components/premium-message.svelte
deleted file mode 100644
index b62a802..0000000
--- a/src/svelte/shared/components/premium-message.svelte
+++ /dev/null
@@ -1,9 +0,0 @@
-
- This feature requires a premium license
-
-
-
diff --git a/src/svelte/shared/services/license.ts b/src/svelte/shared/services/license.ts
deleted file mode 100644
index cf3156c..0000000
--- a/src/svelte/shared/services/license.ts
+++ /dev/null
@@ -1,142 +0,0 @@
-import Logger from "js-logger";
-import { writable } from "svelte/store";
-import crypto from "crypto";
-
-const LOCAL_STORAGE_LICENSE_KEY = "vault-explorer-license";
-
-const PUBLIC_KEY_PEM = `
------BEGIN PUBLIC KEY-----
-MCowBQYDK2VwAyEAO539qAsgBzbukUNDuOtPZKXNj8MSXvt3zS1ci4plDBA=
------END PUBLIC KEY-----
-`;
-
-export default class License {
- private licenseKey: string;
- private hasValidKey: boolean;
- private hasValidKeyStore = writable();
-
- private static instance: License;
-
- constructor() {
- this.licenseKey = "";
- this.hasValidKey = false;
- this.hasValidKeyStore.set(false);
- }
-
- async loadStoredKey() {
- const storedKey = this.getStoredLicenseKey();
- if (storedKey) {
- const isValid = await this.validateKey(storedKey);
-
- this.licenseKey = storedKey;
- this.hasValidKey = isValid;
- this.hasValidKeyStore.set(isValid);
- }
- }
-
- async addKey(licenseKey: string) {
- Logger.trace({
- fileName: "license.ts",
- functionName: "addKey",
- message: "called",
- });
-
- const result = await this.validateKey(licenseKey);
- if (result) {
- this.setStoredKey(licenseKey);
- this.hasValidKeyStore.set(true);
- this.hasValidKey = true;
- }
- return result;
- }
-
- /**
- * Verify the licenseKey using the public key.
- * @param signature- The licenseKey to verify. This is created by signing a file with the private key.
- */
- async validateKey(licenseKey: string) {
- Logger.trace({
- fileName: "license.ts",
- functionName: "validateKey",
- message: "called",
- });
-
- try {
- // Decode Base64 to buffer
- const decodedBuffer = Buffer.from(licenseKey, "base64");
- const decodedString = decodedBuffer.toString("utf-8");
- const split = decodedString.split("|");
-
- const signatureBase64 = split[0];
- const data = split[1].trim();
-
- const signatureBuffer = Buffer.from(signatureBase64, "base64");
- const dataBuffer = Buffer.from(data);
-
- const verify = crypto.createVerify("SHA256");
- verify.update(data);
- verify.end();
-
- return crypto.verify(
- null,
- dataBuffer,
- {
- key: PUBLIC_KEY_PEM,
- format: "pem",
- type: "spki",
- },
- signatureBuffer
- );
- } catch (err) {
- return false;
- }
- }
-
- removeKey() {
- Logger.trace({
- fileName: "license.ts",
- functionName: "removeKey",
- message: "called",
- });
-
- this.setStoredKey(null);
- this.hasValidKeyStore.set(false);
- this.hasValidKey = false;
- }
-
- private setStoredKey(value: string | null) {
- Logger.trace({
- fileName: "license.ts",
- functionName: "setStoredKey",
- message: "called",
- });
- if (value !== null) {
- localStorage.setItem(LOCAL_STORAGE_LICENSE_KEY, value);
- } else {
- localStorage.removeItem(LOCAL_STORAGE_LICENSE_KEY);
- }
- }
-
- private getStoredLicenseKey() {
- return localStorage.getItem(LOCAL_STORAGE_LICENSE_KEY);
- }
-
- getHasValidKey() {
- return this.hasValidKey;
- }
-
- getHasValidKeyStore() {
- return this.hasValidKeyStore;
- }
-
- getLicenseKey() {
- return this.licenseKey;
- }
-
- static getInstance() {
- if (!this.instance) {
- this.instance = new License();
- }
- return this.instance;
- }
-}