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
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  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 notice:
  10. <div id="notice-box" class="gray-box">
  11. ${notice}
  12. </div>
  13. % endif
  14. % if query.submitted:
  15. % if query.error:
  16. <div id="info-box" class="red-box"><p>
  17. % if query.error == "bad action":
  18. Unknown action: <b><span class="mono">${query.action | h}</span></b>.
  19. % elif query.error == "no search method":
  20. No copyvio search methods were selected. A check can only be made using a search engine, links present in the page, or both.
  21. % elif query.error == "no URL":
  22. 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.
  23. % elif query.error == "bad URI":
  24. Unsupported URI scheme: <a href="${query.url | h}">${query.url | h}</a>.
  25. % elif query.error == "no data":
  26. 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.
  27. % elif query.error == "timeout":
  28. The URL <a href="${query.url | h}">${query.url | h}</a> timed out before any data could be retrieved.
  29. % elif query.error == "search error":
  30. 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>.
  31. % else:
  32. An unknown error occurred.
  33. % endif
  34. </p></div>
  35. % elif not query.site:
  36. <div id="info-box" class="red-box">
  37. <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>
  38. </div>
  39. % elif query.oldid and not result:
  40. <div id="info-box" class="red-box">
  41. <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>
  42. </div>
  43. % elif query.title and not result:
  44. <div id="info-box" class="red-box">
  45. <p>The given page doesn't seem to exist: <a href="${query.page.url}">${query.page.title | h}</a>.</p>
  46. </div>
  47. % endif
  48. %endif
  49. <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>
  50. <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>
  51. <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>
  52. <form id="cv-form" action="${request.script_root}" method="get">
  53. <table id="cv-form-outer">
  54. <tr>
  55. <td>Site:</td>
  56. <td colspan="3">
  57. <span class="mono">https://</span>
  58. <select name="lang">
  59. <% 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 %>\
  60. % for code, name in cache.langs:
  61. % if code == selected_lang:
  62. <option value="${code | h}" selected="selected">${name}</option>
  63. % else:
  64. <option value="${code | h}">${name}</option>
  65. % endif
  66. % endfor
  67. </select>
  68. <span class="mono">.</span>
  69. <select name="project">
  70. <% selected_project = query.project if query.project else g.cookies["CopyviosDefaultProject"].value if "CopyviosDefaultProject" in g.cookies else cache.bot.wiki.get_site().project %>\
  71. % for code, name in cache.projects:
  72. % if code == selected_project:
  73. <option value="${code | h}" selected="selected">${name}</option>
  74. % else:
  75. <option value="${code | h}">${name}</option>
  76. % endif
  77. % endfor
  78. </select>
  79. <span class="mono">.org</span>
  80. </td>
  81. </tr>
  82. <tr>
  83. <td id="cv-col1">Page&nbsp;title:</td>
  84. <td id="cv-col2">
  85. % if query.title:
  86. <input class="cv-text" type="text" name="title" value="${query.page.title if query.page else query.title | h}" />
  87. % else:
  88. <input class="cv-text" type="text" name="title" />
  89. % endif
  90. </td>
  91. <td id="cv-col3">or&nbsp;revision&nbsp;ID:</td>
  92. <td id="cv-col4">
  93. % if query.oldid:
  94. <input class="cv-text" type="text" name="oldid" value="${query.oldid | h}" />
  95. % else:
  96. <input class="cv-text" type="text" name="oldid" />
  97. % endif
  98. </td>
  99. </tr>
  100. <tr>
  101. <td>Action:</td>
  102. <td colspan="3">
  103. <table id="cv-form-inner">
  104. <tr>
  105. <td id="cv-inner-col1">
  106. <input id="action-search" type="radio" name="action" value="search" ${'checked="checked"' if (query.action == "search" or not query.action) else ""} />
  107. </td>
  108. <td id="cv-inner-col2"><label for="action-search">Copyvio&nbsp;search:</label></td>
  109. <td id="cv-inner-col3">
  110. <input type="hidden" name="use_engine" value="0" />
  111. <input id="cv-cb-engine" class="cv-search" type="checkbox" name="use_engine" value="1" ${'checked="checked"' if query.use_engine not in ("0", "false") else ""} />
  112. <label for="cv-cb-engine">Use&nbsp;search&nbsp;engine</label>
  113. <input type="hidden" name="use_links" value="0" />
  114. <input id="cv-cb-links" class="cv-search" type="checkbox" name="use_links" value="1" ${'checked="checked"' if query.use_links not in ("0", "false") else ""} />
  115. <label for="cv-cb-links">Use&nbsp;links&nbsp;in&nbsp;page</label>
  116. <input type="hidden" name="turnitin" value="0" />
  117. <input id="cv-cb-turnitin" class="cv-search" type="checkbox" name="turnitin" value="1" ${'checked="checked"' if query.turnitin in ("1", "true") else ""}/>
  118. <label for="cv-cb-turnitin">Use&nbsp;Turnitin</label>
  119. </td>
  120. </tr>
  121. <tr>
  122. <td>
  123. <input id="action-compare" type="radio" name="action" value="compare" ${'checked="checked"' if query.action == "compare" else ""} />
  124. </td>
  125. <td><label for="action-compare">URL&nbsp;comparison:</label></td>
  126. <td>
  127. <input class="cv-compare cv-text" type="text" name="url"
  128. % if query.url:
  129. value="${query.url | h}"
  130. % endif
  131. />
  132. </td>
  133. </tr>
  134. </table>
  135. </td>
  136. </tr>
  137. % if query.nocache or (result and result.cached):
  138. <tr>
  139. <td><label for="cb-nocache">Bypass&nbsp;cache:</label></td>
  140. <td colspan="3">
  141. <input id="cb-nocache" type="checkbox" name="nocache" value="1" ${'checked="checked"' if query.nocache else ""} />
  142. </td>
  143. </tr>
  144. % endif
  145. <tr>
  146. <td colspan="4">
  147. <button type="submit">Submit</button>
  148. </td>
  149. </tr>
  150. </table>
  151. </form>
  152. % if result:
  153. <div id="generation-time">
  154. Results
  155. % if result.cached:
  156. <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
  157. % endif
  158. generated in <span class="mono">${round(result.time, 3)}</span>
  159. % if query.action == "search":
  160. seconds using <span class="mono">${result.queries}</span> quer${"y" if result.queries == 1 else "ies"}.
  161. % else:
  162. seconds.
  163. % endif
  164. <a href="${request.script_root | h}?lang=${query.lang | h}&amp;project=${query.project | h}&amp;oldid=${query.oldid or query.page.lastrevid | h}&amp;action=${query.action | h}&amp;${"use_engine={0}&use_links={1}".format(int(query.use_engine not in ("0", "false")), int(query.use_links not in ("0", "false"))) if query.action == "search" else "" | h}${"url=" if query.action == "compare" else ""}${query.url if query.action == "compare" else "" | u}">Permalink.</a>
  165. </div>
  166. % if query.turnitin:
  167. <div id="turnitin-container" class="${'red' if query.turnitin_result.reports else 'green'}-box">
  168. <div id="turnitin-title">Turnitin Results</div>
  169. % if query.turnitin_result.reports:
  170. <p>Turnitin (through <a href="https://en.wikipedia.org/wiki/User:EranBot">EranBot</a>) found revisions that may have been plagiarized. Please review them.</p>
  171. <table id="turnitin-table"><tbody>
  172. %for report in turnitin_result.reports:
  173. <tr><td id="turnitin-table-cell"><a href="https://tools.wmflabs.org/eranbot/ithenticate.py?rid=${report.reportid}">Turnitin report ${report.reportid}</a> for text added <a href="https://${query.lang}.wikipedia.org/w/index.php?title=${query.title}&diff=${report.diffid}"> at ${report.time_posted}</a>:
  174. <ul>
  175. % for source in report.sources:
  176. <li> ${source['percent']}% of revision text (${source['words']} words) found at <a href="${source['url']}">${source['url']}</a></li>
  177. % endfor
  178. </ul></td></tr>
  179. %endfor
  180. </tbody></table>
  181. % else:
  182. <p>Turnitin (through <a href="https://en.wikipedia.org/wiki/User:EranBot">EranBot</a>) found no matching sources.</p>
  183. % endif
  184. </div>
  185. % endif
  186. <div id="cv-result" class="${'red' if result.confidence >= T_SUSPECT else 'yellow' if result.confidence >= T_POSSIBLE else 'green'}-box">
  187. <table id="cv-result-head-table">
  188. <colgroup>
  189. <col>
  190. <col>
  191. <col>
  192. </colgroup>
  193. <tr>
  194. <td>
  195. <a href="${query.page.url}">${query.page.title | h}</a>
  196. % if query.oldid:
  197. @<a href="//${query.site.domain | h}/w/index.php?oldid=${query.oldid | h}">${query.oldid | h}</a>
  198. % endif
  199. % if query.redirected_from:
  200. <br />
  201. <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>
  202. % endif
  203. </td>
  204. <td>
  205. <div>
  206. % if result.confidence >= T_SUSPECT:
  207. Violation&nbsp;Suspected
  208. % elif result.confidence >= T_POSSIBLE:
  209. Violation&nbsp;Possible
  210. % elif result.sources:
  211. Violation&nbsp;Unlikely
  212. % else:
  213. No&nbsp;Violation
  214. % endif
  215. </div>
  216. <div>${round(result.confidence * 100, 1)}%</div>
  217. <div>confidence</div>
  218. </td>
  219. <td>
  220. % if result.url:
  221. <a href="${result.url | h}">${result.url | urlstrip, h}</a>
  222. % else:
  223. <span id="result-head-no-sources">No matches found.</span>
  224. % endif
  225. </td>
  226. </tr>
  227. </table>
  228. </div>
  229. % if query.action == "search":
  230. <% skips = False %>
  231. <div id="sources-container">
  232. <div id="sources-title">Checked Sources</div>
  233. % if result.sources:
  234. <table id="cv-result-sources">
  235. <colgroup>
  236. <col>
  237. <col>
  238. <col>
  239. </colgroup>
  240. <tr>
  241. <th>URL</th>
  242. <th>Confidence</th>
  243. <th>Compare</th>
  244. </tr>
  245. % for i, source in enumerate(result.sources):
  246. <tr ${'class="source-default-hidden"' if i >= 10 else 'id="source-row-selected"' if i == 0 else ""}>
  247. <td><a ${'id="source-selected"' if i == 0 else ""} class="source-url" href="${source.url | h}">${source.url | h}</a></td>
  248. <td>
  249. % if source.excluded:
  250. <span class="source-excluded">Excluded</span>
  251. % elif source.skipped:
  252. <% skips = True %>
  253. <span class="source-skipped">Skipped</span>
  254. % else:
  255. <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>
  256. % endif
  257. </td>
  258. <td>
  259. <a href="${request.script_root | h}?lang=${query.lang | h}&amp;project=${query.project | h}&amp;oldid=${query.oldid or query.page.lastrevid | h}&amp;action=compare&amp;url=${source.url | u}">Compare</a>
  260. </td>
  261. </tr>
  262. % endfor
  263. </table>
  264. % else:
  265. <div class="cv-source-footer">
  266. No sources checked.
  267. </div>
  268. % endif
  269. % if len(result.sources) > 10:
  270. <div id="cv-additional" class="cv-source-footer">
  271. ${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>
  272. </div>
  273. % endif
  274. % if skips or result.possible_miss:
  275. <div class="cv-source-footer">
  276. 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>
  277. </div>
  278. % endif
  279. </div>
  280. % endif
  281. <div id="cv-chain-container">
  282. <table id="cv-chain-table">
  283. <tr>
  284. <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>
  285. <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>
  286. </tr>
  287. </table>
  288. </div>
  289. % endif
  290. <%include file="/support/footer.mako"/>