()
| 137 | } |
| 138 | |
| 139 | export async function assertOrigin() { |
| 140 | const { origins } = await getRepoConfig(); |
| 141 | const { origin, owner, repo } = page; |
| 142 | if (origins.indexOf(origin) !== -1) { |
| 143 | return; |
| 144 | } |
| 145 | |
| 146 | document.querySelector('.timeline')!.lastElementChild!.insertAdjacentHTML('beforebegin', ` |
| 147 | <div class="flash flash-error flash-not-installed"> |
| 148 | Error: <code>${origin}</code> is not permitted to post to <code>${owner}/${repo}</code>. |
| 149 | Confirm this is the correct repo for this site's comments. If you own this repo, |
| 150 | <a href="https://github.com/${owner}/${repo}/edit/master/utterances.json" target="_top"> |
| 151 | <strong>update the utterances.json</strong> |
| 152 | </a> |
| 153 | to include <code>${origin}</code> in the list of origins.<br/><br/> |
| 154 | Suggested configuration:<br/> |
| 155 | <pre><code>${JSON.stringify({ origins: [origin] }, null, 2)}</code></pre> |
| 156 | </div>`); |
| 157 | scheduleMeasure(); |
| 158 | throw new Error('Origin not permitted.'); |
| 159 | } |
no test coverage detected