I did things just a wee bit differently. In essence, I (1) add a query param to the Press This URL to indicate the intended post type, and (2) return the appropriate markup. Then, on the receiving end, a _very simple_ regex determines the post type (which _doesn’t_ get sent along as you hit Publish or Save Draft) from the markup. No need to even modify the JS or run complex regexes.
The social network of the future: No ads, no corporate surveillance, ethical design, and decentralization! Own your data with Mastodon!