Skip to content

Commit

Permalink
Bundle tor library dependencies in the AppImage
Browse files Browse the repository at this point in the history
Support unicode when converting blog posts titles.

Use higher cache values for IPID documents.
  • Loading branch information
cipres authored and cipres committed Feb 17, 2021
1 parent 81a5147 commit 3357987
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 11 deletions.
4 changes: 4 additions & 0 deletions AppImage/appimage-build
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ cp $GITHUB_WORKSPACE/fs-repo-migrations/fs-repo-migrations $APPDIR/usr/bin

# Copy tor
cp /usr/bin/tor $APPDIR/usr/bin
find /usr/lib -iname 'libevent-2.1.so*' -exec cp -av {} $APPDIR/usr/lib \;
find /usr/lib -iname 'libcrypto.so*' -exec cp -av {} $APPDIR/usr/lib \;
find /usr/lib -iname 'libsystemd.so*' -exec cp -av {} $APPDIR/usr/lib \;
find /usr/lib -iname 'libssl.so*' -exec cp -av {} $APPDIR/usr/lib \;

# Copy notbit
cp $GITHUB_WORKSPACE/notbit/src/notbit $APPDIR/usr/bin
Expand Down
8 changes: 4 additions & 4 deletions galacteek/browser/schemes/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ async def _resolve(self, domain):

return match.group(1)

async def resolveEnsDomain(self, domain, timeout=15):
async def resolveEnsDomain(self, domain, timeout=20):
"""
Resolve an ENS domain with EthDNS, and return the
IPFS path for this domain
Expand Down Expand Up @@ -489,7 +489,7 @@ def __init__(self, app, parent=None, validCidQSize=32,
self.app = app
self.validCids = collections.deque([], validCidQSize)

self.requestTimeout = cGet('schemes.all.reqTimeout')
self.requestTimeout = cGet('schemes.ipfsNative.reqTimeout')

def debug(self, msg):
log.debug('Native scheme handler: {}'.format(msg))
Expand Down Expand Up @@ -590,7 +590,7 @@ async def renderDagNode(self, request, uid, ipfsop, ipfsPath, **kw):
try:
stat = None
try:
with async_timeout.timeout(8):
with async_timeout.timeout(20):
stat = await ipfsop.client.object.stat(str(indexPath))
except asyncio.TimeoutError:
return self.urlInvalid(request)
Expand Down Expand Up @@ -912,7 +912,7 @@ async def renderDagNode(self, request, uid, ipfsop, ipfsPath, **kw):
try:
stat = None
try:
with async_timeout.timeout(8):
with async_timeout.timeout(20):
stat = await ipfsop.client.object.stat(str(indexPath))
except asyncio.TimeoutError:
return self.urlInvalid(request)
Expand Down
4 changes: 2 additions & 2 deletions galacteek/browser/schemes/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ envs:

# URL schemes configuration
schemes:
all:
reqTimeout: 60
ipfsNative:
reqTimeout: 240
17 changes: 15 additions & 2 deletions galacteek/core/userdag.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import uuid
import re
from datetime import datetime
from datetime import timezone

Expand Down Expand Up @@ -74,6 +75,18 @@ async def neverUpdated(self):
return metadata['date_updated'] is None


def titleToPostName(title: str):
flags = re.IGNORECASE | re.UNICODE

words = re.findall(r'[a-z]+', title, flags=flags)
if words:
return '-'.join(words)
else:
return '-'.join(
re.findall(r'[\w]+', title, flags=flags)
)


class UserWebsite:
"""
The website associated to the user.
Expand Down Expand Up @@ -160,10 +173,10 @@ async def blogPost(self, ipfsop, title, msg, category=None,

username = sHandle.short
uid = str(uuid.uuid4())
postName = title.strip().lower().replace(' ', '-')
postName = titleToPostName(title.strip().lower())

exEntries = await self.blogEntries()
if postName in exEntries:
if not postName or postName in exEntries:
raise Exception(
'A blog post with this name already exists')

Expand Down
6 changes: 3 additions & 3 deletions galacteek/did/ipid/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ envs:

resolve:
# Timeout in seconds for resolving IPID documents
timeout: 40
timeout: 45

cacheLifetime:
# IPNS cache records values (in hours)
default:
hours: 720
hours: 1080
local:
hours: 1440

# Delay before a resolved IPID is considered "stale", in seconds
staleAfterDelay: 600
staleAfterDelay: 1200

0 comments on commit 3357987

Please sign in to comment.