Conditional blocking of M0

The default for Octoprint is to block M0/M1 because they can require user interaction on the printer. I think that this is wise, however it is possible to specify a timeout for these commands, and it would make sense to allow the command through if (and only if) it had a timeout associated with it.

What would be a good change to implement that? Would extending blocked commands to take a regex (or equivalent) be a good idea? It's the most elegant that I can come up with and (frankly) I don't think is elegant enough!

Does anyone have better ideas? Could we execute arbitary jinja scripts (like the pause/resume scripts) server side if a user-specified GCode is detected? Would that even help?

tagging @foosel :slight_smile: