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.
 
 
 
 
 

213 satır
13 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. <% 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. <% skips = False %>
  167. % if query.action == "search":
  168. <table id="cv-result-sources" style="display: none;">
  169. <tr>
  170. <th>URL</th>
  171. <th>Confidence</th>
  172. </tr>
  173. % for source in result.sources:
  174. <tr>
  175. <td><a href="${source.url | h}">${source.url | h}</a> (<a href="${request.url | httpsfix, h}&amp;action=compare&amp;url=${source.url | u}">compare</a>)</td>
  176. % if source.skipped:
  177. <% skips = True %>
  178. <td><span class="source-skipped">Skipped</span></td>
  179. % else:
  180. <td><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></td>
  181. % endif
  182. </tr>
  183. % endfor
  184. </table>
  185. % endif
  186. <ul id="cv-result-list">
  187. % if query.action == "compare":
  188. <li><b><span class="mono">${round(result.confidence * 100, 1)}%</span></b> confidence of a violation.</li>
  189. % endif
  190. % if query.redirected_from:
  191. <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>
  192. % endif
  193. % if skips:
  194. <li>Since a suspected source was found with a high confidence value, some URLs were skipped. <a href="javascript:alert('Not implemented yet!');">Check all URLs.</a></li>
  195. % endif
  196. % if result.cached:
  197. <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>
  198. % elif query.action == "compare":
  199. <li>Results generated in <span class="mono">${round(result.time, 3)}</span> seconds.</li>
  200. % else:
  201. <li>Results generated in <span class="mono">${round(result.time, 3)}</span> seconds using <span class="mono">${result.queries}</span> queries.</li>
  202. % endif
  203. <li><a id="cv-chain-link" href="#cv-chain-table" onclick="copyvio_toggle_details()">${"Show" if hide_comparison else "Hide"} comparison:</a></li>
  204. </ul>
  205. <table id="cv-chain-table" style="display: ${'none' if hide_comparison else 'table'};">
  206. <tr>
  207. <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>
  208. <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>
  209. </tr>
  210. </table>
  211. % endif
  212. <%include file="/support/footer.mako"/>