/qa/ - Questions and Answers

Communication between site staff and (you)

Mode: Reply

Max message length: 4096


Max file size: 4.00 MB

Max files: 5


(used to delete files and postings)


Remember to follow the rules

(822.76 KB 514x449 Working.gif)
Tools and scripts mys_elf Board owner 06/29/2021 (Tue) 02:17:18 Id:2dfb77 No. 4
Some tools and scripts that pertain to the site. >(you) persist userscript. https://gitgud.io/mys_elf/nhnb-you-persist For when you don't like to store browser data but would like to preserve your (you)s. Not totally happy with the operation of it, but it works well enough for now. Will update at some point in the future. >Private Boards addon https://gitgud.io/mys_elf/Private-Boards An addon to require login on certain boards. >PenMod https://gitgud.io/mys_elf/PenMod The frontend for this site. Uncreative name included. >Lynxscripts https://gitgud.io/mys_elf/lynxscripts A couple of scripts contained here. archiveLimiter.py can prune the archive to a set number of threads. fileLimiter.py will prune the oldest images first to keep disk space usage within a set amount. Useful when operating on limited disk space. autoLynx.sh is a shell script to automatically set up a Lynxchan instance. Useful for setting up a testing environment. >Super simple Python scraper https://gitgud.io/mys_elf/nhnb-scraper Dumps threads into .json files, dumps images into /media/. >Thread Resumer userscript https://gitgud.io/mys_elf/nhnb-thread-resumer Remembers where you left off in a thread and places you back at that point when you return. >Dice https://gitgud.io/mys_elf/dice Adds dice to LynxChan, forked from another dice addon with few changes.
Edited last time by mys_elf on 08/07/2021 (Sat) 01:01:15.
(8.51 KB 169x214 nhnb.org_qa_res_4.html.png)
(43.92 KB 516x241 before.png)
(71.74 KB 516x241 after.png)
Here is a script for un-spoilering thumbnails. To use it just paste the code in the JS settings tab: [code] (function () { /** * Disable thumbnail spoiler */ const KEY = 'noThumbSpoiler'; const DESC = 'Disable thumbnail spoiler' const getId = path => path.match(/[0-9a-f]{64}/)?.[0]; const getThumbPath = fileId => '/.media/t_' + fileId; const getSetting = () => JSON.parse(localStorage[KEY] || 'true'); // defaults to true function undoSpoiler(thumb) { const anchor = thumb.parentElement; const fileId = getId(anchor.href); thumb.src = getThumbPath(fileId); thumb.classList.add('spoilerDisabled'); } // hook into addPost and de-spoiler new posts if (typeof window.posting.addPost == 'function') { const _addPost = window.posting.addPost; window.posting.addPost = (...args) => { const postCell = _addPost(...args); if (getSetting()) { postCell .querySelectorAll('img[src="/spoiler.png"]') .forEach(undoSpoiler); } return postCell; }; } // hook into getOtherContent to add own setting checkbox if (typeof window.settingsMenu.getOtherContent == 'function') { const _getOther = window.settingsMenu.getOtherContent; window.settingsMenu.getOtherContent = (...args) => { const panel = _getOther(...args); const saveButton = panel.querySelector('button'); const div = window.settingsMenu.getSettingDiv(DESC, KEY); const input = div.querySelector('input'); input.checked = getSetting(); saveButton.before(div); saveButton.addEventListener('click', () => { localStorage.setItem(KEY, input.checked); }); return panel; } } if (getSetting()) { const thumbs = document.querySelectorAll('img[src="/spoiler.png"]'); thumbs.forEach(thumb => { undoSpoiler(thumb); const post = thumb.closest('.innerPost'); post.classList.add('recachePost'); }); tooltips.cacheExistingHTML('recachePost'); document .querySelectorAll('.recachePost') .forEach(post => post.classList.remove('recachePost')); } })(); [/code] If you want someway to indicate that a thumbnail was originally spoilered, you can style it with CSS like so: [code] img.spoilerDisabled { outline: 2px dashed var(--border-color); } [/code]
>>114 Nice.
Could you please write a tutorial to help those who don't know much about computer install the Private Boards addon?
>>129 Sure thing. First you'll need to clone or copy the repo into LynxChan/src/be/addons. So when in the addons directory you can do: git clone https://gitgud.io/mys_elf/Private-Boards You should get another folder inside called "Private-Boards" with the contents of the repo inside. Then you'll need to set up what boards you want to use it on. Open up "pBoards.txt" in the Private-Boards folder. Enter the boards you want private inside like so: board1 board2 board3 etc Then in Global Settings you'll want to add the addon to be loaded. Under the "Misc" heading you'll find a textbox to enter what addons you want to use. Enter "Private-Boards" here (should just be the name of the folder in addons). If you have other addons you can separate the names with commas. Also important, in Global Settings you'll want to make sure the setting "Omit content from unindexed boards from front-page or overboards" is enabled (under Board Limits) and then on the Board Management pages of each board you want private make sure to enable "Don't index on top boards and board list.". Once this is all done you should be able to just restart LynxChan and it should work. Note that if you make any changes to pBoards.txt you will need to restart LynxChan to see the changes take effect.
>>130 Thank you so much!
>>130 Hi, Would you work on the Private-Boards addon to make it possible to control access to boards individually? It means login isn't enough for users to see or use some boards, they need further approval to use the boards they want.
>>134 >they need further approval to use the boards they want Two factor identification with a phone number and a facebook profile? Yeah, sure. Nice try, NSA.
>>134 >Would you work on the Private-Boards addon to make it possible to control access to boards individually? Possibly. If I do it'll probably be a while before I get to investigating it.
>>135 No, no need any sort of personal info. The addon simply lets admins or board owners decide what boards a user can visit, or who can visit a or a group of boards. Private means private. Not interested in NSA.
>>138 >The addon simply lets admins or board owners decide what boards a user can visit, or who can visit a or a group of boards. For what purpose?
>>139 For very private discussions or sharing. I am not saying anything illegal.
>>140 >For very private sharing I think you need to go the fuck back and stay there, Juan.
>>141 Don't get me wrong ...
>>141 >being anti-privacy
(681.17 KB 1280x720 1269343.gif)
>>143 >liking private circlejerks
>>144 You must love miley cyrus the whore who hates privacy!! She loves to rub her crotch in front of thousands of people. She probably hates the piece of cloth between her crotch and thousands of her fans who are keen to see her private part. I'd say that the law that prohibits people to be dressed in air in public should be abolished. Imagine when nobody has to care about their privacy, what a beautiful world it may be!
>>147 >strawmanning this hard Sure thing, Juan. Go deliver your pizza somewhere else. Preferable railtracks or a busy highway.
>>114 Custom spoilers fix, replace const thumbs = document.querySelectorAll('img[src="/spoiler.png"]'); with const thumbs = [...document.querySelectorAll('img[src="/spoiler.png"]'), ...document.querySelectorAll('img[src$="/custom.spoiler"]')];
Does this site clear exifdata?
>>209 Yes.
Just came across this: https://gitgud.io/Codexx/channel_changer Appears to be a chan scraper supporting multiple softwares (including LynxChan) with the ability to import into your own LynxChan instance. I haven't tried it yet but it sure looks cool.
Tried out using the simple scraper, end up getting the following. Any ideas? Downloading 59dd2d0dc5073378dc5e65d432e1bc0ce7c3dd75455978ec622a39bbb15b9f98.png Downloading /fim/custom.spoiler Traceback (most recent call last): File "[REDACTED]\NHNB-Scraper.py", line 122, in <module> scrape() File "[REDACTED]\NHNB-Scraper.py", line 118, in scrape catalogLoader(b) File "[REDACTED]\NHNB-Scraper.py", line 29, in catalogLoader threadLoader(board, toUp) File "[REDACTED]\NHNB-Scraper.py", line 48, in threadLoader saveMedia(board, postData['files']) File "[REDACTED]\NHNB-Scraper.py", line 57, in saveMedia saveFile(board, tURL) File "[REDACTED]\NHNB-Scraper.py", line 65, in saveFile with open('NHNB/' + board + '/media/' + file.replace('/.media/', ''), 'wb') as out_file: FileNotFoundError: [Errno 2] No such file or directory: 'NHNB/fim/media//fim/custom.spoiler'
>>291 This looked a lot better, so I gave it a try. Starts to work but quickly stops because of the following. [REDACTED]\channel_changer-master>change-channel.py -s nhnb.org -b fim -o test Threads |▎⚠ | (!) 1/118 [1%] in 0.4s (2.76s (0.0 Traceback (most recent call last): File "[REDACTED]\channel_changer-master\change-channel.py", line 658, in <module> scrapeLynxchanBoard(args, json_catalog, output_root) File "[REDACTED]\channel_changer-master\change-channel.py", line 288, in scrapeLynxchanBoard for result, thread_size in results: File "[REDACTED]\Python\Python310\lib\multiprocessing\pool.py", line 870, in next raise value File "[REDACTED]\Python\Python310\lib\multiprocessing\pool.py", line 125, in worker result = (True, func(*args, **kwds)) File "[REDACTED]\channel_changer-master\change-channel.py", line 189, in scrapeThread output_html.write(html_thread) File "[REDACTED]\Python\Python310\lib\encodings\cp1252.py", line 19, in encode return codecs.charmap_encode(input,self.errors,encoding_table)[0] UnicodeEncodeError: 'charmap' codec can't encode character '\u266a' in position 18698: character maps to <undefined> Taking a short look on google about the problem, it seems like a simple unicode encoding issue with a simple fix, but I have no real experience with python to implement it properly. Would be nice to get something working so the things here can get archived.
>>408 I've pushed a fix to the repo, should work now. https://gitgud.io/mys_elf/nhnb-scraper >>409 I still haven't gotten around to testing out Channel Changer, so I can't really offer much help. I will say that it would probably be the better option if it can be made to work.