A copyright violation detector running on Wikimedia Cloud Services https://tools.wmflabs.org/copyvios/
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

pirms 10 gadiem
pirms 10 gadiem
pirms 10 gadiem
pirms 10 gadiem
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  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 documents, plain text pages, and PDFs 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. <a href="${request.script_root | h}?lang=${query.lang | h}&amp;project=${query.project | h}&amp;oldid=${query.page.lastrevid}&amp;action=${query.action}&amp;${("use_engine=" + int(query.use_engine not in ("0", "false")) + "&use_links=" + int(query.use_links not in ("0", "false"))) if query.action == "search" else ("url=" + query.url) | h}">Permalink.</a>
  157. </div>
  158. <div id="cv-result" class="${'red' if result.confidence >= T_SUSPECT else 'yellow' if result.confidence >= T_POSSIBLE else 'green'}-box">
  159. <table id="cv-result-head-table">
  160. <tr>
  161. <td>
  162. <a href="${query.page.url}">${query.page.title | h}</a>
  163. % if query.oldid:
  164. @<a href="//${query.site.domain | h}/w/index.php?oldid=${query.oldid | h}">${query.oldid | h}</a>
  165. % endif
  166. % if query.redirected_from:
  167. <br />
  168. <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>
  169. % endif
  170. </td>
  171. <td>
  172. <div>
  173. % if result.confidence >= T_SUSPECT:
  174. Violation&nbsp;Suspected
  175. % elif result.confidence >= T_POSSIBLE:
  176. Violation&nbsp;Possible
  177. % elif result.sources:
  178. Violation&nbsp;Unlikely
  179. % else:
  180. No&nbsp;Violation
  181. % endif
  182. </div>
  183. <div>${round(result.confidence * 100, 1)}%</div>
  184. <div>confidence</div>
  185. </td>
  186. <td>
  187. % if result.url:
  188. <a href="${result.url | h}">${result.url | urlstrip, h}</a>
  189. % else:
  190. <span id="result-head-no-sources">No matches found.</span>
  191. % endif
  192. </td>
  193. </tr>
  194. </table>
  195. </div>
  196. % if query.action == "search":
  197. <% skips = False %>
  198. <div id="sources-container">
  199. <div id="sources-title">Checked Sources</div>
  200. % if result.sources:
  201. <table id="cv-result-sources">
  202. <tr>
  203. <th>URL</th>
  204. <th>Confidence</th>
  205. <th>Compare</th>
  206. </tr>
  207. % for i, source in enumerate(result.sources):
  208. <tr ${'class="source-default-hidden"' if i >= 10 else 'id="source-row-selected"' if i == 0 else ""}>
  209. <td><a ${'id="source-selected"' if i == 0 else ""} class="source-url" href="${source.url | h}">${source.url | h}</a></td>
  210. <td>
  211. % if source.skipped:
  212. <% skips = True %>
  213. <span class="source-skipped">Skipped</span>
  214. % else:
  215. <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>
  216. % endif
  217. </td>
  218. <td>
  219. % if i == 0:
  220. <a href="#cv-chain-table">Compare</a>
  221. % else:
  222. <a href="${request.url | httpsfix, h}&amp;action=compare&amp;url=${source.url | u}">Compare</a>
  223. % endif
  224. </td>
  225. </tr>
  226. % endfor
  227. </table>
  228. % else:
  229. <div class="cv-source-footer">
  230. No sources checked.
  231. </div>
  232. % endif
  233. % if len(result.sources) > 10:
  234. <div id="cv-additional" class="cv-source-footer">
  235. ${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>
  236. </div>
  237. % endif
  238. % if skips or result.possible_miss:
  239. <div class="cv-source-footer">
  240. The search ended early because a match was found with high confidence. <a href="${request.url | httpsfix, h}&amp;noskip=1">Do a complete check.</a>
  241. </div>
  242. % endif
  243. </div>
  244. % endif
  245. <div id="cv-chain-container">
  246. <table id="cv-chain-table">
  247. <tr>
  248. <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>
  249. <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>
  250. </tr>
  251. </table>
  252. </div>
  253. % endif
  254. <%include file="/support/footer.mako"/>