Wie von Websites wie Github erfassen?

320
bright-star

Ich verwende das untenstehende Bookmarklet mit org-protocol / emacsclient für Journal-Webseiten (Whitespace hinzugefügt):

javascript:location.href='org-protocol://capture://'+ encodeURIComponent(location.href)+'/'+encodeURIComponent(document.title)+ '/'+encodeURIComponent(window.getSelection()) 

Es funktioniert für so ziemlich alles, vor allem aber für Github-Seiten, und versagt in diesem Fall still. Gibt es eine Art Umschreiben von URLs? Was muss ich ändern?

2
Nur ein Zufall: Hast du [das] gesehen (https://help.github.com/articles/how-do-i-get-a-permanent-link-from-file-view-to-permanent-blob- URL)? PythonNut vor 10 Jahren 1
Interessant. Github braucht also einen speziellen Grabber, um das automatisch auszulösen? bright-star vor 10 Jahren 0
Ich denke, das ist der Fall. Probieren Sie es aus und sehen Sie. :) PythonNut vor 10 Jahren 0

1 Antwort auf die Frage

1
Paul Sweatte

Github verwendete seit 2013 einen Content Security Policy-Header, der Bookmarklets über die unsafe-inlineOption blockierte :

INHALT-SICHERHEITSPOLITIK: default-src *; script-src 'self' assets-cdn.github.com jobs.github.com ssl.google-analytics.com secure.gaug.es; style-src 'self' assets-cdn.github.com 'unsafe-inline'; object-src 'self' assets-cdn.github.com; 

Dies wurde 2017 mit einer expliziteren Richtlinie festgelegt:

INHALT-SICHERHEITSPOLITIK: default-src 'none'; base-uri 'self'; block-all-mixed-content; child-src render.githubusercontent.com; connect-src 'self' uploads.github.com status.github.com api.github.com www.google-analytics.com wss: //live.github.com; font-src assets-cdn.github.com; Formular-Aktion 'selbst' github.com gist.github.com; Vorfahren "keine"; frame-src render.githubusercontent.com; img-src "self" -Daten: assets-cdn.github.com identicons.github.com www.google-analytics.com collector.githubapp.com * .gravatar.com * .wp.com * .githubusercontent.com; media-src 'none'; object-src assets-cdn.github.com; Plugin-Typen Anwendung / X-Shockwave-Flash; script-src assets-cdn.github.com; style-src 'unsafe-inline' assets-cdn.github.com 

Verweise