SE-AutoReviewComments icon indicating copy to clipboard operation
SE-AutoReviewComments copied to clipboard

Importing remote, or any JSON

Open reitzig opened this issue 7 years ago • 46 comments

I used to be able to use

https://gist.githubusercontent.com/reitzig/7ca05408f53292505294/raw/def-comments-csSE.json

as remote URL and get the JSON from there (Firefox). Now the user script forgot my custom comments so I wanted to re-load them, but it does not work any longer, even with all script blockers deactivated. Maybe related to #39? Used to work after 2014, though.

I also can't seem to be able to import the JSON by copy-pasting it (clicking "jsonp" in the import/export tool will only give me the current set as export, but there's no "save"); do I really have to reformat it all into the (new?) Markdown format for manual import?

How can I get the remote source to work again?

Workaround: Convert to the Markdown format and import manually.

reitzig avatar Apr 14 '17 08:04 reitzig

I've been having this problem for a couple months too, in both Chrome and Firefox. My custom comments went away, I said "huh that's odd" and tried reimporting, and the import spins forever without completing.

cellio avatar May 14 '17 03:05 cellio

I hope I'm not stepping on the feet of other contributors, but I think, unless you're opening the PR yourself, there are unlikely going to be any fixes anytime soon. I'd be happy to help anyone getting started with the code base.

oliversalzburg avatar May 15 '17 09:05 oliversalzburg

If there are features the contributers can't support, then take them out? That much should be an easy and quick task.

One import and export method is quite enough (assuming it's well-documented); the rest is convenience. But the one should work reliably, otherwise the script is nearly useless. :/

reitzig avatar May 15 '17 09:05 reitzig

That much should be an easy and quick task.

Feel free to submit a PR.

oliversalzburg avatar May 15 '17 09:05 oliversalzburg

I admit to having some difficulty getting up motivation (and time) to look into this, though now having several people reporting problems maybe I should...

On 15 May 2017 at 11:29, Oliver Salzburg [email protected] wrote:

I hope I'm not stepping on the feet of other contributors, but I think, unless you're opening the PR yourself, there are unlikely going to be any fixes anytime soon. I'd be happy to help anyone getting started with the code base.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Benjol/SE-AutoReviewComments/issues/132#issuecomment-301424099, or mute the thread https://github.com/notifications/unsubscribe-auth/AARPAkfxhIxMU2XBQraQdHDDtR5FZb4aks5r6BsKgaJpZM4M9jVx .

Benjol avatar May 15 '17 10:05 Benjol

In reply to Raphael, it's actually the jsonp format which is 'new'. The internal format is markdown, the jsonp function was just a convenience to allow people to write the comments in markdown then convert to jsonp for remote.

I'll give it a few minutes and see if I can find anything. No promises..

On 15 May 2017 at 12:15, Ben Simkins [email protected] wrote:

I admit to having some difficulty getting up motivation (and time) to look into this, though now having several people reporting problems maybe I should...

On 15 May 2017 at 11:29, Oliver Salzburg [email protected] wrote:

I hope I'm not stepping on the feet of other contributors, but I think, unless you're opening the PR yourself, there are unlikely going to be any fixes anytime soon. I'd be happy to help anyone getting started with the code base.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Benjol/SE-AutoReviewComments/issues/132#issuecomment-301424099, or mute the thread https://github.com/notifications/unsubscribe-auth/AARPAkfxhIxMU2XBQraQdHDDtR5FZb4aks5r6BsKgaJpZM4M9jVx .

Benjol avatar May 15 '17 10:05 Benjol

(Sorry, stream of conciousness debugging here) If I try the github from @reitzig, FFx console says The resource from “https://raw.githubusercontent.com/Benjol/SE-AutoReviewComments/master/dist/autoreviewcomments.user.js” was blocked due to MIME type mismatch (X-Content-Type-Options: nosniff)

There's a link which sends me here, which is as clear as mud to me.

This on Stack Overflow makes me wonder if the problem isn't at github's end (in this particular case).

Of course all of this may be complete rubbish and related to firewall problems where I am right now!

Hoping maybe my five minutes will help move things forwards a bit.

Benjol avatar May 15 '17 10:05 Benjol

@oliversalzburg I came here because the post on Stack Apps (https://stackapps.com/q/2116/21539) directs people here for bug reports. That post was my entire context for this repo before coming here. I didn't know that bug reports were only welcome with accompanying PRs. If the guidance has changed, could someone update that post (or let me know and I'll submit an edit)?

If converting to another format fixes the problem, that works for me -- I'm only using jsonp because that's what the doc over on SE says. I'm just looking for a way to synchronize my comment templates across several devices and browsers.

@Benjol thanks for your work on this tool.

cellio avatar May 15 '17 13:05 cellio

I didn't know that bug reports were only welcome with accompanying PRs.

All bug reports are welcome. It's just unlikely that they will be handled by the original authors anytime soon. So, if you want to make sure that a fix becomes available ASAP, submitting a PR helps :)

oliversalzburg avatar May 15 '17 13:05 oliversalzburg

Ok, got it. Not equipped to provide the PR, alas.

cellio avatar May 15 '17 13:05 cellio

@cellio The remote issue won't be solved by using Markdown, I think. But the manual import works, at least.

reitzig avatar May 15 '17 13:05 reitzig

In fairness to myself, Oliver and others, the goalposts keep changing: notably when browsers become more strict, or their plugin policies mutate.

(@Shog9 was kind enough to submit a PR the last time Stack Exchange broke the script)

My day job hasn't involved web for a long time now, and I'm not in the rockstar category of people who carry on working when they get home :)

On 15 May 2017 at 15:20, cellio [email protected] wrote:

Ok, got it. Not equipped to provide the PR, alas.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Benjol/SE-AutoReviewComments/issues/132#issuecomment-301472626, or mute the thread https://github.com/notifications/unsubscribe-auth/AARPAueAF15iVOAkOtKpqgzoOR32WVtdks5r6FEigaJpZM4M9jVx .

Benjol avatar May 15 '17 14:05 Benjol

Yeah, I'm not criticizing anybody for not keeping up with changes in the web ecosystem. If you thought I was, please accept my apologies for the miscommunication. I appreciate the work of people who volunteer their time and effort to make improvements like this script.

cellio avatar May 15 '17 15:05 cellio

No worries, I didn't read your comment that way, was just generally bemoaning the mismatch between what I'd like to be able to do and what I can do.

-----Original Message----- From: "cellio" [email protected] Sent: ‎15/‎05/‎2017 17:10 To: "Benjol/SE-AutoReviewComments" [email protected] Cc: "Benjol" [email protected]; "Mention" [email protected] Subject: Re: [Benjol/SE-AutoReviewComments] Importing remote, or any JSON(#132)

Yeah, I'm not criticizing anybody for not keeping up with changes in the web ecosystem. If you thought I was, please accept my apologies for the miscommunication. I appreciate the work of people who volunteer their time and effort to make improvements like this script. — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

Benjol avatar May 15 '17 15:05 Benjol

Could someone try importing from somewhere other than github? Would be interesting to work out if the problem is on the server or client end...

Benjol avatar May 18 '17 06:05 Benjol

I don't store mine on GitHub:

http://www.pobox.com/~cellio/se/comments/

cellio avatar May 18 '17 16:05 cellio

@cellio, now this IS weird, because I just tried yours and they worked?! (I clicked the import "get now" link). Can you try again?

Benjol avatar May 22 '17 05:05 Benjol

@Benjol hmm, that's weird! It's still spinning from me (Chrome and Firefox, Mac 10.12). Just in case there's something weird in the JSON for just one of them, I tried yodeya.jsonp last week and then manually added them, and today I tested with writers.jsonp.

cellio avatar May 23 '17 02:05 cellio

@cellio, I tried again, it didn't work :(

Just read this on StackApps (comments on this answer), if someone wants to try.

"Just in case anyone else is looking to do this, if you want to store your JSONP on GitHub you will need to use the file extension .js and then use RawGit to serve the content up using the correct, executable, mime type."

Note that this problem is going to be complicated (or may even be caused?) by the fact that SE have switched to https. https://github.com/Benjol/SE-AutoReviewComments/issues/134

Benjol avatar May 23 '17 04:05 Benjol

Any idea at all why the custom comments are frequently forgotten? For me, this happens about twice a week, on multiple machines (with Firefox 56 on Linux as well as Waterfox on Windows), and I've got to copy-paste from my Gist then (auto-pull doesn't work, as reported above). To clarify: the auto-import not working I can live with. What bothers me is the script's permanent Alzheimers.

IzzySoft avatar May 18 '18 21:05 IzzySoft

Is this a new problem? GDPR changes maybe? It would be interesting to know if others are experiencing the same thing

-----Original Message----- From: "Izzy" [email protected] Sent: ‎18/‎05/‎2018 23:10 To: "Benjol/SE-AutoReviewComments" [email protected] Cc: "Benjol" [email protected]; "Mention" [email protected] Subject: Re: [Benjol/SE-AutoReviewComments] Importing remote, or any JSON(#132)

Any idea at all why the custom comments are frequently forgotten? For me, this happens about twice a week, on multiple machines, and I've got to copy-paste from my Gist then (auto-pull doesn't work, as reported above). To clarify: the auto-import not working I can live with. What bothers me is the script's permanent Alzheimers. — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

Benjol avatar May 19 '18 07:05 Benjol

@Benjol I don't remember what time it started. Unless you did some GDPR changes, I doubt it's that. I rather suspected some FF changes (v55+), but I'm not sure. In the interim I thought it might be my cookie policy (for some reason I had permitted session cookies only), but even after allowing all cookies, the issue persists. Just had it again yesterday. And it's hard to trace – as when they're gone it's already to late, and before that you can't tell when it happens next. Not sure if it's a general issue with localStorage either, as I'm not aware of something else I use which uses that.

IzzySoft avatar Jun 18 '18 10:06 IzzySoft

As Chrome says in response to the request:

Refused to execute script from 'https://gist.githubusercontent.com/reitzig/7ca05408f53292505294/raw/def-comments-csSE.json?jsonp=callback&_=1529319730589' because its MIME type ('text/plain') is not executable, and strict MIME type checking is enabled.

This is not going to work because Gist provides the data as text/plain. The reason that this is not working is by-design. The data needs to be provided with the correct MIME type for this to function.

https://stackoverflow.com/questions/39228657/disable-chrome-strict-mime-type-checking

oliversalzburg avatar Jun 18 '18 11:06 oliversalzburg

@oliversalzburg OK, that explains the import part. But not why the data is frequently forgotten. What does purge it from localStorage? Any idea?

IzzySoft avatar Jun 18 '18 11:06 IzzySoft

@oliversalzburg could one of the answers to how to create a gist in github that returns json data work?

IzzySoft avatar Jun 18 '18 12:06 IzzySoft

To my understanding, LocalStorage is cleared if you clear your browser history. Of course the details depend on browser, version, clear options, but there is always the potential to also clear the items stored in LocalStorage for a site. I would assume this is a common reason for the observed behavior.

Additionally, Stack Overflow sites have moved to HTTPS a while ago, which made them new sites from the browsers perspective. I assume some reports of this behavior are due to this switch.

Regarding the approach from the question you linked, I guess anything that results in the proper MIME type on the response will work just fine. As the answers suggest, rawgit allows for this, so that should work fine.

oliversalzburg avatar Jun 18 '18 16:06 oliversalzburg

@oliversalzburg

LocalStorage is cleared if you clear your browser history.

That's one possibility (doesn't match the occurences here, as I did no such thing). A second possibility is they are bound to the cookie policy. So e.g. SDC (Self Destructing Cookies; pre-FF57 Firefox addon) purges localStorage along with the cookies if they expire – which is why I mentioned that above. Should no longer be the case here as I've set the cookies for "my SE sites" to never expire (unless the server requests that). And as far as I understood this script, it should store them with the 1st party (just checked: it does).

Stack Overflow sites have moved to HTTPS a while ago, which made them new sites from the browsers perspective

That counts for one time, and then I was aware of that. But after that, it had happened multiple times again already (hm, though not before, now that you mention it).

Concerning Rawgit: I might try that next time, cloning one of my Gists to a .json representation before.

IzzySoft avatar Jun 18 '18 23:06 IzzySoft

The only thing I can add is that we also use LocalStorage extensively in our company products and I am not aware of a single case where the data stored there "cleared itself". Maybe some script on the sites clears the information stored there. Maybe they clear it on logout.

Was this noticed in non-Firefox browsers too?

oliversalzburg avatar Jun 19 '18 08:06 oliversalzburg

Maybe some script on the sites clears the information stored there.

That would mean everybody using this script must have this issue. I don't know who does, so I cannot ask for confirmation. The only item I cannot match to ARC in localStorage is one with the key se:fkey – which indeed is from SE itself. And they might reset that from time to time, in the wrong way ("clear all localStorage as we don't know of any other items here"). Any idea whom to ask?

Was this noticed in non-Firefox browsers too?

I cannot tell, not using any.

@cellio @reitzig can one of you confirm the above?

IzzySoft avatar Jun 19 '18 10:06 IzzySoft

I have not been experiencing forgotten comments. I seem to remember one instance (might have been the SSL thing) but it's definitely not happened in a while.

Using Firefox, currently 60.0.2.

reitzig avatar Jun 19 '18 10:06 reitzig