ayoung19 / clipboard-history

A Chrome extension for managing your clipboard history securely, efficiently, and effortlessly.
https://chromewebstore.google.com/detail/clipboard-history-pro-sec/ombhfdknibjljckajldielimdjcomcek?hl=en
Apache License 2.0
23 stars 5 forks source link

core: auto-delete by TTL setting #17

Open ayoung19 opened 2 months ago

ayoung19 commented 2 months ago

Auto-delete old entries by giving entries an expiration or after the list hits a certain number of entries.

Ribas160 commented 2 months ago

The easiest way is to remove entries by list length. But it is possible to do both and allow the user to switch between them and change the settings (max list length, number of minutes/hours/days). It depends on your goal and the complexity you want to add to the application.

ayoung19 commented 2 months ago

Users are requesting the option to auto-delete both ways. Here is the inspiration (first two options):

image

Did you want to take this on?

Ribas160 commented 2 months ago

Yes, I would like to work on it.

ayoung19 commented 2 months ago

Ok I'm currently working on the popup side of this (UI that lets the user configure the settings). You can work on ingesting this setting and perform the behavior on entry creation. Does that sound good to you? Let's also start with just the max number of entries auto-delete setting:

import { z } from "zod";

// DO NOT REUSE DEPRECATED FIELDS.
export const defaultSettings = {
  totalItemsBadge: true,
  // theme: "light",
  themeV2: "system",
  localItemLimit: undefined,
};

export const Settings = z
  .object({
    totalItemsBadge: z.boolean().default(defaultSettings.totalItemsBadge),
    // theme: z.string().default(defaultSettings.theme),
    themeV2: z.string().default(defaultSettings.themeV2),
    localItemLimit: z.number().optional(),
  })
  .default(defaultSettings);
export type Settings = z.infer<typeof Settings>;

The new settings field will be localItemLimit with a type of number | undefined where undefined means it's off.

ayoung19 commented 2 months ago

Also do you have a rough timeline on when you could do this by?

Ribas160 commented 2 months ago

Ok, it is ok for me. The timeline depends on my free time. I am going to work on it this week.

ayoung19 commented 2 months ago

No worries, I totally understand. Also very sorry but because this is a pretty highly requested feature and I'm going to have a lot less free time soon, I went ahead and finished the first type of auto-delete earlier tonight.

We still need the auto-delete by TTL version but that one's lower on the priority list so I can leave it to you to finish it whenever you have the time. Just give me a heads up when you begin working on it. Also, feel free to ping me for questions anytime.

Do you use Discord? I might make one to make it easier to discuss features.

Ribas160 commented 2 months ago

No problem, I can work on auto-delete by TTL version. I have a Discord account, so, we can contact there.