A copyright violation detector running on Wikimedia Cloud Services https://tools.wmflabs.org/copyvios/
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

index.mako 14 KiB

10 anos atrás
10 anos atrás
10 anos atrás
10 anos atrás
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. <%!
  2. from flask import g, request
  3. from copyvios.checker import T_POSSIBLE, T_SUSPECT
  4. from copyvios.misc import cache
  5. %>\
  6. <%include file="/support/header.mako" args="title='Earwig\'s Copyvio Detector'"/>
  7. <%namespace module="copyvios.highlighter" import="highlight_delta"/>\
  8. <%namespace module="copyvios.misc" import="httpsfix, urlstrip"/>\
  9. % if query.submitted:
  10. % if query.error:
  11. <div id="info-box" class="red-box"><p>
  12. % if query.error == "bad action":
  13. Unknown action: <b><span class="mono">${query.action | h}</span></b>.
  14. % elif query.error == "no search method":
  15. No copyvio search methods were selected. A check can only be made using a search engine, links present in the page, or both.
  16. % elif query.error == "no URL":
  17. 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.
  18. % elif query.error == "bad URI":
  19. Unsupported URI scheme: <a href="${query.url | h}">${query.url | h}</a>.
  20. % elif query.error == "no data":
  21. 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.
  22. % elif query.error == "timeout":
  23. The URL <a href="${query.url | h}">${query.url | h}</a> timed out before any data could be retrieved.
  24. % elif query.error == "search error":
  25. 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>.
  26. % else:
  27. An unknown error occurred.
  28. % endif
  29. </p></div>
  30. % elif not query.site:
  31. <div id="info-box" class="red-box">
  32. <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>
  33. </div>
  34. % elif query.oldid and not result:
  35. <div id="info-box" class="red-box">
  36. <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>
  37. </div>
  38. % elif query.title and not result:
  39. <div id="info-box" class="red-box">
  40. <p>The given page doesn't seem to exist: <a href="${query.page.url}">${query.page.title | h}</a>.</p>
  41. </div>
  42. % endif
  43. %endif
  44. <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>
  45. <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>
  46. <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>
  47. <form id="cv-form" action="${request.script_root}" method="get">
  48. <table id="cv-form-outer">
  49. <tr>
  50. <td>Site:</td>
  51. <td colspan="3">
  52. <span class="mono">https://</span>
  53. <select name="lang">
  54. <% selected_lang = query.orig_lang if query.orig_lang else g.cookies["CopyviosDefaultLang"].value if "CopyviosDefaultLang" in g.cookies else cache.bot.wiki.get_site().lang %>\
  55. % for code, name in cache.langs:
  56. % if code == selected_lang:
  57. <option value="${code | h}" selected="selected">${name}</option>
  58. % else:
  59. <option value="${code | h}">${name}</option>
  60. % endif
  61. % endfor
  62. </select>
  63. <span class="mono">.</span>
  64. <select name="project">
  65. <% selected_project = query.project if query.project else g.cookies["CopyviosDefaultProject"].value if "CopyviosDefaultProject" in g.cookies else cache.bot.wiki.get_site().project %>\
  66. % for code, name in cache.projects:
  67. % if code == selected_project:
  68. <option value="${code | h}" selected="selected">${name}</option>
  69. % else:
  70. <option value="${code | h}">${name}</option>
  71. % endif
  72. % endfor
  73. </select>
  74. <span class="mono">.org</span>
  75. </td>
  76. </tr>
  77. <tr>
  78. <td id="cv-col1">Page&nbsp;title:</td>
  79. <td id="cv-col2">
  80. % if query.title:
  81. <input class="cv-text" type="text" name="title" value="${query.page.title if query.page else query.title | h}" />
  82. % else:
  83. <input class="cv-text" type="text" name="title" />
  84. % endif
  85. </td>
  86. <td id="cv-col3">or&nbsp;revision&nbsp;ID:</td>
  87. <td id="cv-col4">
  88. % if query.oldid:
  89. <input class="cv-text" type="text" name="oldid" value="${query.oldid | h}" />
  90. % else:
  91. <input class="cv-text" type="text" name="oldid" />
  92. % endif
  93. </td>
  94. </tr>
  95. <tr>
  96. <td>Action:</td>
  97. <td colspan="3">
  98. <table id="cv-form-inner">
  99. <tr>
  100. <td id="cv-inner-col1">
  101. <input id="action-search" type="radio" name="action" value="search" ${'checked="checked"' if (query.action == "search" or not query.action) else ""} />
  102. </td>
  103. <td id="cv-inner-col2"><label for="action-search">Copyvio&nbsp;search:</label></td>
  104. <td id="cv-inner-col3">
  105. <input class="cv-search" type="hidden" name="use_engine" value="0" />
  106. <input id="cv-cb-engine" class="cv-search" type="checkbox" name="use_engine" value="1" ${'checked="checked"' if (query.use_engine != "0") else ""} />
  107. <label for="cv-cb-engine">Use&nbsp;search&nbsp;engine</label>
  108. <input class="cv-search" type="hidden" name="use_links" value="0" />
  109. <input id="cv-cb-links" class="cv-search" type="checkbox" name="use_links" value="1" ${'checked="checked"' if (query.use_links != "0") else ""} />
  110. <label for="cv-cb-links">Use&nbsp;links&nbsp;in&nbsp;page</label>
  111. </td>
  112. </tr>
  113. <tr>
  114. <td>
  115. <input id="action-compare" type="radio" name="action" value="compare" ${'checked="checked"' if query.action == "compare" else ""} />
  116. </td>
  117. <td><label for="action-compare">URL&nbsp;comparison:</label></td>
  118. <td>
  119. <input class="cv-compare cv-text" type="text" name="url"
  120. % if query.url:
  121. value="${query.url | h}"
  122. % endif
  123. />
  124. </td>
  125. </tr>
  126. </table>
  127. </td>
  128. </tr>
  129. % if query.nocache or (result and result.cached):
  130. <tr>
  131. <td><label for="cb-nocache">Bypass&nbsp;cache:</label></td>
  132. <td colspan="3">
  133. <input id="cb-nocache" type="checkbox" name="nocache" value="1" ${'checked="checked"' if query.nocache else ""} />
  134. </td>
  135. </tr>
  136. % endif
  137. <tr>
  138. <td colspan="4">
  139. <button type="submit">Submit</button>
  140. </td>
  141. </tr>
  142. </table>
  143. </form>
  144. % if result:
  145. <div id="generation-time">
  146. Results
  147. % if result.cached:
  148. <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
  149. % endif
  150. generated in <span class="mono">${round(result.time, 3)}</span>
  151. % if query.action == "search":
  152. seconds using <span class="mono">${result.queries}</span> quer${"y" if result.queries == 1 else "ies"}.
  153. % else:
  154. seconds.
  155. % endif
  156. </div>
  157. <div id="cv-result" class="${'red' if result.confidence >= T_SUSPECT else 'yellow' if result.confidence >= T_POSSIBLE else 'green'}-box">
  158. <table id="cv-result-head-table">
  159. <tr>
  160. <td>
  161. <a href="${query.page.url}">${query.page.title | h}</a>
  162. % if query.oldid:
  163. @<a href="//${query.site.domain | h}/w/index.php?oldid=${query.oldid | h}">${query.oldid | h}</a>
  164. % endif
  165. % if query.redirected_from:
  166. <br />
  167. <span id="redirected-from">Redirected from <a href="//${query.site.domain | h}/w/index.php?title=${query.redirected_from.title | u}&amp;redirect=no">${query.redirected_from.title | h}</a>. <a href="${request.url | httpsfix, h}&amp;noredirect=1">Check original.</a></span>
  168. % endif
  169. </td>
  170. <td>
  171. <div>
  172. % if result.confidence >= T_SUSPECT:
  173. Violation&nbsp;Suspected
  174. % elif result.confidence >= T_POSSIBLE:
  175. Violation&nbsp;Possible
  176. % elif result.sources:
  177. Violation&nbsp;Unlikely
  178. % else:
  179. No&nbsp;Violation
  180. % endif
  181. </div>
  182. <div>${round(result.confidence * 100, 1)}%</div>
  183. <div>confidence</div>
  184. </td>
  185. <td>
  186. % if result.url:
  187. <a href="${result.url | h}">${result.url | urlstrip, h}</a>
  188. % else:
  189. <span id="result-head-no-sources">No matches found.</span>
  190. % endif
  191. </td>
  192. </tr>
  193. </table>
  194. </div>
  195. % if query.action == "search":
  196. <% skips = False %>
  197. <div id="sources-container">
  198. <div id="sources-title">Checked Sources</div>
  199. % if result.sources:
  200. <table id="cv-result-sources">
  201. <tr>
  202. <th>URL</th>
  203. <th>Confidence</th>
  204. <th>Compare</th>
  205. </tr>
  206. % for i, source in enumerate(result.sources):
  207. <tr ${'class="source-default-hidden"' if i >= 10 else 'id="source-row-selected"' if i == 0 else ""}>
  208. <td><a ${'id="source-selected"' if i == 0 else ""} class="source-url" href="${source.url | h}">${source.url | h}</a></td>
  209. <td>
  210. % if source.skipped:
  211. <% skips = True %>
  212. <span class="source-skipped">Skipped</span>
  213. % else:
  214. <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>
  215. % endif
  216. </td>
  217. <td>
  218. % if i == 0:
  219. <a href="#cv-chain-table">Compare</a>
  220. % else:
  221. <a href="${request.url | httpsfix, h}&amp;action=compare&amp;url=${source.url | u}">Compare</a>
  222. % endif
  223. </td>
  224. </tr>
  225. % endfor
  226. </table>
  227. % else:
  228. <div class="cv-source-footer">
  229. No sources checked.
  230. </div>
  231. % endif
  232. % if len(result.sources) > 10:
  233. <div id="cv-additional" class="cv-source-footer">
  234. ${len(result.sources) - 10} URL${"s" if len(result.sources) > 11 else ""} with lower confidence hidden. <a id="show-additional-sources" href="#">Show them.</a>
  235. </div>
  236. % endif
  237. % if skips:
  238. <div class="cv-source-footer">
  239. 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>
  240. </div>
  241. % endif
  242. </div>
  243. % endif
  244. <div id="cv-chain-container">
  245. <table id="cv-chain-table">
  246. <tr>
  247. <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>
  248. <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>
  249. </tr>
  250. </table>
  251. </div>
  252. % endif
  253. <%include file="/support/footer.mako"/>