Upload a screen capture to Discord on a regular interval
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
Lamp a36bf7bc83 %HOMEPATH% works in workdir 2 years ago
.gitignore Windows support 3 years ago
GetNetworkCostType.ps1 Handle no network better 2 years ago
README.md Better windows setup 2 years ago
Visual Time Machine.xml %HOMEPATH% works in workdir 2 years ago
io.github.ledlamp.vtm.plist Rename index.js vtm.js 3 years ago
package-lock.json move files 3 years ago
package.json Windows support 3 years ago
screenCapture.exe Windows support 3 years ago
start-in-background.vbs Better windows setup 2 years ago
visual-time-machine.desktop Rename index.js vtm.js 3 years ago
vtm.js fix dupes flooding tmp 2 years ago

README.md

Ever wanted to go back in time and see what was on your screen at some point in the past? Well, you could if you had been running Visual Time Machine at that time. If you start using VTM now then you can do that in the future.

Visual Time Machine is a simple Node script that runs as a daemon to capture your screen at a regular interval (5 seconds is default). It exploits Discord as an unlimited image store for the screenshots. You can scroll up your Discord channel or use the search feature to see what was on your screen at any point in the past with ~5 second precision, after you started using VTM.

Install

  1. Install Node.js version >=10 if you haven't already.
    • If on Linux, ImageMagick (specifically, the import command) is required: sudo apt install imagemagick
    • .NET framework must be installed for screen capturing on Windows.
  2. Download the repository as zip and extract it.
  3. Open a Terminal/Command Prompt in the folder and run npm install to download dependencies.
  4. Create a file named config.json and paste these contents.
{
	"webhook": {
		"id": "paste_id_here",
		"token": "paste_token_here"
	},
	"interval": 5000,
	"capture_console_only": true,
	"disable_on_inactive_session": false,
	"disable_on_metered_networks": false
}
  1. Create a webhook in the Discord channel you want the images to upload to (presumably a private channel of a private server). Copy the url and take the id and token out of it--the id is the big integer and the token is the long base64 string at the end, separated by slash--and paste in config.

The interval is time in milliseconds between captures. Setting it to 0 will make it capture as fast as possible. Because it's the delay after the previous capture finishes, not a continuous interval starting each capture, it won't cause a stack overflow. It also means it will actually capture at a slightly slower interval than is configured, because the capturing and uploading takes a bit of time. Note that too low values will cause irregular capturing due to rate limiting. 3 seconds (3000 ms) is about the fastest you can consistently send a webhook message on Discord.

(Mac only) If capture_console_only is set to true, the screen will only be captured if it is on the physical display. This prevents the user's screen from being captured when it's not being used, though that means it won't be captured if it is used remotely.

If you have a Pro or Enterprise edition of Windows, you can change disable_on_inactive_session to true to prevent VTM from capturing black screens when you've locked your session.

If you're on Windows 10 and Powershell scripts are enabled, you can toggle disable_on_metered_networks to disable capturing when you are connected to a metered network. This might be a bit resource intensive so it's recommended to leave this false if you never connect to metered networks.

  1. Test the program by running node vtm.js in a Terminal.

The following steps depend on your platform & options.

Mac OS

All users

  1. Move the directory somewhere global. I put it at /opt/vtm.
  2. Move io.github.ledlamp.vtm.plist into /Library/LaunchAgents.
  3. If you put it somewhere other than /opt/vtm, update the path to the script in the plist. Edit the path to node if that's different too.
  4. Make sure the files are owned by root: run chown -R root /opt/vtm and chown root /Library/LaunchAgents/io.github.ledlamp.vtm.plist. launchd doesn't like other people owning its plists!
  5. Run launchctl load -w ~/Library/LaunchAgents/io.github.ledlamp.vtm.plist in each active user to start the agent without re-logging in. It will automatically run for each user who logs in and vice-versa. Enable capture_console_only option if you use multiple user accounts and don't want them all uploading screenshots when you're only using one.

Single user

  1. Rename and move the folder wherever you want in your home directory. You could move it to ~/Library/Visual Time Machine.
  2. Edit the file io.github.ledlamp.vtm.plist with the full path to the working directory, for example /Users/you/Library/Visual Time Machine. launchd does NOT support globbing in the WorkingDirectory value so you have to specify the full path. If node is somewhere other than /usr/local/bin/node, update that path as well
  3. Move the io.github.ledlamp.vtm.plist file into your ~/Library/LaunchAgents.
  4. Run launchctl load -w ~/Library/LaunchAgents/io.github.ledlamp.vtm.plist to start the agent. It will automatically start and stop whenever you login and logout.

Windows

  1. Put the directory at %HOMEPATH%\Programs\Visual Time Machine or wherever you want.
  2. Open Task Scheduler and import the Visual Time Machine.xml file. Change the user of the task to your user, and change the working directory of the command if necessary.
  3. Run the task.

Linux (Ubuntu)

All users

  1. Put the directory at /opt/vtm or somewhere global. If putting it somewhere else, make sure to update the path in the desktop file.
  2. Move visual-time-machine.desktop into /etc/xdg/autostart or wherever the global autostart applications are.
  3. The daemon should start with each user who logs in to their X session. You can start it without re-logging with node vtm.js & disown in the program directory.

Note: The screenshotter will continue to capture black screens when the user session is locked or switched out. Also, apparently the program does not exit when logging out, but it will stop capturing as there's no X session. When logging back in, another process will start and both will be capturing at the same time.

Single user

You could use the same kind of method used for global installation (XDG autostart) by putting the desktop file in your ~.config/autostart, but an alternative method that is probably better due to the lack of the issues noted above is to simply start the process at boot using systemd, crontab, or pm2. The process will just be always there but only function when you are logged in to your X session.

Crontab is the simplest method:

  1. Put the directory somewhere in your user account, maybe at ~/.vtm.
  2. Type crontab -e in a terminal and add the line @reboot /usr/bin/node $HOME/.vtm/vtm.js (adjust paths as necessary)
  3. Start the program without a reboot with node ~/.vtm/vtm.js & disown.