parent
1468c1c66c
commit
6ea91c3b0e
10
README.md
10
README.md
|
@ -1,4 +1,4 @@
|
||||||
# Siftie Snippets
|
# Snipt
|
||||||
|
|
||||||
## Running locally
|
## Running locally
|
||||||
|
|
||||||
|
@ -31,9 +31,9 @@
|
||||||
|
|
||||||
## Automatic deploy to Heroku
|
## Automatic deploy to Heroku
|
||||||
|
|
||||||
You can click the button below to automatically deploy Siftie Snippets to Heroku.
|
You can click the button below to automatically deploy Snipt to Heroku.
|
||||||
|
|
||||||
[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy?template=https://github.com/siftie/snippets)
|
[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy?template=https://github.com/nicksergeant/snipt)
|
||||||
|
|
||||||
## Manual deploy to Heroku
|
## Manual deploy to Heroku
|
||||||
|
|
||||||
|
@ -49,8 +49,8 @@ You can click the button below to automatically deploy Siftie Snippets to Heroku
|
||||||
|
|
||||||
## Updating your Heroku instance after an automatic deploy
|
## Updating your Heroku instance after an automatic deploy
|
||||||
|
|
||||||
- `git clone https://github.com/siftie/snippets`
|
- `git clone https://github.com/nicksergeant/snipt`
|
||||||
- `cd snippets`
|
- `cd snipt`
|
||||||
- `git checkout heroku`
|
- `git checkout heroku`
|
||||||
- `heroku git:remote -a <your-instance-name>`
|
- `heroku git:remote -a <your-instance-name>`
|
||||||
- `git push heroku heroku:master`
|
- `git push heroku heroku:master`
|
||||||
|
|
|
@ -97,11 +97,11 @@ class UserProfile(models.Model):
|
||||||
|
|
||||||
# Otherwise, if they have blog posts, use their Snipt blog URL.
|
# Otherwise, if they have blog posts, use their Snipt blog URL.
|
||||||
elif self.get_blog_posts():
|
elif self.get_blog_posts():
|
||||||
url = "https://{}.snippets.siftie.com/".format(self.user.username)
|
url = 'https://{}.snipt.net/'.format(self.user.username)
|
||||||
|
|
||||||
# Otherwise, use their regular Snipt profile page.
|
# Otherwise, use their regular Snipt profile page.
|
||||||
else:
|
else:
|
||||||
url = "https://snippets.siftie.com/{}/".format(self.user.username)
|
url = 'https://snipt.net/{}/'.format(self.user.username)
|
||||||
|
|
||||||
return url
|
return url
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
<table class="table">
|
<table class="table">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Snippet</th>
|
<th>Snipt</th>
|
||||||
<th>Views</th>
|
<th>Views</th>
|
||||||
<th>Favs</th>
|
<th>Favs</th>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
6
app.json
6
app.json
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "Siftie Snippets",
|
"name": "Snipt",
|
||||||
"description": "Code snippets for teams and individuals.",
|
"description": "Code snippets for teams and individuals.",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"snipt",
|
"snipt",
|
||||||
"code snippets"
|
"code snippets"
|
||||||
],
|
],
|
||||||
"website": "https://snippets.siftie.com",
|
"website": "https://snipt.net",
|
||||||
"repository": "https://github.com/siftie/snippets",
|
"repository": "https://github.com/nicksergeant/snipt",
|
||||||
"logo": "https://snipt.s3.amazonaws.com/logo.png",
|
"logo": "https://snipt.s3.amazonaws.com/logo.png",
|
||||||
"success_url": "/",
|
"success_url": "/",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
|
@ -8,14 +8,12 @@ class BlogMiddleware:
|
||||||
def process_request(self, request):
|
def process_request(self, request):
|
||||||
request.blog_user = None
|
request.blog_user = None
|
||||||
|
|
||||||
host = request.META.get("HTTP_HOST", "")
|
host = request.META.get('HTTP_HOST', '')
|
||||||
host_s = host.replace("www.", "").split(".")
|
host_s = host.replace('www.', '').split('.')
|
||||||
|
|
||||||
if (
|
if host != 'snipt.net' and \
|
||||||
host != "snippets.siftie.com"
|
host != 'snipt.localhost' and \
|
||||||
and host != "snipt.localhost"
|
host != 'local.snipt.net':
|
||||||
and host != "local.snippets.siftie.com"
|
|
||||||
):
|
|
||||||
if len(host_s) > 2:
|
if len(host_s) > 2:
|
||||||
if host_s[1] == "snipt":
|
if host_s[1] == "snipt":
|
||||||
|
|
||||||
|
|
|
@ -76,7 +76,7 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<nav class="footer {% if sidebar %}with-sidebar{% endif %}">
|
<nav class="footer {% if sidebar %}with-sidebar{% endif %}">
|
||||||
<ul class="powered">
|
<ul class="powered">
|
||||||
<li class="snipt"><a href="https://snippets.siftie.com/blogging/">Blog powered by Siftie Snippets</a></li>
|
<li class="snipt"><a href="https://snipt.net/blogging/">Blog powered by Snipt</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
</aside>
|
</aside>
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
|
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
|
||||||
<channel>
|
<channel>
|
||||||
<atom:link href="{% if request.blog_user.profile.get_primary_blog_domain and request.blog_user.profile.blog_domain != '' %}http://{{ request.blog_user.profile.blog_domain }}/?rss{% else %}https://{{ request.blog_user.username }}.snippets.siftie.com/?rss{% endif %}" rel="self" type="application/rss+xml" />
|
<atom:link href="{% if request.blog_user.profile.get_primary_blog_domain and request.blog_user.profile.blog_domain != '' %}http://{{ request.blog_user.profile.blog_domain }}/?rss{% else %}https://{{ request.blog_user.username }}.snipt.net/?rss{% endif %}" rel="self" type="application/rss+xml" />
|
||||||
<description>{% firstof request.blog_user.profile.blog_title request.blog_user.username %}</description>
|
<description>{% firstof request.blog_user.profile.blog_title request.blog_user.username %}</description>
|
||||||
<title>{% firstof request.blog_user.profile.blog_title request.blog_user.username %}</title>
|
<title>{% firstof request.blog_user.profile.blog_title request.blog_user.username %}</title>
|
||||||
<link>{% if request.blog_user.profile.get_primary_blog_domain %}http://{{ request.blog_user.profile.blog_domain }}/?rss{% else %}https://{{ request.blog_user.username }}.snippets.siftie.com/?rss{% endif %}</link>
|
<link>{% if request.blog_user.profile.get_primary_blog_domain %}http://{{ request.blog_user.profile.blog_domain }}/?rss{% else %}https://{{ request.blog_user.username }}.snipt.net/?rss{% endif %}</link>
|
||||||
{% for snipt in snipts %}
|
{% for snipt in snipts %}
|
||||||
<item>
|
<item>
|
||||||
<title>{{ snipt.title }}</title>
|
<title>{{ snipt.title }}</title>
|
||||||
|
@ -11,7 +11,7 @@
|
||||||
<description><![CDATA[{{ snipt.stylized|safe }}]]></description>
|
<description><![CDATA[{{ snipt.stylized|safe }}]]></description>
|
||||||
<tags>{% for tag in snipt.tags.all %}{{ tag }}{% if not forloop.last %}, {% endif %}{% endfor %}</tags>
|
<tags>{% for tag in snipt.tags.all %}{{ tag }}{% if not forloop.last %}, {% endif %}{% endfor %}</tags>
|
||||||
<pubDate>{{ snipt.created|date:"r" }}</pubDate>
|
<pubDate>{{ snipt.created|date:"r" }}</pubDate>
|
||||||
<guid isPermaLink="false">siftie-snippets-com-{{ snipt.id }}</guid>
|
<guid isPermaLink="false">snipt-net-{{ snipt.id }}</guid>
|
||||||
</item>
|
</item>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</channel>
|
</channel>
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
<label class="control-label" for="id_blog_domain">Blog domain:</label>
|
<label class="control-label" for="id_blog_domain">Blog domain:</label>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<input id="id_blog_domain" type="text" ng-model="user.blog_domain" maxlength="250">
|
<input id="id_blog_domain" type="text" ng-model="user.blog_domain" maxlength="250">
|
||||||
<span class="help-block">Like 'snipt.nicksergeant.com' or 'nicksergeant.com' (without quotes). Set your CNAME to `snippets.siftie.com` or A-record to `96.126.110.160`. You can use multiple domains here: separate each domain with a space. The first domain will be your primary domain. All other domains will redirect to your primary domain.</span>
|
<span class="help-block">Like 'snipt.nicksergeant.com' or 'nicksergeant.com' (without quotes). Set your CNAME to `snipt.net` or A-record to `96.126.110.160`. You can use multiple domains here: separate each domain with a space. The first domain will be your primary domain. All other domains will redirect to your primary domain.</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
37
settings.py
37
settings.py
|
@ -8,29 +8,22 @@ if "DATABASE_URL" in os.environ:
|
||||||
|
|
||||||
ABSOLUTE_URL_OVERRIDES = {"auth.user": lambda u: "/%s/" % u.username}
|
ABSOLUTE_URL_OVERRIDES = {"auth.user": lambda u: "/%s/" % u.username}
|
||||||
ACCOUNT_ACTIVATION_DAYS = 0
|
ACCOUNT_ACTIVATION_DAYS = 0
|
||||||
ADMINS = (("Siftie", "team@siftie.com"),)
|
ADMINS = (('Nick Sergeant', 'nick@snipt.net'),)
|
||||||
ALLOWED_HOSTS = ["*"]
|
ALLOWED_HOSTS = ['*']
|
||||||
AUTH_PROFILE_MODULE = "accounts.UserProfile"
|
AUTH_PROFILE_MODULE = 'accounts.UserProfile'
|
||||||
AUTHENTICATION_BACKENDS = ("utils.backends.EmailOrUsernameModelBackend",)
|
AUTHENTICATION_BACKENDS = ('utils.backends.EmailOrUsernameModelBackend',)
|
||||||
BASE_PATH = os.path.dirname(__file__)
|
BASE_PATH = os.path.dirname(__file__)
|
||||||
CSRF_COOKIE_SECURE = True if "USE_SSL" in os.environ else False
|
CSRF_COOKIE_SECURE = True if "USE_SSL" in os.environ else False
|
||||||
CORS_ORIGIN_ALLOW_ALL = True
|
CORS_ORIGIN_ALLOW_ALL = True
|
||||||
DEBUG = True if "DEBUG" in os.environ else False
|
DEBUG = True if 'DEBUG' in os.environ else False
|
||||||
DEFAULT_FROM_EMAIL = os.environ.get("POSTMARK_EMAIL", "team@siftie.com")
|
DEFAULT_FROM_EMAIL = os.environ.get('POSTMARK_EMAIL', 'support@snipt.net')
|
||||||
EMAIL_BACKEND = "postmark.django_backend.EmailBackend"
|
EMAIL_BACKEND = 'postmark.django_backend.EmailBackend'
|
||||||
# HAYSTACK_CONNECTIONS = {
|
HAYSTACK_SIGNAL_PROCESSOR = 'haystack.signals.RealtimeSignalProcessor'
|
||||||
# "default": {
|
INTERNAL_IPS = ('127.0.0.1',)
|
||||||
# "ENGINE": "haystack.backends.whoosh_backend.WhooshEngine",
|
LANGUAGE_CODE = 'en-us'
|
||||||
# "PATH": os.environ.get("WHOOSH_PATH", "./.whoosh_index"),
|
LOGIN_REDIRECT_URL = '/login-redirect/'
|
||||||
# "STORAGE": "file",
|
LOGIN_URL = '/login/'
|
||||||
# }
|
LOGOUT_URL = '/logout/'
|
||||||
# }
|
|
||||||
# HAYSTACK_SIGNAL_PROCESSOR = "haystack.signals.RealtimeSignalProcessor"
|
|
||||||
INTERNAL_IPS = ("127.0.0.1",)
|
|
||||||
LANGUAGE_CODE = "en-us"
|
|
||||||
LOGIN_REDIRECT_URL = "/login-redirect/"
|
|
||||||
LOGIN_URL = "/login/"
|
|
||||||
LOGOUT_URL = "/logout/"
|
|
||||||
MANAGERS = ADMINS
|
MANAGERS = ADMINS
|
||||||
MEDIA_ROOT = os.path.join(BASE_PATH, "media/uploads")
|
MEDIA_ROOT = os.path.join(BASE_PATH, "media/uploads")
|
||||||
MEDIA_URL = "/media/uploads/"
|
MEDIA_URL = "/media/uploads/"
|
||||||
|
@ -52,7 +45,7 @@ SECRET_KEY = os.environ.get("SECRET_KEY", "changeme")
|
||||||
SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https")
|
SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https")
|
||||||
SECURE_SSL_REDIRECT = True if "USE_SSL" in os.environ else False
|
SECURE_SSL_REDIRECT = True if "USE_SSL" in os.environ else False
|
||||||
SEND_BROKEN_LINK_EMAILS = False
|
SEND_BROKEN_LINK_EMAILS = False
|
||||||
SERVER_EMAIL = os.environ.get("POSTMARK_EMAIL", "team@siftie.com")
|
SERVER_EMAIL = os.environ.get('POSTMARK_EMAIL', 'support@snipt.net')
|
||||||
SESSION_COOKIE_AGE = 15801100
|
SESSION_COOKIE_AGE = 15801100
|
||||||
SESSION_COOKIE_SECURE = True if "USE_SSL" in os.environ else False
|
SESSION_COOKIE_SECURE = True if "USE_SSL" in os.environ else False
|
||||||
SITE_ID = 1
|
SITE_ID = 1
|
||||||
|
@ -65,7 +58,7 @@ STATICFILES_STORAGE = "whitenoise.django.GzipManifestStaticFilesStorage"
|
||||||
STATIC_ROOT = os.path.join(BASE_PATH, "static")
|
STATIC_ROOT = os.path.join(BASE_PATH, "static")
|
||||||
STATIC_URL = "/static/"
|
STATIC_URL = "/static/"
|
||||||
TASTYPIE_CANNED_ERROR = """There was an error with your request. The site
|
TASTYPIE_CANNED_ERROR = """There was an error with your request. The site
|
||||||
developers have a record of this error, please email team@siftie.com and
|
developers have a record of this error, please email api@snipt.net and
|
||||||
we'll help you out."""
|
we'll help you out."""
|
||||||
|
|
||||||
TEMPLATES = [
|
TEMPLATES = [
|
||||||
|
|
|
@ -8,13 +8,8 @@ import requests
|
||||||
|
|
||||||
|
|
||||||
def get_snipts(api_key, from_username, url=None, snipts=[]):
|
def get_snipts(api_key, from_username, url=None, snipts=[]):
|
||||||
path = (
|
path = url or '/api/private/snipt/?limit=50&api_key={}&username={}&format=json'.format(api_key, from_username)
|
||||||
url
|
res = requests.get('https://snipt.net' + path)
|
||||||
or "/api/private/snipt/?limit=50&api_key={}&username={}&format=json".format(
|
|
||||||
api_key, from_username
|
|
||||||
)
|
|
||||||
)
|
|
||||||
res = requests.get("https://snippets.siftie.com" + path)
|
|
||||||
json = res.json()
|
json = res.json()
|
||||||
|
|
||||||
print(
|
print(
|
||||||
|
@ -34,7 +29,7 @@ def get_snipts(api_key, from_username, url=None, snipts=[]):
|
||||||
|
|
||||||
|
|
||||||
class Command(BaseCommand):
|
class Command(BaseCommand):
|
||||||
help = u"Import snipts from Siftie Snippets."
|
help = u"Import snipts from snipt.net."
|
||||||
|
|
||||||
def add_arguments(self, parser):
|
def add_arguments(self, parser):
|
||||||
parser.add_argument("api_key", nargs="+", type=str)
|
parser.add_argument("api_key", nargs="+", type=str)
|
||||||
|
|
|
@ -83,13 +83,12 @@ class Snipt(models.Model):
|
||||||
if self.lexer == "markdown":
|
if self.lexer == "markdown":
|
||||||
self.stylized = markdown(self.code, "default")
|
self.stylized = markdown(self.code, "default")
|
||||||
|
|
||||||
# Snippet embeds
|
# Snipt embeds
|
||||||
for match in re.findall("\[\[(\w{32})\]\]", self.stylized):
|
for match in re.findall('\[\[(\w{32})\]\]', self.stylized):
|
||||||
self.stylized = self.stylized.replace(
|
self.stylized = self.stylized.replace('[[' + str(match) + ']]',
|
||||||
"[[" + str(match) + "]]",
|
"""
|
||||||
"""
|
|
||||||
<script type="text/javascript"
|
<script type="text/javascript"
|
||||||
src="https://snippets.siftie.com/embed/{}/?snipt">
|
src="https://snipt.net/embed/{}/?snipt">
|
||||||
</script>
|
</script>
|
||||||
<div id="snipt-embed-{}"></div>""".format(
|
<div id="snipt-embed-{}"></div>""".format(
|
||||||
match, match
|
match, match
|
||||||
|
@ -134,10 +133,10 @@ class Snipt(models.Model):
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
# Parse usernames
|
# Parse Snipt usernames
|
||||||
for match in re.findall("@(\w+) ", self.stylized):
|
for match in re.findall('@(\w+) ', self.stylized):
|
||||||
|
|
||||||
# Try and get the user by username.
|
# Try and get the Snipt user by username.
|
||||||
user = get_object_or_None(User, username=match)
|
user = get_object_or_None(User, username=match)
|
||||||
|
|
||||||
if user:
|
if user:
|
||||||
|
@ -228,9 +227,8 @@ class Snipt(models.Model):
|
||||||
self.user.profile.blog_domain.split(" ")[0], self.slug
|
self.user.profile.blog_domain.split(" ")[0], self.slug
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
return u"https://{}.snippets.siftie.com/{}/".format(
|
return u'https://{}.snipt.net/{}/'.format(
|
||||||
self.user.username.replace("_", "-"), self.slug
|
self.user.username.replace('_', '-'), self.slug)
|
||||||
)
|
|
||||||
|
|
||||||
if self.custom_slug:
|
if self.custom_slug:
|
||||||
return u"/{}/".format(self.custom_slug)
|
return u"/{}/".format(self.custom_slug)
|
||||||
|
@ -248,9 +246,8 @@ class Snipt(models.Model):
|
||||||
self.user.profile.blog_domain.split(" ")[0], self.slug
|
self.user.profile.blog_domain.split(" ")[0], self.slug
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
return u"https://{}.snippets.siftie.com/{}/".format(
|
return u'https://{}.snipt.net/{}/'.format(
|
||||||
self.user.username, self.slug
|
self.user.username, self.slug)
|
||||||
)
|
|
||||||
|
|
||||||
if self.public:
|
if self.public:
|
||||||
return u"/{}/{}/".format(self.user.username, self.slug)
|
return u"/{}/{}/".format(self.user.username, self.slug)
|
||||||
|
@ -277,9 +274,9 @@ class Snipt(models.Model):
|
||||||
def get_embed_url(self):
|
def get_embed_url(self):
|
||||||
|
|
||||||
if settings.DEBUG:
|
if settings.DEBUG:
|
||||||
root = "http://local.snippets.siftie.com"
|
root = 'http://local.snipt.net'
|
||||||
else:
|
else:
|
||||||
root = "https://snippets.siftie.com"
|
root = 'https://snipt.net'
|
||||||
|
|
||||||
return "{}/embed/{}/".format(root, self.key)
|
return "{}/embed/{}/".format(root, self.key)
|
||||||
|
|
||||||
|
@ -311,7 +308,7 @@ class Snipt(models.Model):
|
||||||
|
|
||||||
|
|
||||||
class SniptLogEntry(models.Model):
|
class SniptLogEntry(models.Model):
|
||||||
"""An individual log entry for a snippet changeset."""
|
"""An individual log entry for a Snipt changeset."""
|
||||||
|
|
||||||
user = models.ForeignKey(User, on_delete=models.CASCADE)
|
user = models.ForeignKey(User, on_delete=models.CASCADE)
|
||||||
snipt = models.ForeignKey(Snipt, on_delete=models.CASCADE)
|
snipt = models.ForeignKey(Snipt, on_delete=models.CASCADE)
|
||||||
|
@ -328,7 +325,7 @@ class SniptLogEntry(models.Model):
|
||||||
|
|
||||||
|
|
||||||
class SniptSecureView(models.Model):
|
class SniptSecureView(models.Model):
|
||||||
"""A single view to a secure snippet."""
|
"""A single view to a secure snipt."""
|
||||||
|
|
||||||
user = models.ForeignKey(User, on_delete=models.CASCADE)
|
user = models.ForeignKey(User, on_delete=models.CASCADE)
|
||||||
snipt = models.ForeignKey(Snipt, on_delete=models.CASCADE)
|
snipt = models.ForeignKey(Snipt, on_delete=models.CASCADE)
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
{% if 'snipt' in request.GET %}document.addEventListener('DOMContentLoaded', function() { document.getElementById('snipt-embed-{{ snipt.key }}').innerHTML = '<div class="snipt-embed" onmouseover="document.getElementById(\'snipt-flag-{{ snipt.id }}\').style.display = \'block\'; return false;" onmouseout="document.getElementById(\'snipt-flag-{{ snipt.id }}\').style.display = \'none\'; return false;" style="position: relative;">{% for line in lines %}{{ line|safe }}\n{% endfor %}<div style="background-color: #111; color: #D0D0D0; float: right; padding: 5px 10px; -moz-border-radius-topleft: 5px; -webkit-border-top-left-radius: 5px; border-top-left-radius: 5px; -moz-border-radius-bottomright: 5px; -webkit-border-bottom-right-radius: 5px; border-bottom-right-radius: 5px; font: 11px Arial,Sans-Serif; display: none; position: absolute; bottom: 0; right: 0;" id="snipt-flag-{{ snipt.id }}">code hosted by <a href="https://snippets.siftie.com/{{ snipt.user }}/{{ snipt.slug }}{% if not snipt.public %}?key={{ snipt.key }}{% endif %}" style="color: #0084FF; text-decoration: none;">snippets.siftie.com</a></div></div>'; });
|
{% if 'snipt' in request.GET %}document.addEventListener('DOMContentLoaded', function() { document.getElementById('snipt-embed-{{ snipt.key }}').innerHTML = '<div class="snipt-embed" onmouseover="document.getElementById(\'snipt-flag-{{ snipt.id }}\').style.display = \'block\'; return false;" onmouseout="document.getElementById(\'snipt-flag-{{ snipt.id }}\').style.display = \'none\'; return false;" style="position: relative;">{% for line in lines %}{{ line|safe }}\n{% endfor %}<div style="background-color: #111; color: #D0D0D0; float: right; padding: 5px 10px; -moz-border-radius-topleft: 5px; -webkit-border-top-left-radius: 5px; border-top-left-radius: 5px; -moz-border-radius-bottomright: 5px; -webkit-border-bottom-right-radius: 5px; border-bottom-right-radius: 5px; font: 11px Arial,Sans-Serif; display: none; position: absolute; bottom: 0; right: 0;" id="snipt-flag-{{ snipt.id }}">code hosted by <a href="https://snipt.net/{{ snipt.user }}/{{ snipt.slug }}{% if not snipt.public %}?key={{ snipt.key }}{% endif %}" style="color: #0084FF; text-decoration: none;">snipt.net</a></div></div>'; });
|
||||||
{% else %}document.open();document.writeln('<div class="snipt-embed" onmouseover="document.getElementById(\'snipt-{{ snipt.id }}\').style.display = \'block\'; return false;" onmouseout="document.getElementById(\'snipt-{{ snipt.id }}\').style.display = \'none\'; return false;" style="position: relative;">');{% for line in lines %}document.writeln('{{ line|safe }}');{% endfor %}document.writeln('<div style="background-color: #111; color: #D0D0D0; float: right; padding: 5px 10px; -moz-border-radius-topleft: 5px; -webkit-border-top-left-radius: 5px; border-top-left-radius: 5px; -moz-border-radius-bottomright: 5px; -webkit-border-bottom-right-radius: 5px; border-bottom-right-radius: 5px; font: 11px Arial,Sans-Serif; display: none; position: absolute; bottom: 0; right: 0;" id="snipt-{{ snipt.id }}">code hosted by <a href="https://snippets.siftie.com/{{ snipt.user }}/{{ snipt.slug }}{% if not snipt.public %}?key={{ snipt.key }}{% endif %}" style="color: #0084FF; text-decoration: none;">snippets.siftie.com</a></div>');document.writeln('</div>');document.close();{% endif %}
|
{% else %}document.open();document.writeln('<div class="snipt-embed" onmouseover="document.getElementById(\'snipt-{{ snipt.id }}\').style.display = \'block\'; return false;" onmouseout="document.getElementById(\'snipt-{{ snipt.id }}\').style.display = \'none\'; return false;" style="position: relative;">');{% for line in lines %}document.writeln('{{ line|safe }}');{% endfor %}document.writeln('<div style="background-color: #111; color: #D0D0D0; float: right; padding: 5px 10px; -moz-border-radius-topleft: 5px; -webkit-border-top-left-radius: 5px; border-top-left-radius: 5px; -moz-border-radius-bottomright: 5px; -webkit-border-bottom-right-radius: 5px; border-bottom-right-radius: 5px; font: 11px Arial,Sans-Serif; display: none; position: absolute; bottom: 0; right: 0;" id="snipt-{{ snipt.id }}">code hosted by <a href="https://snipt.net/{{ snipt.user }}/{{ snipt.slug }}{% if not snipt.public %}?key={{ snipt.key }}{% endif %}" style="color: #0084FF; text-decoration: none;">snipt.net</a></div>');document.writeln('</div>');document.close();{% endif %}
|
||||||
|
|
|
@ -27,10 +27,10 @@
|
||||||
{% empty %}
|
{% empty %}
|
||||||
<div class="empty-snipts">
|
<div class="empty-snipts">
|
||||||
{% if request.user == user and not request.user.is_active and not public %}
|
{% if request.user == user and not request.user.is_active and not public %}
|
||||||
Welcome! Please <a target="_self" href="/account/activate/">activate your account</a> to create your first snippet.
|
Welcome! Please <a target="_self" href="/account/activate/">activate your account</a> to create your first snipt.
|
||||||
{% else %}
|
{% else %}
|
||||||
{% if request.user == user and request.user.is_authenticated %}
|
{% if request.user == user and request.user.is_authenticated %}
|
||||||
Welcome! Create your first snippet by clicking "Add Snippet" above.
|
Welcome! Create your first snipt by clicking "Add Snipt" above.
|
||||||
{% else %}
|
{% else %}
|
||||||
No snipts to show here. Sorry!
|
No snipts to show here. Sorry!
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
@ -44,10 +44,10 @@
|
||||||
{% empty %}
|
{% empty %}
|
||||||
<div class="empty-snipts">
|
<div class="empty-snipts">
|
||||||
{% if request.user == user and not request.user.is_active and not public %}
|
{% if request.user == user and not request.user.is_active and not public %}
|
||||||
Welcome! Please <a target="_self" href="/account/activate/">activate your account</a> to create your first snippet.
|
Welcome! Please <a target="_self" href="/account/activate/">activate your account</a> to create your first snipt.
|
||||||
{% else %}
|
{% else %}
|
||||||
{% if request.user == user and request.user.is_authenticated %}
|
{% if request.user == user and request.user.is_authenticated %}
|
||||||
Welcome! Create your first snippet by clicking "Add Snippet" above.
|
Welcome! Create your first snipt by clicking "Add Snipt" above.
|
||||||
{% else %}
|
{% else %}
|
||||||
No snipts to show here. Sorry!
|
No snipts to show here. Sorry!
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
@ -70,7 +70,7 @@
|
||||||
Private snipts do not appear in the public listing, but are accessible via the direct URL.
|
Private snipts do not appear in the public listing, but are accessible via the direct URL.
|
||||||
</div>
|
</div>
|
||||||
<div class="info public">
|
<div class="info public">
|
||||||
Public snipts are accessible by all Siftie Snippets users and appear in the public listing.
|
Public snipts are accessible by all Snipt.net users and appear in the public listing.
|
||||||
</div>
|
</div>
|
||||||
</label>
|
</label>
|
||||||
<label class="secure">
|
<label class="secure">
|
||||||
|
|
|
@ -213,7 +213,7 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if detail and snipt.public %}
|
{% if detail and snipt.public %}
|
||||||
<li class="tweet">
|
<li class="tweet">
|
||||||
<a href="https://twitter.com/share" class="twitter-share-button" data-dnt="true" data-count="none" data-url="{{ snipt.get_full_absolute_url }}" data-text="“{{ snipt.title }}” on @SiftieSnippets">Tweet</a>
|
<a href="https://twitter.com/share" class="twitter-share-button" data-dnt="true" data-count="none" data-url="{{ snipt.get_full_absolute_url }}" data-text="“{{ snipt.title }}” on @Snipt">Tweet</a>
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -11,36 +11,34 @@ class SniptResourceTest(ResourceTestCase):
|
||||||
super(SniptResourceTest, self).setUp()
|
super(SniptResourceTest, self).setUp()
|
||||||
|
|
||||||
# Johnny
|
# Johnny
|
||||||
self.johnny = User.objects.create_user(
|
self.johnny = User.objects.create_user('johnny', 'johnny@snipt.net',
|
||||||
"johnny", "johnny@siftie.com", "password"
|
'password')
|
||||||
)
|
|
||||||
ApiKey.objects.get_or_create(user=self.johnny)
|
ApiKey.objects.get_or_create(user=self.johnny)
|
||||||
self.johnny_auth = self.create_apikey(self.johnny, self.johnny.api_key.key)
|
self.johnny_auth = self.create_apikey(self.johnny,
|
||||||
self.johnny_private = Snipt(
|
self.johnny.api_key.key)
|
||||||
title="Private snippet for Johnny",
|
self.johnny_private = Snipt(title='Private snipt for Johnny',
|
||||||
lexer="text",
|
lexer='text',
|
||||||
public=False,
|
public=False,
|
||||||
user=self.johnny,
|
user=self.johnny)
|
||||||
)
|
self.johnny_public = Snipt(title='Public snipt for Johnny',
|
||||||
self.johnny_public = Snipt(
|
lexer='text',
|
||||||
title="Public snippet for Johnny",
|
public=True,
|
||||||
lexer="text",
|
user=self.johnny)
|
||||||
public=True,
|
|
||||||
user=self.johnny,
|
|
||||||
)
|
|
||||||
self.johnny_private.save()
|
self.johnny_private.save()
|
||||||
self.johnny_public.save()
|
self.johnny_public.save()
|
||||||
|
|
||||||
# Bob
|
# Bob
|
||||||
self.bob = User.objects.create_user("bob", "bob@siftie.com", "password")
|
self.bob = User.objects.create_user('bob', 'bob@snipt.net', 'password')
|
||||||
ApiKey.objects.get_or_create(user=self.bob)
|
ApiKey.objects.get_or_create(user=self.bob)
|
||||||
self.bob_auth = self.create_apikey(self.bob, self.bob.api_key.key)
|
self.bob_auth = self.create_apikey(self.bob, self.bob.api_key.key)
|
||||||
self.bob_private = Snipt(
|
self.bob_private = Snipt(title='Private snipt for Bob',
|
||||||
title="Private snippet for Bob", lexer="text", public=False, user=self.bob
|
lexer='text',
|
||||||
)
|
public=False,
|
||||||
self.bob_public = Snipt(
|
user=self.bob)
|
||||||
title="Public snippet for Bob", lexer="text", public=True, user=self.bob
|
self.bob_public = Snipt(title='Public snipt for Bob',
|
||||||
)
|
lexer='text',
|
||||||
|
public=True,
|
||||||
|
user=self.bob)
|
||||||
self.bob_private.save()
|
self.bob_private.save()
|
||||||
self.bob_public.save()
|
self.bob_public.save()
|
||||||
|
|
||||||
|
@ -83,9 +81,9 @@ class SniptResourceTest(ResourceTestCase):
|
||||||
def test_post_private_list(self):
|
def test_post_private_list(self):
|
||||||
|
|
||||||
new_snipt = {
|
new_snipt = {
|
||||||
"title": "A new private snippet.",
|
'title': 'A new private snipt.',
|
||||||
"lexer": "text",
|
'lexer': 'text',
|
||||||
"public": False,
|
'public': False,
|
||||||
}
|
}
|
||||||
|
|
||||||
resp = self.api_client.post(
|
resp = self.api_client.post(
|
||||||
|
|
|
@ -10,9 +10,9 @@ class Migration(migrations.Migration):
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name="team",
|
model_name='team',
|
||||||
name="email",
|
name='email',
|
||||||
field=models.EmailField(default="nick@siftie.com", max_length=255),
|
field=models.EmailField(default='nick@snipt.net', max_length=255),
|
||||||
preserve_default=False,
|
preserve_default=False,
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{% extends "base.html" %}
|
{% extends "base.html" %}
|
||||||
|
|
||||||
{% block page-title %}Sign up for Siftie Snippets Pro{% endblock %}
|
{% block page-title %}Sign up for Snipt Pro{% endblock %}
|
||||||
|
|
||||||
{% block body-class %}{{ block.super }} static pro signup pro-signup pro-signup-complete{% endblock %}
|
{% block body-class %}{{ block.super }} static pro signup pro-signup pro-signup-complete{% endblock %}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{% extends "base.html" %}
|
{% extends "base.html" %}
|
||||||
|
|
||||||
{% block page-title %}Siftie Snippets for Teams{% endblock %}
|
{% block page-title %}Snipt for Teams{% endblock %}
|
||||||
|
|
||||||
{% block body-class %}{{ block.super }} static signup pro pro-signup{% endblock %}
|
{% block body-class %}{{ block.super }} static signup pro pro-signup{% endblock %}
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block breadcrumb %}
|
{% block breadcrumb %}
|
||||||
<li><a href="/for-teams/">Siftie Snippets for Teams</a></li>
|
<li><a href="/for-teams/">Snipt for Teams</a></li>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
@ -21,9 +21,9 @@
|
||||||
<form class="form-horizontal static-box" id="pro-signup" method="post" action="/for-teams/complete/">
|
<form class="form-horizontal static-box" id="pro-signup" method="post" action="/for-teams/complete/">
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<div class="info">
|
<div class="info">
|
||||||
Siftie Snippets for Teams
|
Snipt for Teams
|
||||||
<ul class="features">
|
<ul class="features">
|
||||||
<li>Team profile at snippets.siftie.com/{team-name}.</li>
|
<li>Team profile at snipt.net/{team-name}.</li>
|
||||||
<li>Members can create and edit public and private snippets on a team.</li>
|
<li>Members can create and edit public and private snippets on a team.</li>
|
||||||
<li>Detailed log of changes on a snippet, including user and code diffs.</li>
|
<li>Detailed log of changes on a snippet, including user and code diffs.</li>
|
||||||
<li>Maintain a public team profile by posting public snippets.</li>
|
<li>Maintain a public team profile by posting public snippets.</li>
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
{% if 'limit-reached' in request.GET %}
|
{% if 'limit-reached' in request.GET %}
|
||||||
<p class="alert alert-error group">
|
<p class="alert alert-error group">
|
||||||
You have no seats available to add this member.
|
You have no seats available to add this member.
|
||||||
To upgrade your plan, contact <a href="mailto:support@siftie.com">support@siftie.com</a>.
|
To upgrade your plan, contact <a href="mailto:support@snipt.net">support@snipt.net</a>.
|
||||||
</p>
|
</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<div class="def" data-title="Owner">
|
<div class="def" data-title="Owner">
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<li class="add-snipt">
|
<li class="add-snipt">
|
||||||
{% if request.user.is_active %}
|
{% if request.user.is_active %}
|
||||||
<button class="btn btn-info btn-large" id="add-snipt">
|
<button class="btn btn-info btn-large" id="add-snipt">
|
||||||
Add {% if request.user.username == 'blog' %}Post{% else %}Snippet{% endif %}
|
Add {% if request.user.username == 'blog' %}Post{% else %}Snipt{% endif %}
|
||||||
<i class="icon-search icon-plus icon-white"></i>
|
<i class="icon-search icon-plus icon-white"></i>
|
||||||
</button>
|
</button>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
<html lang="en" class="{% block html-class %}{% endblock %}" ng-app="Snipt">
|
<html lang="en" class="{% block html-class %}{% endblock %}" ng-app="Snipt">
|
||||||
<head>
|
<head>
|
||||||
|
|
||||||
<title>{% block page-title %}Siftie Snippets{% endblock %} - Code snippet app for teams and individuals.</title>
|
<title>{% block page-title %}Snipt{% endblock %} - Code snippet app for teams and individuals.</title>
|
||||||
|
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<meta name="google-site-verification" content="BantFMmY6nSP8wFvb_SDKwYZo08HglaCpNMXQqTyOuk" />
|
<meta name="google-site-verification" content="BantFMmY6nSP8wFvb_SDKwYZo08HglaCpNMXQqTyOuk" />
|
||||||
|
@ -146,7 +146,7 @@
|
||||||
{% if request.user.profile.has_pro %}
|
{% if request.user.profile.has_pro %}
|
||||||
<span class="is-pro">Pro</span>
|
<span class="is-pro">Pro</span>
|
||||||
{% else %}
|
{% else %}
|
||||||
Snippets user
|
Snipt user
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
<div class="member-since">Team since {{ user.date_joined|date:"Y" }}</div>
|
<div class="member-since">Team since {{ user.date_joined|date:"Y" }}</div>
|
||||||
{% if user.profile.get_blog_posts %}
|
{% if user.profile.get_blog_posts %}
|
||||||
<div class="urls">
|
<div class="urls">
|
||||||
Siftie Snippets Blog:
|
Snipt Blog:
|
||||||
<a href="{{ user.profile.get_user_profile_url }}">
|
<a href="{{ user.profile.get_user_profile_url }}">
|
||||||
{{ user.profile.get_user_profile_url }}
|
{{ user.profile.get_user_profile_url }}
|
||||||
</a>
|
</a>
|
||||||
|
@ -61,13 +61,13 @@
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
{% if user.username == 'nick' %}
|
{% if user.username == 'nick' %}
|
||||||
<div class="member-since">Snippets Founder in {{ user.date_joined|date:"Y" }}</div>
|
<div class="member-since">Snipt Founder in {{ user.date_joined|date:"Y" }}</div>
|
||||||
{% else %}
|
{% else %}
|
||||||
<div class="member-since">Member since {{ user.date_joined|date:"Y" }}</div>
|
<div class="member-since">Member since {{ user.date_joined|date:"Y" }}</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if user.profile.get_blog_posts %}
|
{% if user.profile.get_blog_posts %}
|
||||||
<div class="urls">
|
<div class="urls">
|
||||||
Snippets Blog:
|
Snipt Blog:
|
||||||
<a href="{{ user.profile.get_user_profile_url }}">
|
<a href="{{ user.profile.get_user_profile_url }}">
|
||||||
{{ user.profile.get_user_profile_url }}
|
{{ user.profile.get_user_profile_url }}
|
||||||
</a>
|
</a>
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Welcome to Siftie Snippets!
|
Welcome to Snipt!
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Welcome to Siftie Snippets!
|
Welcome to Snipt!
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Reset your Siftie Snippets password here: {{ protocol }}://{{ domain }}{% url 'auth_password_reset_confirm' uid token %}
|
Reset your Snipt password here: {{ protocol }}://{{ domain }}{% url 'auth_password_reset_confirm' uid token %}
|
||||||
|
|
|
@ -2,10 +2,10 @@
|
||||||
|
|
||||||
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
|
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
|
||||||
<channel>
|
<channel>
|
||||||
<atom:link href="https://snippets.siftie.com{{ request.get_full_path }}" rel="self" type="application/rss+xml" />
|
<atom:link href="https://snipt.net{{ request.get_full_path }}" rel="self" type="application/rss+xml" />
|
||||||
<description>{% if public and not public_user %}Public snipts{% else %}Snippets by {{ user.username }}{% endif %}{% if tag %} tagged with "{{ tag }}"{% endif %}</description>
|
<description>{% if public and not public_user %}Public snipts{% else %}Snipts by {{ user.username }}{% endif %}{% if tag %} tagged with "{{ tag }}"{% endif %}</description>
|
||||||
<title>/ {% if public and not public_user %}public{% else %}{{ user.username }}{% endif %}{% if tag %} / {{ tag }}{% endif %} - Siftie Snippets</title>
|
<title>/ {% if public and not public_user %}public{% else %}{{ user.username }}{% endif %}{% if tag %} / {{ tag }}{% endif %} - Snipt</title>
|
||||||
<link>https://snippets.siftie.com{{ request.path }}</link>
|
<link>https://snipt.net{{ request.path }}</link>
|
||||||
{% for snipt in snipts %}
|
{% for snipt in snipts %}
|
||||||
<item>
|
<item>
|
||||||
<title>{{ snipt.title }}</title>
|
<title>{{ snipt.title }}</title>
|
||||||
|
@ -17,7 +17,7 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<tags>{% for tag in snipt.tags.all %}{{ tag }}{% if not forloop.last %}, {% endif %}{% endfor %}</tags>
|
<tags>{% for tag in snipt.tags.all %}{{ tag }}{% if not forloop.last %}, {% endif %}{% endfor %}</tags>
|
||||||
<pubDate>{{ snipt.created|date:"r" }}</pubDate>
|
<pubDate>{{ snipt.created|date:"r" }}</pubDate>
|
||||||
<guid isPermaLink="false">siftie-snippets-com-{{ snipt.id }}</guid>
|
<guid isPermaLink="false">snipt-net-{{ snipt.id }}</guid>
|
||||||
</item>
|
</item>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</channel>
|
</channel>
|
||||||
|
|
Loading…
Reference in New Issue