SelfControlApp / selfcontrol

:skull: Mac app to block your own access to distracting websites etc for a predetermined period of time. It can not be undone by the app or by a restart – you must wait for the timer to run out.
http://selfcontrolapp.com
GNU General Public License v3.0
3.99k stars 400 forks source link

Selfcontrol-cli can't read blocklist from default directory #853

Open coolandsmartrr opened 8 months ago

coolandsmartrr commented 8 months ago

Summary

Selfcontrol-cli does not seem to be able to read the blocklist in the default directory. This command results in an error:

➜  ~ /Applications/SelfControl.app/Contents/MacOS/selfcontrol-cli start --blocklist  ~/Library/Preferences/org.eyebeam.SelfControl.plist --enddate 2023-10-26T07:00:00+09:00

2023-10-25 18:45:32.469 selfcontrol-cli[62929:14233026] ERROR: Could not read a valid block from file file:///Users/ricky/Library/Preferences/org.eyebeam.SelfControl.plist
2023-10-25 18:45:32.469 selfcontrol-cli[62929:14233026] ERROR: Block could not be read from file /Users/ricky/Library/Preferences/org.eyebeam.SelfControl.plist

Background Info

SelfControl version? 4.0.2 macOS version? 13.5 Do you use a VPN/proxy, and if so which one? No Has this ever worked for you on a prior version of SelfControl? If so, when? Any other special system setup we should know about?

How Do We Reproduce This Issue?

Describe detailed steps that reliably make this issue show up. For example, "start a block containing 5 websites, click button X, then button Y"

Run the command as listed above.

What Should Have Happened?

I expected the selfcontrol block to start.

What Actually Happened Instead?

Selfcontrol-cli could not read the blocklist from the default directory.

reynoldsnlp commented 5 months ago

If you save the blocklist in the app is the resulting file identical to the plist file?

Spelkington commented 4 months ago

A bit of research on this: it appears that the file stored at ~/Library/Preferences/org.eyebeam.SelfControl.plist and the .selfcontrol file exported by the program are not the same, which would explain why SelfControl's CLI doesn't read the former as a valid blocklist:

Copy of the blocklist from ~/Library/Preferences/org.eyebeam.SelfControl.plist:

bplist00�   

MNOPQ_0NSWindow Frame NSSpellCheckerSubstitutionsPanel2_'MASPreferences Selected Identifier View_SUHasLaunchedBefore_SULastCheckTime_WhitelistAlertSuppress_GetStartedShownYBlocklist_%NSWindow Frame NSNavPanelAutosaveName_BlockAsWhitelist_NSNavLastRootDirectory_SULastProfileSubmissionDate_!NSNavPanelExpandedSizeForOpenMode_FirstBlockStarted_692 407 425 137 0 0 1728 1079 _GeneralPreferences 3A��V��       �8 !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLYgmail.com[nytimes.com[bluesky.app[twitter.com\linkedin.com_forever.utah.eduXbsky.app]inoreader.com^abcnews.go.com[ground.newsWcnn.com_huffingtonpost.com[foxnews.comWbbc.comYbbc.co.uk_telegraph.co.uk_news.google.com\buzzfeed.comXvice.comZgawker.comZtumblr.comZforbes.com]gothamist.com[jezebel.com\usatoday.com\theonion.com^news.yahoo.com_washingtonpost.comWwsj.com_theguardian.com[latimes.com_nydailynews.comYsalon.comYmsnbc.comVrt.com]bloomberg.comWaol.com_drudgereport.com_nationalgeographic.comZnypost.com_chicagotribune.comWmsn.comZusnews.com\facebook.comX9gag.com[netflix.comXhulu.com_dailymotion.com_collegehumor.com^funnyordie.comWvine.co]pinterest.com_stumbleupon.com]instagram.com_mail.google.com_blog.chaoticgood.computer_464 473 800 448 0 0 1728 1079 Q~3A�Ȃ�'Z{800, 448} #V������1Os�������&2?R[ix����������(4AN]rz���������'/:GP\ew��������!*5S6

Exported file containing the same blocklist:

bplist00�_BlockAsWhitelist]HostBlacklist�8  

 !"#$%&'()*+,-./0123456789:;<Ygmail.com[nytimes.com[bluesky.app[twitter.com\linkedin.com_forever.utah.eduXbsky.app]inoreader.com^abcnews.go.com[ground.newsWcnn.com_huffingtonpost.com[foxnews.comWbbc.comYbbc.co.uk_telegraph.co.uk_news.google.com\buzzfeed.comXvice.comZgawker.comZtumblr.comZforbes.com]gothamist.com[jezebel.com\usatoday.com\theonion.com^news.yahoo.com_washingtonpost.comWwsj.com_theguardian.com[latimes.com_nydailynews.comYsalon.comYmsnbc.comVrt.com]bloomberg.comWaol.com_drudgereport.com_nationalgeographic.comZnypost.com_chicagotribune.comWmsn.comZusnews.com\facebook.comX9gag.com[netflix.comXhulu.com_dailymotion.com_collegehumor.com^funnyordie.comWvine.co]pinterest.com_stumbleupon.com]instagram.com_mail.google.com_blog.chaoticgood.computer
 ./jt����������%7IV_ju����������$+9ATmx����������'5G=c

It appears they contain very similar information, but are definitely not the same.

Spelkington commented 4 months ago

After doing a search for files with the same MD5 hash as the exported blocklist, it appears none exist in either ~/Applications or ~/Library/Preferences, which leads me to believe that the blocklist recognized by the SelfControl frontend application and the CLI are using two different formats for blocklists. Pure speculation, but I'd imagine the copy in ~/Library/Preferences is the format recognized by the GUI, and the exported copy is the format recognized by the CLI.

Being able to access the blocklist defined by the user in the GUI would be enormously helpful - I am currently building out a SelfControl Raycast extension for my own (and others) use, and being able to use the GUI-defined blocklist rather than having to re-export changes to a specific file location in the user's home directory would be awesome.