A copyright violation detector running on Wikimedia Cloud Services https://tools.wmflabs.org/copyvios/
Não pode escolher mais do que 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.
 
 
 
 
 

237 linhas
14 KiB

  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 not query.site:
  34. <div id="info-box" class="red-box">
  35. <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>
  36. </div>
  37. % elif query.title and not result:
  38. <div id="info-box" class="red-box">
  39. <p>The given page doesn't seem to exist: <a href="${query.page.url}">${query.page.title | h}</a>.</p>
  40. </div>
  41. % elif query.oldid and not result:
  42. <div id="info-box" class="red-box">
  43. <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>
  44. </div>
  45. % endif
  46. %endif
  47. <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>
  48. <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>
  49. <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>
  50. <form id="cv-form" action="${request.script_root}" method="get">
  51. <table id="cv-form-outer">
  52. <tr>
  53. <td>Site:</td>
  54. <td colspan="3">
  55. <span class="mono">https://</span>
  56. <select name="lang">
  57. <% 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 %>\
  58. % for code, name in query.all_langs:
  59. % if code == selected_lang:
  60. <option value="${code | h}" selected="selected">${name}</option>
  61. % else:
  62. <option value="${code | h}">${name}</option>
  63. % endif
  64. % endfor
  65. </select>
  66. <span class="mono">.</span>
  67. <select name="project">
  68. <% selected_project = query.project if query.project else g.cookies["CopyviosDefaultProject"].value if "CopyviosDefaultProject" in g.cookies else g.bot.wiki.get_site().project %>\
  69. % for code, name in query.all_projects:
  70. % if code == selected_project:
  71. <option value="${code | h}" selected="selected">${name}</option>
  72. % else:
  73. <option value="${code | h}">${name}</option>
  74. % endif
  75. % endfor
  76. </select>
  77. <span class="mono">.org</span>
  78. </td>
  79. </tr>
  80. <tr>
  81. <td id="cv-col1">Page&nbsp;title:</td>
  82. <td id="cv-col2">
  83. % if query.title:
  84. <input class="cv-text" type="text" name="title" value="${query.page.title if query.page else query.title | h}" />
  85. % else:
  86. <input class="cv-text" type="text" name="title" />
  87. % endif
  88. </td>
  89. <td id="cv-col3">or&nbsp;revision&nbsp;ID:</td>
  90. <td id="cv-col4">
  91. % if query.oldid:
  92. <input class="cv-text" type="text" name="oldid" value="${query.oldid | h}" />
  93. % else:
  94. <input class="cv-text" type="text" name="oldid" />
  95. % endif
  96. </td>
  97. </tr>
  98. <tr>
  99. <td>Action:</td>
  100. <td colspan="3">
  101. <table id="cv-form-inner">
  102. <tr>
  103. <td id="cv-inner-col1">
  104. <input id="action-search" type="radio" name="action" value="search" ${'checked="checked"' if (query.action == "search" or not query.action) else ""} />
  105. </td>
  106. <td id="cv-inner-col2"><label for="action-search">Copyvio&nbsp;search:</label></td>
  107. <td id="cv-inner-col3">
  108. <input class="cv-search" type="hidden" name="use_engine" value="0" />
  109. <input id="cv-cb-engine" class="cv-search" type="checkbox" name="use_engine" value="1" ${'checked="checked"' if (query.use_engine != "0") else ""} />
  110. <label for="cv-cb-engine">Use&nbsp;search&nbsp;engine</label>
  111. <input class="cv-search" type="hidden" name="use_links" value="0" />
  112. <input id="cv-cb-links" class="cv-search" type="checkbox" name="use_links" value="1" ${'checked="checked"' if (query.use_links != "0") else ""} />
  113. <label for="cv-cb-links">Use&nbsp;links&nbsp;in&nbsp;page</label>
  114. </td>
  115. </tr>
  116. <tr>
  117. <td>
  118. <input id="action-compare" type="radio" name="action" value="compare" ${'checked="checked"' if query.action == "compare" else ""} />
  119. </td>
  120. <td><label for="action-compare">URL&nbsp;comparison:</label></td>
  121. <td>
  122. <input class="cv-compare cv-text" type="text" name="url"
  123. % if query.url:
  124. value="${query.url | h}"
  125. % endif
  126. />
  127. </td>
  128. </tr>
  129. </table>
  130. </td>
  131. </tr>
  132. % if query.nocache or (result and result.cached):
  133. <tr>
  134. <td><label for="cb-nocache">Bypass&nbsp;cache:</label></td>
  135. <td colspan="3">
  136. <input id="cb-nocache" type="checkbox" name="nocache" value="1" ${'checked="checked"' if query.nocache else ""} />
  137. </td>
  138. </tr>
  139. % endif
  140. <tr>
  141. <td colspan="4">
  142. <button type="submit">Submit</button>
  143. </td>
  144. </tr>
  145. </table>
  146. </form>
  147. % if result:
  148. <div id="cv-result" class="${'red' if result.confidence >= T_SUSPECT else 'yellow' if result.confidence >= T_POSSIBLE else 'green'}-box">
  149. <h2 id="cv-result-header">
  150. % if result.confidence >= T_POSSIBLE:
  151. <a href="${query.page.url}">${query.page.title | h}</a>
  152. % if query.oldid:
  153. @<a href="//${query.site.domain | h}/w/index.php?oldid=${query.oldid | h}">${query.oldid | h}</a>
  154. % endif
  155. is a ${"suspected" if result.confidence >= T_SUSPECT else "possible"} violation of <a href="${result.url | h}">${result.url | urlstrip, h}</a>.
  156. % else:
  157. % if query.oldid:
  158. 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>.
  159. % else:
  160. No violations detected in <a href="${query.page.url}">${query.page.title | h}</a>.
  161. % endif
  162. % endif
  163. </h2>
  164. </div>
  165. <% skips = False %>
  166. % if query.action == "search":
  167. <div id="sources-container">
  168. <div id="sources-title">Checked Sources</div>
  169. % if result.sources:
  170. <table id="cv-result-sources">
  171. <tr>
  172. <th>URL</th>
  173. <th>Confidence</th>
  174. <th>Compare</th>
  175. </tr>
  176. % for i, source in enumerate(result.sources):
  177. <tr ${'class="source-default-hidden"' if i >= 10 else 'id="source-row-selected"' if i == 0 else ""}>
  178. <td><a ${'id="source-selected"' if i == 0 else ""} href="${source.url | h}">${source.url | h}</a></td>
  179. <td>
  180. % if source.skipped:
  181. <% skips = True %>
  182. <span class="source-skipped">Skipped</span>
  183. % else:
  184. <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>
  185. % endif
  186. </td>
  187. <td>
  188. % if i == 0:
  189. <a href="#cv-chain-table">Compare</a>
  190. % else:
  191. <a href="${request.url | httpsfix, h}&amp;action=compare&amp;url=${source.url | u}">Compare</a>
  192. % endif
  193. </td>
  194. </tr>
  195. % endfor
  196. </table>
  197. % else:
  198. <div id="cv-no-sources">
  199. <span class="source-footer-text">No sources checked.</span>
  200. </div>
  201. % endif
  202. % if len(result.sources) > 10:
  203. <div id="cv-additional">
  204. <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>
  205. </div>
  206. % endif
  207. </div>
  208. % endif
  209. <ul id="cv-result-list">
  210. % if query.action == "compare":
  211. <li><b><span class="mono">${round(result.confidence * 100, 1)}%</span></b> confidence of a violation.</li>
  212. % endif
  213. % if query.redirected_from:
  214. <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>
  215. % endif
  216. % if skips:
  217. <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>
  218. % endif
  219. % if result.cached:
  220. <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>
  221. % elif query.action == "compare":
  222. <li>Results generated in <span class="mono">${round(result.time, 3)}</span> seconds.</li>
  223. % else:
  224. <li>Results generated in <span class="mono">${round(result.time, 3)}</span> seconds using <span class="mono">${result.queries}</span> queries.</li>
  225. % endif
  226. </ul>
  227. <div id="cv-chain-container">
  228. <table id="cv-chain-table">
  229. <tr>
  230. <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>
  231. <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>
  232. </tr>
  233. </table>
  234. </div>
  235. % endif
  236. <%include file="/support/footer.mako"/>