Feature: Support pasting functionality within our platform #67

Open
opened 2023-08-24 11:30:14 +02:00 by Dalai Felinto · 2 comments

We used to have this in phabricator (developer.blender.org/paste). And it was super useful.

My proposal would be to have it under paste.blender.org for simplicity sake. But since it is development related, it could as well be in projects.blender.org/paste.


The simpler solution out there is nopaste. This is a single-file, no data-base solution. Example: https://pablovazquez.art/paste/)

We could even customize it to match Blender's theme.

We used to have this in phabricator (developer.blender.org/paste). And it was super useful. My proposal would be to have it under paste.blender.org for simplicity sake. But since it is development related, it could as well be in projects.blender.org/paste. --- The simpler solution out there is [nopaste](https://github.com/bokub/nopaste). This is a ~~single-file,~~ no data-base solution. Example: https://pablovazquez.art/paste/) We could even customize it to match Blender's theme.
Author
Owner

For the records, I'm using this command-line script to pass my pastes to nopaste:

#!/usr/bin/env python3

"""
Paste script, use with stdin

eg:

    git diff | nopaste

The resulting URL is copied to the clipboard and printed
"""

import sys
import lzma
import base64
import subprocess

base_url = "https://nopaste.boris.sh"

if sys.stdin.isatty():
    with open(sys.argv[1], 'r') as filedata:
        data = filedata.read()
else:
    data = sys.stdin.read()

# data = data.rstrip()
if not data:
    print("empty stdin! aborting")
    sys.exit(1)

data_compressed = lzma.compress(data.encode('utf-8'), format=2)
data_encoded = base64.b64encode(data_compressed)
final_url = "%s/#%s" % (base_url, data_encoded.decode('utf-8'))

# Print out the link
print("%s" % (final_url))

# Copy the link to the clipboard
p = subprocess.Popen(["xclip"], stdin=subprocess.PIPE)
p.communicate(input=final_url.encode('utf-8'))
For the records, I'm using this command-line script to pass my pastes to nopaste: ```python #!/usr/bin/env python3 """ Paste script, use with stdin eg: git diff | nopaste The resulting URL is copied to the clipboard and printed """ import sys import lzma import base64 import subprocess base_url = "https://nopaste.boris.sh" if sys.stdin.isatty(): with open(sys.argv[1], 'r') as filedata: data = filedata.read() else: data = sys.stdin.read() # data = data.rstrip() if not data: print("empty stdin! aborting") sys.exit(1) data_compressed = lzma.compress(data.encode('utf-8'), format=2) data_encoded = base64.b64encode(data_compressed) final_url = "%s/#%s" % (base_url, data_encoded.decode('utf-8')) # Print out the link print("%s" % (final_url)) # Copy the link to the clipboard p = subprocess.Popen(["xclip"], stdin=subprocess.PIPE) p.communicate(input=final_url.encode('utf-8')) ```

I use a repository with a script for this:
https://projects.blender.org/brecht/paste/src/branch/main/cmd/paste

I use a repository with a script for this: https://projects.blender.org/brecht/paste/src/branch/main/cmd/paste
Bart van der Braak added this to the DevOps Progress Board project 2024-07-16 12:58:38 +02:00
Bart van der Braak changed title from Support pasting functionality within our platform to Gitea: Support pasting functionality within our platform 2024-07-17 15:17:10 +02:00
Bart van der Braak changed title from Gitea: Support pasting functionality within our platform to Feature: Support pasting functionality within our platform 2024-07-17 15:17:42 +02:00
Bart van der Braak added the
Type
Setup
label 2024-08-01 11:18:49 +02:00
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: infrastructure/blender-projects-platform#67
No description provided.