You've already forked joplin
							
							
				mirror of
				https://github.com/laurent22/joplin.git
				synced 2025-10-31 00:07:48 +02:00 
			
		
		
		
	Doc: Added sponsors and automatically build sponsor list on README
This commit is contained in:
		| @@ -867,6 +867,9 @@ packages/lib/Synchronizer.js.map | ||||
| packages/lib/TaskQueue.d.ts | ||||
| packages/lib/TaskQueue.js | ||||
| packages/lib/TaskQueue.js.map | ||||
| packages/lib/array.d.ts | ||||
| packages/lib/array.js | ||||
| packages/lib/array.js.map | ||||
| packages/lib/commands/historyBackward.d.ts | ||||
| packages/lib/commands/historyBackward.js | ||||
| packages/lib/commands/historyBackward.js.map | ||||
|   | ||||
							
								
								
									
										3
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							| @@ -852,6 +852,9 @@ packages/lib/Synchronizer.js.map | ||||
| packages/lib/TaskQueue.d.ts | ||||
| packages/lib/TaskQueue.js | ||||
| packages/lib/TaskQueue.js.map | ||||
| packages/lib/array.d.ts | ||||
| packages/lib/array.js | ||||
| packages/lib/array.js.map | ||||
| packages/lib/commands/historyBackward.d.ts | ||||
| packages/lib/commands/historyBackward.js | ||||
| packages/lib/commands/historyBackward.js.map | ||||
|   | ||||
							
								
								
									
										
											BIN
										
									
								
								Assets/WebsiteAssets/images/sponsors/HostingDe.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Assets/WebsiteAssets/images/sponsors/HostingDe.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 22 KiB | 
							
								
								
									
										16
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								README.md
									
									
									
									
									
								
							| @@ -64,19 +64,21 @@ The Web Clipper is a browser extension that allows you to save web pages and scr | ||||
|  | ||||
| # Sponsors | ||||
|  | ||||
| <a href="https://seirei.ne.jp"><img title="Serei Network" width="256" src="https://joplinapp.org/images/sponsors/SeireiNetwork.png"/></a> <a href="https://usrigging.com/"><img title="U.S. Ringing Supply" width="256" src="https://joplinapp.org/images/sponsors/RingingSupply.svg"/></a> <a href="https://tranio.com/italy/"><img title="Tranio" width="256" src="https://joplinapp.org/images/sponsors/Tranio.png"/></a> | ||||
| <!-- SPONSORS-ORG --> | ||||
| <a href="https://www.hosting.de/nextcloud/?mtm_campaign=managed-nextcloud&mtm_kwd=joplinapp&mtm_source=joplinapp-github&mtm_medium=banner"><img title="Hosting.de" width="256" src="https://joplinapp.org/images/sponsors/HostingDe.png"/></a> <a href="https://usrigging.com/"><img title="U.S. Ringing Supply" width="256" src="https://joplinapp.org/images/sponsors/RingingSupply.svg"/></a> <a href="https://seirei.ne.jp"><img title="Serei Network" width="256" src="https://joplinapp.org/images/sponsors/SeireiNetwork.png"/></a> <a href="https://tranio.com/italy/"><img title="Tranio" width="256" src="https://joplinapp.org/images/sponsors/Tranio.png"/></a> | ||||
| <!-- SPONSORS-ORG --> | ||||
|  | ||||
| * * * | ||||
|  | ||||
| <!-- SPONSORS --> | ||||
| <!-- SPONSORS-GITHUB --> | ||||
| |       |       |       |       | | ||||
| | :---: | :---: | :---: | :---: | | ||||
| | <img width="50" src="https://avatars2.githubusercontent.com/u/215668?s=96&v=4"/></br>[avanderberg](https://github.com/avanderberg) | <img width="50" src="https://avatars2.githubusercontent.com/u/3061769?s=96&v=4"/></br>[c-nagy](https://github.com/c-nagy) | <img width="50" src="https://avatars2.githubusercontent.com/u/70780798?s=96&v=4"/></br>[cabottech](https://github.com/cabottech) | <img width="50" src="https://avatars2.githubusercontent.com/u/67130?s=96&v=4"/></br>[chr15m](https://github.com/chr15m) | | ||||
| | <img width="50" src="https://avatars2.githubusercontent.com/u/4862947?s=96&v=4"/></br>[chrootlogin](https://github.com/chrootlogin) | <img width="50" src="https://avatars2.githubusercontent.com/u/1307332?s=96&v=4"/></br>[dbrandonjohnson](https://github.com/dbrandonjohnson) | <img width="50" src="https://avatars2.githubusercontent.com/u/1439535?s=96&v=4"/></br>[fbloise](https://github.com/fbloise) | <img width="50" src="https://avatars2.githubusercontent.com/u/38898566?s=96&v=4"/></br>[h4sh5](https://github.com/h4sh5) | | ||||
| | <img width="50" src="https://avatars2.githubusercontent.com/u/37297218?s=96&v=4"/></br>[Jesssullivan](https://github.com/Jesssullivan) | <img width="50" src="https://avatars2.githubusercontent.com/u/1248504?s=96&v=4"/></br>[joesfer](https://github.com/joesfer) | <img width="50" src="https://avatars2.githubusercontent.com/u/24908652?s=96&v=4"/></br>[konishi-t](https://github.com/konishi-t) | <img width="50" src="https://avatars2.githubusercontent.com/u/1788010?s=96&v=4"/></br>[maxtruxa](https://github.com/maxtruxa) | | ||||
| | <img width="50" src="https://avatars2.githubusercontent.com/u/29300939?s=96&v=4"/></br>[mcejp](https://github.com/mcejp) | <img width="50" src="https://avatars2.githubusercontent.com/u/1168659?s=96&v=4"/></br>[nicholashead](https://github.com/nicholashead) | <img width="50" src="https://avatars2.githubusercontent.com/u/5782817?s=96&v=4"/></br>[piccobit](https://github.com/piccobit) | <img width="50" src="https://avatars2.githubusercontent.com/u/47742?s=96&v=4"/></br>[ravenscroftj](https://github.com/ravenscroftj) | | ||||
| | <img width="50" src="https://avatars2.githubusercontent.com/u/73081837?s=96&v=4"/></br>[thismarty](https://github.com/thismarty) | <img width="50" src="https://avatars2.githubusercontent.com/u/15859362?s=96&v=4"/></br>[thomasbroussard](https://github.com/thomasbroussard) |       |       | | ||||
| <!-- SPONSORS --> | ||||
| | <img width="50" src="https://avatars2.githubusercontent.com/u/4862947?s=96&v=4"/></br>[chrootlogin](https://github.com/chrootlogin) | <img width="50" src="https://avatars2.githubusercontent.com/u/82579431?s=96&v=4"/></br>[clmntsl](https://github.com/clmntsl) | <img width="50" src="https://avatars2.githubusercontent.com/u/1307332?s=96&v=4"/></br>[dbrandonjohnson](https://github.com/dbrandonjohnson) | <img width="50" src="https://avatars2.githubusercontent.com/u/1439535?s=96&v=4"/></br>[fbloise](https://github.com/fbloise) | | ||||
| | <img width="50" src="https://avatars2.githubusercontent.com/u/38898566?s=96&v=4"/></br>[h4sh5](https://github.com/h4sh5) | <img width="50" src="https://avatars2.githubusercontent.com/u/37297218?s=96&v=4"/></br>[Jesssullivan](https://github.com/Jesssullivan) | <img width="50" src="https://avatars2.githubusercontent.com/u/1248504?s=96&v=4"/></br>[joesfer](https://github.com/joesfer) | <img width="50" src="https://avatars2.githubusercontent.com/u/24908652?s=96&v=4"/></br>[konishi-t](https://github.com/konishi-t) | | ||||
| | <img width="50" src="https://avatars2.githubusercontent.com/u/1788010?s=96&v=4"/></br>[maxtruxa](https://github.com/maxtruxa) | <img width="50" src="https://avatars2.githubusercontent.com/u/29300939?s=96&v=4"/></br>[mcejp](https://github.com/mcejp) | <img width="50" src="https://avatars2.githubusercontent.com/u/1168659?s=96&v=4"/></br>[nicholashead](https://github.com/nicholashead) | <img width="50" src="https://avatars2.githubusercontent.com/u/5782817?s=96&v=4"/></br>[piccobit](https://github.com/piccobit) | | ||||
| | <img width="50" src="https://avatars2.githubusercontent.com/u/47742?s=96&v=4"/></br>[ravenscroftj](https://github.com/ravenscroftj) | <img width="50" src="https://avatars2.githubusercontent.com/u/73081837?s=96&v=4"/></br>[thismarty](https://github.com/thismarty) | <img width="50" src="https://avatars2.githubusercontent.com/u/15859362?s=96&v=4"/></br>[thomasbroussard](https://github.com/thomasbroussard) |       | | ||||
| <!-- SPONSORS-GITHUB --> | ||||
|  | ||||
| <!-- TOC --> | ||||
| # Table of contents | ||||
|   | ||||
							
								
								
									
										
											BIN
										
									
								
								docs/images/sponsors/HostingDe.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								docs/images/sponsors/HostingDe.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 22 KiB | 
| @@ -80,4 +80,15 @@ ArrayUtils.mergeOverlappingIntervals = function(intervals, limit) { | ||||
| 	return stack; | ||||
| }; | ||||
|  | ||||
| ArrayUtils.shuffle = function(array) { | ||||
| 	array = array.slice(); | ||||
| 	for (let i = array.length - 1; i > 0; i--) { | ||||
| 		const j = Math.floor(Math.random() * (i + 1)); | ||||
| 		const temp = array[i]; | ||||
| 		array[i] = array[j]; | ||||
| 		array[j] = temp; | ||||
| 	} | ||||
| 	return array; | ||||
| }; | ||||
|  | ||||
| module.exports = ArrayUtils; | ||||
|   | ||||
							
								
								
									
										16
									
								
								packages/lib/array.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								packages/lib/array.ts
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,16 @@ | ||||
| export function shuffle<T>(array: T[]): T[] { | ||||
| 	array = array.slice(); | ||||
| 	for (let i = array.length - 1; i > 0; i--) { | ||||
| 		const j = Math.floor(Math.random() * (i + 1)); | ||||
| 		const temp = array[i]; | ||||
| 		array[i] = array[j]; | ||||
| 		array[j] = temp; | ||||
| 	} | ||||
| 	return array; | ||||
| } | ||||
|  | ||||
| export function unique<T>(array: T[]): T[] { | ||||
| 	return array.filter(function(elem, index, self) { | ||||
| 		return index === self.indexOf(elem); | ||||
| 	}); | ||||
| } | ||||
| @@ -71,6 +71,10 @@ | ||||
| 		{ | ||||
| 			"name": "konishi-t", | ||||
| 			"id": "24908652" | ||||
| 		}, | ||||
| 		{ | ||||
| 			"name": "clmntsl", | ||||
| 			"id": "82579431" | ||||
| 		} | ||||
| 	], | ||||
| 	"orgs": [ | ||||
| @@ -88,6 +92,12 @@ | ||||
| 			"url": "https://tranio.com/italy/", | ||||
| 			"title": "Tranio", | ||||
| 			"imageName": "Tranio.png" | ||||
| 		}, | ||||
| 		{ | ||||
| 			"url": "https://www.hosting.de/nextcloud/?mtm_campaign=managed-nextcloud&mtm_kwd=joplinapp&mtm_source=joplinapp-github&mtm_medium=banner", | ||||
| 			"urlWebsite": "https://www.hosting.de/nextcloud/?mtm_campaign=managed-nextcloud&mtm_kwd=joplinapp&mtm_source=joplinapp-webseite&mtm_medium=banner", | ||||
| 			"title": "Hosting.de", | ||||
| 			"imageName": "HostingDe.png" | ||||
| 		} | ||||
| 	] | ||||
| } | ||||
| @@ -1,17 +1,15 @@ | ||||
| import { readFile } from 'fs-extra'; | ||||
| import { insertContentIntoFile, rootDir } from './tool-utils'; | ||||
| import markdownUtils, { MarkdownTableHeader, MarkdownTableJustify, MarkdownTableRow } from '@joplin/lib/markdownUtils'; | ||||
| const ArrayUtils = require('@joplin/lib/ArrayUtils'); | ||||
| const { escapeHtml } = require('@joplin/lib/string-utils'); | ||||
| import { GithubSponsor, OrgSponsor, Sponsors } from './website/utils/types'; | ||||
|  | ||||
| const readmePath = `${rootDir}/README.md`; | ||||
| const sponsorsPath = `${rootDir}/packages/tools/sponsors.json`; | ||||
|  | ||||
| interface Sponsor { | ||||
| 	name: string; | ||||
| 	id: string; | ||||
| } | ||||
|  | ||||
| async function main() { | ||||
| 	const sponsors: Sponsor[] = (JSON.parse(await readFile(sponsorsPath, 'utf8'))).github; | ||||
| async function createGitHubSponsorTable(sponsors: GithubSponsor[]): Promise<string> { | ||||
| 	sponsors = sponsors.slice(); | ||||
|  | ||||
| 	sponsors.sort((a, b) => { | ||||
| 		return a.name.toLowerCase() < b.name.toLowerCase() ? -1 : +1; | ||||
| @@ -49,13 +47,36 @@ async function main() { | ||||
| 		if (!sponsor) break; | ||||
| 	} | ||||
|  | ||||
| 	const mdTable = markdownUtils.createMarkdownTable(headers, rows); | ||||
| 	return markdownUtils.createMarkdownTable(headers, rows); | ||||
| } | ||||
|  | ||||
| async function createOrgSponsorTable(sponsors: OrgSponsor[]): Promise<string> { | ||||
| 	sponsors = ArrayUtils.shuffle(sponsors); | ||||
|  | ||||
| 	const output: string[] = []; | ||||
|  | ||||
| 	for (const sponsor of sponsors) { | ||||
| 		output.push(`<a href="${escapeHtml(sponsor.url)}"><img title="${escapeHtml(sponsor.title)}" width="256" src="https://joplinapp.org/images/sponsors/${escapeHtml(sponsor.imageName)}"/></a>`); | ||||
| 	} | ||||
|  | ||||
| 	return output.join(' '); | ||||
| } | ||||
|  | ||||
| async function main() { | ||||
| 	const sponsors: Sponsors = JSON.parse(await readFile(sponsorsPath, 'utf8')); | ||||
|  | ||||
| 	await insertContentIntoFile( | ||||
| 		readmePath, | ||||
| 		'<!-- SPONSORS -->\n', | ||||
| 		'\n<!-- SPONSORS -->', | ||||
| 		mdTable | ||||
| 		'<!-- SPONSORS-GITHUB -->\n', | ||||
| 		'\n<!-- SPONSORS-GITHUB -->', | ||||
| 		await createGitHubSponsorTable(sponsors.github) | ||||
| 	); | ||||
|  | ||||
| 	await insertContentIntoFile( | ||||
| 		readmePath, | ||||
| 		'<!-- SPONSORS-ORG -->\n', | ||||
| 		'\n<!-- SPONSORS-ORG -->', | ||||
| 		await createOrgSponsorTable(sponsors.orgs) | ||||
| 	); | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -2,8 +2,9 @@ import * as fs from 'fs-extra'; | ||||
| import { insertContentIntoFile, rootDir } from '../tool-utils'; | ||||
| import { pressCarouselItems } from './utils/pressCarousel'; | ||||
| import { getMarkdownIt, loadMustachePartials, markdownToPageHtml, renderMustache } from './utils/render'; | ||||
| import { Env, PlanPageParams, Sponsors, TemplateParams } from './utils/types'; | ||||
| import { Env, OrgSponsor, PlanPageParams, Sponsors, TemplateParams } from './utils/types'; | ||||
| import { getPlans, StripePublicConfig } from '@joplin/lib/utils/joplinCloud'; | ||||
| import { shuffle } from '@joplin/lib/array'; | ||||
| const dirname = require('path').dirname; | ||||
| const glob = require('glob'); | ||||
| const path = require('path'); | ||||
| @@ -42,7 +43,6 @@ async function getDonateLinks() { | ||||
| } | ||||
|  | ||||
| function replaceGitHubByWebsiteLinks(md: string) { | ||||
| 	// let output = md.replace(/https:\/\/github.com\/laurent22\/joplin\/blob\/master\/readme\/(.*?)\/index\.md(#[^\s)]+|)/g, 'https://joplinapp.org/$1'); | ||||
| 	return md | ||||
| 		.replace(/https:\/\/github.com\/laurent22\/joplin\/blob\/dev\/readme\/(.*?)\.md(#[^\s)]+|)/g, '/$1/$2') | ||||
| 		.replace(/https:\/\/github.com\/laurent22\/joplin\/blob\/dev\/README\.md(#[^\s)]+|)/g, '/help/$1'); | ||||
| @@ -182,7 +182,13 @@ async function updateDownloadPage(downloadButtonsHtml: Record<string, string>) { | ||||
|  | ||||
| async function loadSponsors(): Promise<Sponsors> { | ||||
| 	const sponsorsPath = `${rootDir}/packages/tools/sponsors.json`; | ||||
| 	return JSON.parse(await fs.readFile(sponsorsPath, 'utf8')); | ||||
| 	const output: Sponsors = JSON.parse(await fs.readFile(sponsorsPath, 'utf8')); | ||||
| 	output.orgs = shuffle<OrgSponsor>(output.orgs.map(o => { | ||||
| 		if (o.urlWebsite) o.url = o.urlWebsite; | ||||
| 		return o; | ||||
| 	})); | ||||
|  | ||||
| 	return output; | ||||
| } | ||||
|  | ||||
| async function main() { | ||||
|   | ||||
| @@ -5,13 +5,14 @@ export enum Env { | ||||
| 	Prod = 'prod', | ||||
| } | ||||
|  | ||||
| interface GithubSponsor { | ||||
| export interface GithubSponsor { | ||||
| 	name: string; | ||||
| 	id: string; | ||||
| } | ||||
|  | ||||
| interface OrgSponsor { | ||||
| export interface OrgSponsor { | ||||
| 	url: string; | ||||
| 	urlWebsite?: string; | ||||
| 	title: string; | ||||
| 	imageName: string; | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user