A copyright violation detector running on Wikimedia Cloud Services https://tools.wmflabs.org/copyvios/
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 
 
 

114 строки
6.1 KiB

  1. <%!
  2. from json import dumps, loads
  3. from flask import g, request
  4. from copyvios.settings import main
  5. %>\
  6. <% bot, status, langs, projects = main() %>\
  7. <%include file="/support/header.mako" args="title='Settings - Earwig\'s Copyvio Detector'"/>
  8. % if status:
  9. <div id="info-box" class="green-box">
  10. <p>${status}</p>
  11. </div>
  12. % endif
  13. <p>This page contains some configurable options for the copyvio detector. Settings are saved as cookies. You can view and delete all cookies generated by this site at the bottom of this page.</p>
  14. <form action="${request.base_url}" method="post">
  15. <table>
  16. <tr>
  17. <td>Default site:</td>
  18. <td>
  19. <span class="mono">http://</span>
  20. <select name="lang">
  21. <% selected_lang = g.cookies["CopyviosDefaultLang"].value if "CopyviosDefaultLang" in g.cookies else bot.wiki.get_site().lang %>\
  22. % for code, name in langs:
  23. % if code == selected_lang:
  24. <option value="${code | h}" selected="selected">${name}</option>
  25. % else:
  26. <option value="${code | h}">${name}</option>
  27. % endif
  28. % endfor
  29. </select>
  30. <span class="mono">.</span>
  31. <select name="project">
  32. <% selected_project = g.cookies["CopyviosDefaultProject"].value if "CopyviosDefaultProject" in g.cookies else bot.wiki.get_site().project %>\
  33. % for code, name in projects:
  34. % if code == selected_project:
  35. <option value="${code | h}" selected="selected">${name}</option>
  36. % else:
  37. <option value="${code | h}">${name}</option>
  38. % endif
  39. % endfor
  40. </select>
  41. <span class="mono">.org</span>
  42. </td>
  43. </tr>
  44. <%
  45. background_options = [
  46. ("list", 'Randomly select from <a href="http://commons.wikimedia.org/wiki/User:The_Earwig/POTD">a subset</a> of previous <a href="//commons.wikimedia.org/">Wikimedia Commons</a> <a href="//commons.wikimedia.org/wiki/Commons:Picture_of_the_day">Pictures of the Day</a> that work well as widescreen backgrounds, refreshed daily (default).'),
  47. ("potd", 'Use the current Commons Picture of the Day, unfiltered. Certain POTDs may be unsuitable as backgrounds due to their aspect ratio or subject matter.'),
  48. ("plain", "Use a plain background."),
  49. ]
  50. selected = g.cookies["CopyviosBackground"].value if "CopyviosBackground" in g.cookies else "list"
  51. %>\
  52. % for i, (value, desc) in enumerate(background_options):
  53. <tr>
  54. % if i == 0:
  55. <td>Background:</td>
  56. % else:
  57. <td>&nbsp;</td>
  58. % endif
  59. <td>
  60. <input type="radio" name="background" value="${value}" ${'checked="checked"' if value == selected else ''} /> ${desc}
  61. </td>
  62. </tr>
  63. % endfor
  64. <tr>
  65. <td colspan="2">
  66. <input type="hidden" name="action" value="set"/>
  67. <button type="submit">Save</button>
  68. </td>
  69. </tr>
  70. </table>
  71. </form>
  72. <h2>Cookies</h2>
  73. % if g.cookies:
  74. <table>
  75. <% cookie_order = ["CopyviosDefaultProject", "CopyviosDefaultLang", "CopyviosBackground", "CopyviosShowDetails", "CopyviosScreenCache"] %>\
  76. % for key in [key for key in cookie_order if key in g.cookies]:
  77. <% cookie = g.cookies[key] %>\
  78. <tr>
  79. <td><b><span class="mono">${key | h}</span></b></td>
  80. % try:
  81. <% lines = dumps(loads(cookie.value), indent=4).splitlines() %>\
  82. <td>
  83. % for line in lines:
  84. <span class="mono"><div class="indentable">${line | h}</div></span>
  85. % endfor
  86. </td>
  87. % except ValueError:
  88. <td><span class="mono">${cookie.value | h}</span></td>
  89. % endtry
  90. <td>
  91. <form action="${request.base_url}" method="post">
  92. <input type="hidden" name="action" value="delete">
  93. <input type="hidden" name="cookie" value="${key | h}">
  94. <button type="submit">Delete</button>
  95. </form>
  96. </td>
  97. </tr>
  98. % endfor
  99. <tr>
  100. <td>
  101. <form action="${request.base_url}" method="post">
  102. <input type="hidden" name="action" value="delete">
  103. <input type="hidden" name="all" value="1">
  104. <button type="submit">Delete all</button>
  105. </form>
  106. </td>
  107. </tr>
  108. </table>
  109. % else:
  110. <p>No cookies!</p>
  111. % endif
  112. <%include file="/support/footer.mako"/>