mirror of https://github.com/zulip/zulip.git
templates: Clean up zephyr-mirror.html.
This allows us to eliminate conditionals related to ignoring files and checking indentation.
This commit is contained in:
parent
981a8d0189
commit
2134a26873
|
@ -5,30 +5,45 @@
|
|||
{% block portico_content %}
|
||||
<h1 style="margin-top:30px;">The Zephyr mirror script (not recommended)</h1>
|
||||
|
||||
<p>Webathena is the easiest way to use Zulip. With Webathena, you don't need
|
||||
to run any software in a screen session. Your Athena password never leaves
|
||||
your computer and the only access that any Zulip computer ever receives is the
|
||||
ability to send/receive zephyrs as you.</p>
|
||||
<p>
|
||||
Webathena is the easiest way to use Zulip. With Webathena, you don't need
|
||||
to run any software in a screen session. Your Athena password never leaves
|
||||
your computer and the only access that any Zulip computer ever receives is the
|
||||
ability to send/receive zephyrs as you.
|
||||
</p>
|
||||
|
||||
<p>We recommend that you use Webathena instead of following these instructions.
|
||||
Please only follow these instructions if you know that you want to run the zephyr
|
||||
mirror script instead of using Webathena.</p>
|
||||
<p>
|
||||
We recommend that you use Webathena instead of following these instructions.
|
||||
Please only follow these instructions if you know that you want to run the zephyr
|
||||
mirror script instead of using Webathena.
|
||||
</p>
|
||||
|
||||
<h3 id="mirror">Running the Zephyr mirror script</h3>
|
||||
<p>On an Athena dialup
|
||||
(<a href="https://linerva.mit.edu">linerva.mit.edu</a>,
|
||||
<a href="https://athena.dialup.mit.edu">athena.dialup.mit.edu</a>,
|
||||
etc.), run the Zephyr mirroring script inside a screen
|
||||
session.</p>
|
||||
<h3 id="mirror">Running the Zephyr mirror script</h3>
|
||||
|
||||
<p><strong>IMPORTANT: You must keep the Zephyr mirroring script
|
||||
always running in a session with unexpired Kerberos
|
||||
tickets.</strong> The script forwards personals you receive on
|
||||
Zephyr to Zulip, and forwards messages you send in Zulip to
|
||||
Zephyr. <strong>If it is not running, only other Zulip users
|
||||
will receive messages you send from Zulip!</strong>. The Zulip
|
||||
web application will warn you if the Zephyr mirroring script is
|
||||
not running.</p>
|
||||
<p>
|
||||
On an Athena dialup
|
||||
(<a href="https://linerva.mit.edu">linerva.mit.edu</a>,
|
||||
<a href="https://athena.dialup.mit.edu">athena.dialup.mit.edu</a>,
|
||||
etc.), run the Zephyr mirroring script inside a screen
|
||||
session.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>
|
||||
IMPORTANT: You must keep the Zephyr mirroring script
|
||||
always running in a session with unexpired Kerberos
|
||||
tickets.
|
||||
</strong>
|
||||
The script forwards personals you receive on
|
||||
Zephyr to Zulip, and forwards messages you send in Zulip to
|
||||
Zephyr.
|
||||
<strong>
|
||||
If it is not running, only other Zulip users
|
||||
will receive messages you send from Zulip!
|
||||
</strong>.
|
||||
The Zulip web application will warn you if the Zephyr
|
||||
mirroring script is not running.
|
||||
</p>
|
||||
|
||||
<p>If you already have BarnOwl running in screen/tmux somewhere,
|
||||
you can just run:</p>
|
||||
|
@ -39,36 +54,46 @@ mirror script instead of using Webathena.</p>
|
|||
|
||||
<h4>Mirroring without a BarnOwl session</h4>
|
||||
|
||||
<p>If you are not already running a screen/tmux for BarnOwl, you
|
||||
can set up a screen session to run the Zephyr mirroring script by
|
||||
running the following on a dialup such
|
||||
as <a href="https://linerva.mit.edu">linerva.mit.edu</a>:</p>
|
||||
|
||||
<ol>
|
||||
<li><code>kinit -l7d && aklog</code></li>
|
||||
<li>(Type your password to create 7-day renewable Kerberos tickets)</li>
|
||||
<li><code>env ZEPHYR_SCREEN_CLIENT=/mit/tabbott/zulip/zephyr_mirror.py
|
||||
SCREEN_SESSION_NAME=zulip athrun kchen owl-screen
|
||||
</code></li>
|
||||
</ol>
|
||||
|
||||
<p>This will run the Zephyr mirroring script inside a screen
|
||||
session, and use `/mit/kchen/bin/cont-renew-notify` to continually
|
||||
renew your Kerberos tickets for up to a week; each week, it will
|
||||
send you a Zephyr/Zulip letting you know that you need to renew
|
||||
your tickets. To do so, log in to the server that you set up the
|
||||
screen session on and use the following procedure:</p>
|
||||
<p>
|
||||
If you are not already running a screen/tmux for BarnOwl, you
|
||||
can set up a screen session to run the Zephyr mirroring script by
|
||||
running the following on a dialup such
|
||||
as <a href="https://linerva.mit.edu">linerva.mit.edu</a>:
|
||||
</p>
|
||||
|
||||
<ol>
|
||||
<li>Run <code>screen -x zulip</code> to connect to the mirroring
|
||||
screen session created above.</li>
|
||||
<li>The first time, you'll need to type <code>Ctrl-A c</code> to switch to a new terminal in your screen session.</li>
|
||||
<li><code>kinit -l7d && aklog</code></li>
|
||||
<li>(Type type your password to renew your Kerberos tickets).</li>
|
||||
<li><code>kinit -l7d && aklog</code></li>
|
||||
<li>(Type your password to create 7-day renewable Kerberos tickets)</li>
|
||||
<li>
|
||||
<code>env ZEPHYR_SCREEN_CLIENT=/mit/tabbott/zulip/zephyr_mirror.py
|
||||
SCREEN_SESSION_NAME=zulip athrun kchen owl-screen
|
||||
</code>
|
||||
</li>
|
||||
</ol>
|
||||
|
||||
<p>Don't run multiple copies of the Zephyr mirroring script;
|
||||
doing so will result in messages you sent being forwarded to
|
||||
Zephyr twice.</p>
|
||||
<p>
|
||||
This will run the Zephyr mirroring script inside a screen
|
||||
session, and use `/mit/kchen/bin/cont-renew-notify` to continually
|
||||
renew your Kerberos tickets for up to a week; each week, it will
|
||||
send you a Zephyr/Zulip letting you know that you need to renew
|
||||
your tickets. To do so, log in to the server that you set up the
|
||||
screen session on and use the following procedure:
|
||||
</p>
|
||||
|
||||
<ol>
|
||||
<li>
|
||||
Run <code>screen -x zulip</code> to connect to the mirroring
|
||||
screen session created above.
|
||||
</li>
|
||||
<li>The first time, you'll need to type <code>Ctrl-A c</code> to switch to a new terminal in your screen session.</li>
|
||||
<li><code>kinit -l7d && aklog</code></li>
|
||||
<li>(Type type your password to renew your Kerberos tickets).</li>
|
||||
</ol>
|
||||
|
||||
<p>
|
||||
Don't run multiple copies of the Zephyr mirroring script;
|
||||
doing so will result in messages you sent being forwarded to
|
||||
Zephyr twice.
|
||||
</p>
|
||||
|
||||
{% endblock %}
|
||||
|
|
|
@ -115,30 +115,11 @@ def check_html_templates(templates: Iterable[str], all_dups: bool, fix: bool) ->
|
|||
sys.exit(1)
|
||||
|
||||
for fn in templates:
|
||||
# Many of our Django templates have strange indentation. The
|
||||
# indentation errors are often harmless, even stylistically
|
||||
# harmless, but they tend to be in files that might be old
|
||||
# and might eventually require more scrutiny for things like
|
||||
# localization. See GitHub #1236.
|
||||
bad_files = [
|
||||
# These use various whitespace-dependent formatting that
|
||||
# prevent cleaning them.
|
||||
"templates/corporate/zephyr-mirror.html",
|
||||
]
|
||||
validate(fn=fn, check_indent=(fn not in bad_files))
|
||||
validate(fn)
|
||||
|
||||
# Ignore these files since these have not been cleaned yet :/
|
||||
IGNORE_FILES = [
|
||||
# zephyr-mirror.html has some whitespace-dependent formatting
|
||||
# for code blocks that prevent cleaning it. Might make sense
|
||||
# to convert it to a /help/ Markdown article.
|
||||
"templates/corporate/zephyr-mirror.html",
|
||||
]
|
||||
# TODO: Clean these files
|
||||
for fn in templates:
|
||||
if fn not in IGNORE_FILES:
|
||||
if not validate_indent_html(fn, fix):
|
||||
sys.exit(1)
|
||||
if not validate_indent_html(fn, fix):
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
def check_handlebar_templates(templates: Iterable[str], fix: bool) -> None:
|
||||
|
@ -146,7 +127,7 @@ def check_handlebar_templates(templates: Iterable[str], fix: bool) -> None:
|
|||
templates = [fn for fn in templates if fn.endswith(".hbs")]
|
||||
|
||||
for fn in templates:
|
||||
validate(fn=fn, check_indent=True)
|
||||
validate(fn)
|
||||
|
||||
for fn in templates:
|
||||
if not validate_indent_html(fn, fix):
|
||||
|
|
|
@ -242,9 +242,7 @@ def indent_level(s: str) -> int:
|
|||
return len(s) - len(s.lstrip())
|
||||
|
||||
|
||||
def validate(
|
||||
fn: Optional[str] = None, text: Optional[str] = None, check_indent: bool = True
|
||||
) -> None:
|
||||
def validate(fn: Optional[str] = None, text: Optional[str] = None) -> None:
|
||||
assert fn or text
|
||||
|
||||
if fn is None:
|
||||
|
@ -318,7 +316,7 @@ def validate(
|
|||
elif start_tag != end_tag:
|
||||
problem = "Mismatched tag."
|
||||
|
||||
if not problem and check_indent and (end_line > start_line + max_lines):
|
||||
if not problem and (end_line > start_line + max_lines):
|
||||
if end_col != start_col:
|
||||
problem = "Bad indentation."
|
||||
|
||||
|
|
|
@ -20,10 +20,9 @@ class ParserTest(unittest.TestCase):
|
|||
error: str,
|
||||
fn: Optional[str] = None,
|
||||
text: Optional[str] = None,
|
||||
check_indent: bool = True,
|
||||
) -> None:
|
||||
with self.assertRaisesRegex(TemplateParserException, error):
|
||||
validate(fn=fn, text=text, check_indent=check_indent)
|
||||
validate(fn=fn, text=text)
|
||||
|
||||
def test_is_django_block_tag(self) -> None:
|
||||
self.assertTrue(is_django_block_tag("block"))
|
||||
|
@ -93,7 +92,7 @@ class ParserTest(unittest.TestCase):
|
|||
foo
|
||||
</p>
|
||||
"""
|
||||
self._assert_validate_error("Bad indentation.", text=my_html, check_indent=True)
|
||||
self._assert_validate_error("Bad indentation.", text=my_html)
|
||||
|
||||
def test_validate_state_depth(self) -> None:
|
||||
my_html = """
|
||||
|
|
Loading…
Reference in New Issue