A copyright violation detector running on Wikimedia Cloud Services https://tools.wmflabs.org/copyvios/
25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.

index.mako 14 KiB

10 yıl önce
10 yıl önce
10 yıl önce
10 yıl önce
10 yıl önce
10 yıl önce
10 yıl önce
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  1. <%!
  2. from flask import g, request
  3. from copyvios.checker import T_POSSIBLE, T_SUSPECT
  4. %>\
  5. <%include file="/support/header.mako" args="title='Earwig\'s Copyvio Detector'"/>
  6. <%namespace module="copyvios.highlighter" import="highlight_delta"/>\
  7. <%namespace module="copyvios.misc" import="httpsfix, urlstrip"/>\
  8. % if query.submitted:
  9. % if query.error == "bad action":
  10. <div id="info-box" class="red-box">
  11. <p>Unknown action: <b><span class="mono">${query.action | h}</span></b>.</p>
  12. </div>
  13. % elif query.error == "no search method":
  14. <div id="info-box" class="red-box">
  15. <p>No copyvio search methods were selected. A check can only be made using a search engine, links present in the page, or both.</p>
  16. </div>
  17. % elif query.error == "no URL":
  18. <div id="info-box" class="red-box">
  19. <p>URL comparison mode requires a URL to be entered. Enter one in the text box below, or choose copyvio search mode to look for content similar to the article elsewhere on the web.</p>
  20. </div>
  21. % elif query.error == "bad URI":
  22. <div id="info-box" class="red-box">
  23. <p>Unsupported URI scheme: <a href="${query.url | h}">${query.url | h}</a>.</p>
  24. </div>
  25. % elif query.error == "no data":
  26. <div id="info-box" class="red-box">
  27. <p>Couldn't find any text in <a href="${query.url | h}">${query.url | h}</a>. <i>Note:</i> only HTML and plain text pages are supported, and content generated by JavaScript or found inside iframes is ignored.</p>
  28. </div>
  29. % elif query.error == "timeout":
  30. <div id="info-box" class="red-box">
  31. <p>The URL <a href="${query.url | h}">${query.url | h}</a> timed out before any data could be retrieved.</p>
  32. </div>
  33. % elif query.error == "search error":
  34. <div id="info-box" class="red-box">
  35. <p>An error occurred while using the search engine (${query.exception}). Try reloading the page. If the error persists, <a href="${request.url | httpsfix, h}&amp;use_engine=0">repeat the check without using the search engine</a>.</p>
  36. </div>
  37. % elif not query.site:
  38. <div id="info-box" class="red-box">
  39. <p>The given site (project=<b><span class="mono">${query.project | h}</span></b>, language=<b><span class="mono">${query.lang | h}</span></b>) doesn't seem to exist. It may also be closed or private. <a href="//${query.lang | h}.${query.project | h}.org/">Confirm its URL.</a></p>
  40. </div>
  41. % elif query.title and not result:
  42. <div id="info-box" class="red-box">
  43. <p>The given page doesn't seem to exist: <a href="${query.page.url}">${query.page.title | h}</a>.</p>
  44. </div>
  45. % elif query.oldid and not result:
  46. <div id="info-box" class="red-box">
  47. <p>The given revision ID doesn't seem to exist: <a href="//${query.site.domain | h}/w/index.php?oldid=${query.oldid | h}">${query.oldid | h}</a>.</p>
  48. </div>
  49. % endif
  50. %endif
  51. <p>This tool attempts to detect <a href="//en.wikipedia.org/wiki/WP:COPYVIO">copyright violations</a> in articles. In search mode, it will check for similar content elsewhere on the web using <a href="//developer.yahoo.com/boss/search/">Yahoo! BOSS</a> and/or external links present in the text of the page, depending on which options are selected. In comparison mode, the tool will skip the searching step and display a report comparing the article to the given webpage, like the <a href="//tools.wmflabs.org/dupdet/">Duplication Detector</a>.</p>
  52. <p>Running a full check can take up to 45 seconds if other websites are slow. Please be patient. If you get a timeout, wait a moment and refresh the page.</p>
  53. <p>Specific websites can be skipped (for example, if their content is in the public domain) by being added to the <a href="//en.wikipedia.org/wiki/User:EarwigBot/Copyvios/Exclusions">excluded URL list</a>.</p>
  54. <form id="cv-form" action="${request.script_root}" method="get">
  55. <table id="cv-form-outer">
  56. <tr>
  57. <td>Site:</td>
  58. <td colspan="3">
  59. <span class="mono">https://</span>
  60. <select name="lang">
  61. <% selected_lang = query.orig_lang if query.orig_lang else g.cookies["CopyviosDefaultLang"].value if "CopyviosDefaultLang" in g.cookies else g.bot.wiki.get_site().lang %>\
  62. % for code, name in query.all_langs:
  63. % if code == selected_lang:
  64. <option value="${code | h}" selected="selected">${name}</option>
  65. % else:
  66. <option value="${code | h}">${name}</option>
  67. % endif
  68. % endfor
  69. </select>
  70. <span class="mono">.</span>
  71. <select name="project">
  72. <% selected_project = query.project if query.project else g.cookies["CopyviosDefaultProject"].value if "CopyviosDefaultProject" in g.cookies else g.bot.wiki.get_site().project %>\
  73. % for code, name in query.all_projects:
  74. % if code == selected_project:
  75. <option value="${code | h}" selected="selected">${name}</option>
  76. % else:
  77. <option value="${code | h}">${name}</option>
  78. % endif
  79. % endfor
  80. </select>
  81. <span class="mono">.org</span>
  82. </td>
  83. </tr>
  84. <tr>
  85. <td id="cv-col1">Page&nbsp;title:</td>
  86. <td id="cv-col2">
  87. % if query.title:
  88. <input class="cv-text" type="text" name="title" value="${query.page.title if query.page else query.title | h}" />
  89. % else:
  90. <input class="cv-text" type="text" name="title" />
  91. % endif
  92. </td>
  93. <td id="cv-col3">or&nbsp;revision&nbsp;ID:</td>
  94. <td id="cv-col4">
  95. % if query.oldid:
  96. <input class="cv-text" type="text" name="oldid" value="${query.oldid | h}" />
  97. % else:
  98. <input class="cv-text" type="text" name="oldid" />
  99. % endif
  100. </td>
  101. </tr>
  102. <tr>
  103. <td>Action:</td>
  104. <td colspan="3">
  105. <table id="cv-form-inner">
  106. <tr>
  107. <td id="cv-inner-col1">
  108. <input id="action-search" type="radio" name="action" value="search" ${'checked="checked"' if (query.action == "search" or not query.action) else ""} />
  109. </td>
  110. <td id="cv-inner-col2"><label for="action-search">Copyvio&nbsp;search:</label></td>
  111. <td id="cv-inner-col3">
  112. <input class="cv-search" type="hidden" name="use_engine" value="0" />
  113. <input id="cv-cb-engine" class="cv-search" type="checkbox" name="use_engine" value="1" ${'checked="checked"' if (query.use_engine != "0") else ""} />
  114. <label for="cv-cb-engine">Use&nbsp;search&nbsp;engine</label>
  115. <input class="cv-search" type="hidden" name="use_links" value="0" />
  116. <input id="cv-cb-links" class="cv-search" type="checkbox" name="use_links" value="1" ${'checked="checked"' if (query.use_links != "0") else ""} />
  117. <label for="cv-cb-links">Use&nbsp;links&nbsp;in&nbsp;page</label>
  118. </td>
  119. </tr>
  120. <tr>
  121. <td>
  122. <input id="action-compare" type="radio" name="action" value="compare" ${'checked="checked"' if query.action == "compare" else ""} />
  123. </td>
  124. <td><label for="action-compare">URL&nbsp;comparison:</label></td>
  125. <td>
  126. <input class="cv-compare cv-text" type="text" name="url"
  127. % if query.url:
  128. value="${query.url | h}"
  129. % endif
  130. />
  131. </td>
  132. </tr>
  133. </table>
  134. </td>
  135. </tr>
  136. % if query.nocache or (result and result.cached):
  137. <tr>
  138. <td><label for="cb-nocache">Bypass&nbsp;cache:</label></td>
  139. <td colspan="3">
  140. <input id="cb-nocache" type="checkbox" name="nocache" value="1" ${'checked="checked"' if query.nocache else ""} />
  141. </td>
  142. </tr>
  143. % endif
  144. <tr>
  145. <td colspan="4">
  146. <button type="submit">Submit</button>
  147. </td>
  148. </tr>
  149. </table>
  150. </form>
  151. % if result:
  152. <div id="cv-result" class="${'red' if result.confidence >= T_SUSPECT else 'yellow' if result.confidence >= T_POSSIBLE else 'green'}-box">
  153. <h2 id="cv-result-header">
  154. % if result.confidence >= T_POSSIBLE:
  155. <a href="${query.page.url}">${query.page.title | h}</a>
  156. % if query.oldid:
  157. @<a href="//${query.site.domain | h}/w/index.php?oldid=${query.oldid | h}">${query.oldid | h}</a>
  158. % endif
  159. is a ${"suspected" if result.confidence >= T_SUSPECT else "possible"} violation of <a href="${result.url | h}">${result.url | urlstrip, h}</a>.
  160. % else:
  161. % if query.oldid:
  162. No violations detected in <a href="${query.page.url}">${query.page.title | h}</a> @<a href="//${query.site.domain | h}/w/index.php?oldid=${query.oldid | h}">${query.oldid | h}</a>.
  163. % else:
  164. No violations detected in <a href="${query.page.url}">${query.page.title | h}</a>.
  165. % endif
  166. % endif
  167. </h2>
  168. </div>
  169. <% skips = False %>
  170. % if query.action == "search":
  171. <div id="sources-container">
  172. <div id="sources-title">Checked Sources</div>
  173. % if result.sources:
  174. <table id="cv-result-sources">
  175. <tr>
  176. <th>URL</th>
  177. <th>Confidence</th>
  178. <th>Compare</th>
  179. </tr>
  180. % for i, source in enumerate(result.sources):
  181. <tr ${'class="source-default-hidden"' if i >= 10 else 'id="source-row-selected"' if i == 0 else ""}>
  182. <td><a ${'id="source-selected"' if i == 0 else ""} href="${source.url | h}">${source.url | h}</a></td>
  183. <td>
  184. % if source.skipped:
  185. <% skips = True %>
  186. <span class="source-skipped">Skipped</span>
  187. % else:
  188. <span class="source-confidence ${"source-suspect" if source.confidence >= T_SUSPECT else "source-possible" if source.confidence >= T_POSSIBLE else "source-novio"}">${round(source.confidence * 100, 1)}%</span>
  189. % endif
  190. </td>
  191. <td>
  192. % if i == 0:
  193. <a href="#cv-chain-table">Compare</a>
  194. % else:
  195. <a href="${request.url | httpsfix, h}&amp;action=compare&amp;url=${source.url | u}">Compare</a>
  196. % endif
  197. </td>
  198. </tr>
  199. % endfor
  200. </table>
  201. % else:
  202. <div id="cv-no-sources">
  203. <span class="source-footer-text">No sources checked.</span>
  204. </div>
  205. % endif
  206. % if len(result.sources) > 10:
  207. <div id="cv-additional">
  208. <span class="source-footer-text">${len(result.sources) - 10} URL${"s" if len(result.sources) > 11 else ""} with lower confidence hidden.</span> <a id="show-additional-sources" href="#">Show them.</a>
  209. </div>
  210. % endif
  211. </div>
  212. % endif
  213. <ul id="cv-result-list">
  214. % if query.action == "compare":
  215. <li><b><span class="mono">${round(result.confidence * 100, 1)}%</span></b> confidence of a violation.</li>
  216. % endif
  217. % if query.redirected_from:
  218. <li>Redirected from <a href="${query.redirected_from.url}">${query.redirected_from.title | h}</a>. <a href="${request.url | httpsfix, h}&amp;noredirect=1">Check the original page.</a></li>
  219. % endif
  220. % if skips:
  221. <li>Since a suspected source was found with a high confidence value, some URLs were skipped. <a href="${request.url | httpsfix, h}&amp;noskip=1">Check all URLs.</a></li>
  222. % endif
  223. % if result.cached:
  224. <li>Results are <a id="cv-cached" href="#">cached<span>To save time (and money), this tool will retain the results of checks for up to 72 hours. This includes the URLs of the checked sources, but neither their content nor the content of the article. Future checks on the same page (assuming it remains unchanged) will not involve additional search queries, but a fresh comparison against the source URL will be made. If the page is modified, a new check will be run.</span></a> from <abbr title="${result.cache_time}">${result.cache_age} ago</abbr>. Originally generated in <span class="mono">${round(result.time, 3)}</span> seconds using <span class="mono">${result.queries}</span> queries. <a href="${request.url | httpsfix, h}&amp;nocache=1">Bypass the cache.</a></li>
  225. % elif query.action == "compare":
  226. <li>Results generated in <span class="mono">${round(result.time, 3)}</span> seconds.</li>
  227. % else:
  228. <li>Results generated in <span class="mono">${round(result.time, 3)}</span> seconds using <span class="mono">${result.queries}</span> queries.</li>
  229. % endif
  230. </ul>
  231. <div id="cv-chain-container">
  232. <table id="cv-chain-table">
  233. <tr>
  234. <td class="cv-chain-cell">Article: <div class="cv-chain-detail"><p>${highlight_delta(result.article_chain, result.best.chains[1] if result.best else None)}</p></div></td>
  235. <td class="cv-chain-cell">Source: <div class="cv-chain-detail"><p>${highlight_delta(result.best.chains[0], result.best.chains[1]) if result.best else ""}</p></div></td>
  236. </tr>
  237. </table>
  238. </div>
  239. % endif
  240. <%include file="/support/footer.mako"/>