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.
 
 
 
 
 

206 linhas
12 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 class="cv-search" type="hidden" name="use_links" value="0" />
  110. <input id="cv-cb-engine" class="cv-search" type="checkbox" name="use_engine" value="1" ${'checked="checked"' if (query.use_engine != "0") else ""} />
  111. <label for="cv-cb-engine">Use&nbsp;search&nbsp;engine</label>
  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. <% hide_comparison = "CopyviosHideComparison" in g.cookies and g.cookies["CopyviosHideComparison"].value == "True" %>
  149. <div id="cv-result" class="${'red' if result.confidence >= T_SUSPECT else 'yellow' if result.confidence >= T_POSSIBLE else 'green'}-box">
  150. <h2 id="cv-result-header">
  151. % if result.confidence >= T_POSSIBLE:
  152. <a href="${query.page.url}">${query.page.title | h}</a>
  153. % if query.oldid:
  154. @<a href="//${query.site.domain | h}/w/index.php?oldid=${query.oldid | h}">${query.oldid | h}</a>
  155. % endif
  156. is a ${"suspected" if result.confidence >= T_SUSPECT else "possible"} violation of <a href="${result.url | h}">${result.url | urlstrip, h}</a>.
  157. % else:
  158. % if query.oldid:
  159. 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>.
  160. % else:
  161. No violations detected in <a href="${query.page.url}">${query.page.title | h}</a>.
  162. % endif
  163. % endif
  164. </h2>
  165. </div>
  166. <ul id="cv-result-list">
  167. % if result.confidence < T_POSSIBLE and query.action == "search":
  168. % if result.url:
  169. <li>Best match: <a href="${result.url | h}">${result.url | urlstrip, h}</a>.</li>
  170. % else:
  171. <li>No matches found.</li>
  172. % endif
  173. % endif
  174. % if result.url:
  175. <li><b><span class="mono">${round(result.confidence * 100, 1)}%</span></b> confidence of a violation.</li>
  176. % endif
  177. % if query.redirected_from:
  178. <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>
  179. % endif
  180. % if result.cached:
  181. <li>
  182. 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 URL of the "violated" source, but neither its 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>. Retrieved in <span class="mono">${round(result.time, 3)}</span> seconds (originally generated in
  183. % if result.queries:
  184. <span class="mono">${round(result.original_time, 3)}</span>s using <span class="mono">${result.queries}</span> queries).
  185. % else:
  186. <span class="mono">${round(result.original_time, 3)}</span>s).
  187. % endif
  188. <a href="${request.url | httpsfix, h}&amp;nocache=1">Bypass the cache.</a>
  189. </li>
  190. % else:
  191. <li>Results generated in <span class="mono">${round(result.time, 3)}</span> seconds using <span class="mono">${result.queries}</span> queries.</li>
  192. % endif
  193. % if result.queries:
  194. <li><i>Fun fact:</i> The Wikimedia Foundation paid Yahoo! Inc. <a href="http://info.yahoo.com/legal/us/yahoo/search/bosspricing/details.html">$${result.queries * 0.0008} USD</a> for these results.</li>
  195. % endif
  196. <li><a id="cv-chain-link" href="#cv-chain-table" onclick="copyvio_toggle_details()">${"Show" if hide_comparison else "Hide"} comparison:</a></li>
  197. </ul>
  198. <table id="cv-chain-table" style="display: ${'none' if hide_comparison else 'table'};">
  199. <tr>
  200. <td class="cv-chain-cell">Article: <div class="cv-chain-detail"><p>${highlight_delta(result.article_chain, result.delta_chain)}</p></div></td>
  201. <td class="cv-chain-cell">Source: <div class="cv-chain-detail"><p>${highlight_delta(result.source_chain, result.delta_chain)}</p></div></td>
  202. </tr>
  203. </table>
  204. % endif
  205. <%include file="/support/footer.mako"/>