This commit is contained in:
2025-11-19 22:01:25 +02:00
parent afef35b6f6
commit 3a7686713f
16 changed files with 276 additions and 212 deletions

View File

@@ -11,18 +11,20 @@ setConsoleTitle("Screenshot Uploader");
try {
const start = Date.now();
$`notify-send -t 1000 "Screenshot" "Uploading.."`.nothrow().catch(a => { });
$`notify-send -t 1000 "Screenshot" "Uploading.."`
.nothrow()
.catch((a) => {});
configDotenv({
path: `${homedir()}/.ocbwoy3-dotfiles-SECRET-DO-NOT-TOUCH.env`
path: `${homedir()}/.ocbwoy3-dotfiles-SECRET-DO-NOT-TOUCH.env`,
});
const screenshotsDir = join(homedir(), "Pictures", "Screenshots");
const files = readdirSync(screenshotsDir);
let latestFile = files
.map(file => ({
.map((file) => ({
file,
time: statSync(join(screenshotsDir, file)).mtime.getTime()
time: statSync(join(screenshotsDir, file)).mtime.getTime(),
}))
.sort((a, b) => b.time - a.time)[0].file;
@@ -31,8 +33,9 @@ try {
const url = await UploadToEZ(readFileSync(filePath));
execSync(`echo "${url}" | wl-copy -n`);
execSync(`notify-send "Ekrānuzņēmums" "Attēls augšuplādēts e-z.host ${Date.now() - start}ms"`);
execSync(
`notify-send "Ekrānuzņēmums" "Attēls augšuplādēts e-z.host ${Date.now() - start}ms"`,
);
} catch (e_) {
execSync(`notify-send "Error" "${`${e_}`}"`);
}