├── .devcontainer ├── Dockerfile └── devcontainer.json ├── .dockerignore ├── .github ├── FUNDING.yml └── workflows │ └── fly.yml ├── .gitignore ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── DESIGN_GUIDELINE.md ├── Dockerfile ├── LICENSE ├── README.md ├── fly.toml ├── fonts ├── Apple-Emoji.ttf ├── Inter-ExtraBold.ttf └── Inter-Medium.ttf ├── images ├── .gitkeep ├── classic-seo-banner.png ├── create-banner-image-from-grithub-action.png ├── sample-ogDefault.png ├── sample-ogFacebook.png ├── sample-ogFacebookMinimal.png ├── sample-ogInstagram.png ├── sample-ogInstagramMinimal.png ├── sample-ogLinkedin.png ├── sample-ogLinkedinMinimal.png ├── sample-ogPinterest.png ├── sample-ogTwitter.png ├── sample-ogTwitterMinimal.png └── seo-banner.png ├── index.js ├── package-lock.json ├── package.json ├── pnpm-lock.yaml └── src ├── app.js ├── layouts ├── ogDefault.js ├── ogFacebook.js ├── ogFacebookMinimal.js ├── ogInstagram.js ├── ogInstagramMinimal.js ├── ogLinkedin.js ├── ogLinkedinMinimal.js ├── ogPinterest.js ├── ogTwitter.js └── ogTwitterMinimal.js ├── middlewares.js ├── nodecanvas.js └── utils ├── calculateFontSize.js ├── shorten.js └── wrapText.js /.devcontainer/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM debian:bullseye 2 | 3 | ARG NODE_VERSION=16.17.0 4 | 5 | RUN apt-get update; apt install -y curl python-is-python3 pkg-config fontconfig build-essential libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev 6 | RUN curl https://get.volta.sh | bash 7 | ENV VOLTA_HOME /root/.volta 8 | ENV PATH /root/.volta/bin:$PATH 9 | RUN volta install node@${NODE_VERSION} 10 | 11 | ####################################################################### 12 | 13 | RUN mkdir /app 14 | WORKDIR /app 15 | 16 | ENV NODE_ENV production 17 | ENV PATH /root/.volta/bin:$PATH 18 | 19 | ENV FONTCONFIG_PATH /etc/fonts 20 | COPY fonts ./ 21 | RUN mkdir -p /usr/share/fonts/truetype 22 | RUN install -m644 ./*.ttf /usr/share/fonts/truetype/ 23 | RUN rm ./*.ttf 24 | 25 | # configure Fontconfig to use the new fonts 26 | RUN echo "export FONTCONFIG_PATH=/etc/fonts" >> /etc/profile 27 | RUN fc-cache -f -v 28 | -------------------------------------------------------------------------------- /.devcontainer/devcontainer.json: -------------------------------------------------------------------------------- 1 | // For format details, see https://aka.ms/devcontainer.json. For config options, see the 2 | // README at: https://github.com/devcontainers/templates/tree/main/src/debian 3 | { 4 | "name": "Debian", 5 | // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile 6 | "image": "mcr.microsoft.com/devcontainers/base:bullseye", 7 | "features": { 8 | "ghcr.io/devcontainers/features/common-utils:2": {}, 9 | "ghcr.io/devcontainers/features/git-lfs:1": {}, 10 | "ghcr.io/devcontainers/features/github-cli:1": {}, 11 | "ghcr.io/devcontainers/features/node:1": {}, 12 | "ghcr.io/rocker-org/devcontainer-features/apt-packages:1": {}, 13 | "ghcr.io/devcontainers-contrib/features/bash-command:1": {}, 14 | "ghcr.io/devcontainers-contrib/features/curl-apt-get:1": {}, 15 | "ghcr.io/devcontainers-contrib/features/zsh-plugins:0": {} 16 | } 17 | 18 | // Features to add to the dev container. More info: https://containers.dev/features. 19 | // "features": {}, 20 | 21 | // Use 'forwardPorts' to make a list of ports inside the container available locally. 22 | // "forwardPorts": [], 23 | 24 | // Configure tool-specific properties. 25 | // "customizations": {}, 26 | 27 | // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. 28 | // "remoteUser": "root" 29 | } 30 | -------------------------------------------------------------------------------- /.dockerignore: -------------------------------------------------------------------------------- 1 | fly.toml 2 | Dockerfile 3 | .dockerignore 4 | node_modules 5 | .git 6 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: darkterminal # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] 4 | patreon: # Replace with a single Patreon username 5 | open_collective: # Replace with a single Open Collective username 6 | ko_fi: # Replace with a single Ko-fi username 7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | liberapay: # Replace with a single Liberapay username 10 | issuehunt: # Replace with a single IssueHunt username 11 | otechie: # Replace with a single Otechie username 12 | lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry 13 | custom: https://www.paypal.me/lazarusalhambra # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] 14 | -------------------------------------------------------------------------------- /.github/workflows/fly.yml: -------------------------------------------------------------------------------- 1 | name: Fly Deployer 2 | on: 3 | workflow_dispatch: 4 | 5 | jobs: 6 | deploy: 7 | name: Deploy app on the fly 8 | runs-on: ubuntu-latest 9 | steps: 10 | - uses: actions/checkout@v3 11 | - uses: superfly/flyctl-actions/setup-flyctl@master 12 | - run: flyctl deploy --remote-only 13 | env: 14 | FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} 15 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | sandbox.js 2 | output.png 3 | # Logs 4 | logs 5 | *.log 6 | npm-debug.log* 7 | yarn-debug.log* 8 | yarn-error.log* 9 | lerna-debug.log* 10 | 11 | # Diagnostic reports (https://nodejs.org/api/report.html) 12 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json 13 | 14 | # Runtime data 15 | pids 16 | *.pid 17 | *.seed 18 | *.pid.lock 19 | 20 | # Directory for instrumented libs generated by jscoverage/JSCover 21 | lib-cov 22 | 23 | # Coverage directory used by tools like istanbul 24 | coverage 25 | *.lcov 26 | 27 | # nyc test coverage 28 | .nyc_output 29 | 30 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) 31 | .grunt 32 | 33 | # Bower dependency directory (https://bower.io/) 34 | bower_components 35 | 36 | # node-waf configuration 37 | .lock-wscript 38 | 39 | # Compiled binary addons (https://nodejs.org/api/addons.html) 40 | build/Release 41 | 42 | # Dependency directories 43 | node_modules/ 44 | jspm_packages/ 45 | 46 | # TypeScript v1 declaration files 47 | typings/ 48 | 49 | # TypeScript cache 50 | *.tsbuildinfo 51 | 52 | # Optional npm cache directory 53 | .npm 54 | 55 | # Optional eslint cache 56 | .eslintcache 57 | 58 | # Microbundle cache 59 | .rpt2_cache/ 60 | .rts2_cache_cjs/ 61 | .rts2_cache_es/ 62 | .rts2_cache_umd/ 63 | 64 | # Optional REPL history 65 | .node_repl_history 66 | 67 | # Output of 'npm pack' 68 | *.tgz 69 | 70 | # Yarn Integrity file 71 | .yarn-integrity 72 | 73 | # dotenv environment variables file 74 | .env 75 | .env.test 76 | 77 | # parcel-bundler cache (https://parceljs.org/) 78 | .cache 79 | 80 | # Next.js build output 81 | .next 82 | 83 | # Nuxt.js build / generate output 84 | .nuxt 85 | 86 | # Gatsby files 87 | .cache/ 88 | # Comment in the public line in if your project uses Gatsby and *not* Next.js 89 | # https://nextjs.org/blog/next-9-1#public-directory-support 90 | # public 91 | 92 | # vuepress build output 93 | .vuepress/dist 94 | 95 | # Serverless directories 96 | .serverless/ 97 | 98 | # FuseBox cache 99 | .fusebox/ 100 | 101 | # DynamoDB Local files 102 | .dynamodb/ 103 | 104 | # TernJS port file 105 | .tern-port 106 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # OG:IMAGE REST Generator Code of Conduct 2 | 3 | OG:IMAGE REST Generator is committed to providing a safe, inclusive, and harassment-free environment for everyone who contributes to the project, regardless of gender, gender identity and expression, sexual orientation, disability, physical appearance, body size, race, or religion. 4 | 5 | As a member of this community, you agree to abide by the following Code of Conduct: 6 | 7 | - Respect and be kind to all community members, regardless of their background or beliefs. 8 | - Do not engage in any form of harassment, discrimination, or intimidation, including but not limited to: offensive comments, verbal or written abuse, sexual harassment, or physical violence. 9 | - Do not engage in any behavior that may be deemed as threatening or harmful, either physically or mentally, to any community member. 10 | - Refrain from engaging in any inappropriate behavior, such as using profanity or engaging in disruptive behavior during community events or discussions. 11 | - Report any incidents of harassment, discrimination, or inappropriate behavior to the project maintainers immediately. 12 | 13 | Failure to adhere to this Code of Conduct may result in disciplinary action, up to and including removal from the project and its associated platforms. 14 | 15 | By contributing to OG:IMAGE REST Generator, you agree to abide by this Code of Conduct and help to create a safe and welcoming environment for all community members. 16 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing Guidelines 2 | Thank you for your interest in contributing to OG:IMAGE REST Generator! We welcome contributions from all members of the community. 3 | 4 | ## Getting Started 5 | To get started, simply fork the repository and make any changes or additions you'd like. Please ensure that your changes are related to the project's goal of simplifying the process of generating Open Graph images. #Ref: [DESIGN_GUIDELINE.md](DESIGN_GUIDELINE.md) 6 | 7 | ## Submitting Changes 8 | Once you've made your changes, please submit a pull request. Be sure to include a detailed description of your changes and any relevant information about the issue or feature you're addressing. 9 | 10 | ## Code of Conduct 11 | We follow the Contributor Covenant Code of Conduct in all our interactions. Please review the code of conduct before contributing: [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md) 12 | 13 | ## License 14 | By contributing to OG:IMAGE REST Generator, you agree that your contributions will be licensed under the project's [GPLv3 License](LICENSE). 15 | 16 | Thank you for your contributions to OG:IMAGE REST Generator! 17 | -------------------------------------------------------------------------------- /DESIGN_GUIDELINE.md: -------------------------------------------------------------------------------- 1 | # Design Guideline 2 | 3 | Design `og:image` guidelines to our generator: 4 | Recommended sizes for Open Graph (og:image) images on popular social media platforms: 5 | - Facebook: 6 | - Recommended size: 1200 x 630 pixels 7 | - Minimum size: 600 x 315 pixels 8 | - Aspect ratio: 1.91:1 9 | - Twitter: 10 | - Recommended size: 1200 x 675 pixels 11 | - Minimum size: 600 x 335 pixels 12 | - Aspect ratio: 16:9 13 | - LinkedIn: 14 | - Recommended size: 1200 x 628 pixels 15 | - Minimum size: 600 x 400 pixels 16 | - Aspect ratio: 1.91:1 17 | - Instagram: 18 | - Recommended size: 1080 x 1080 pixels 19 | - Minimum size: 600 x 600 pixels 20 | - Aspect ratio: 1:1 21 | - Pinterest: 22 | - Recommended size: 1000 x 1500 pixels 23 | - Minimum size: 600 x 900 pixels 24 | - Aspect ratio: 2:3 25 | 26 | ## Title Characters Length 27 | Maximum title characters length is **42 characters** if the title exceeds this length, it may be truncated. 28 | 29 | ## Facebook (Recomended Size) 30 | ![Facebook (Recomended Size)](https://user-images.githubusercontent.com/32319439/225009851-2995ddf4-574a-4427-9a4f-ec8f6dcac165.png) 31 | 32 | The aspect ratio between 1200 x 630 pixels and 600 x 315 pixels is the same. Both image sizes have an aspect ratio of 1.91:1. 33 | 34 | To calculate the aspect ratio of an image, you simply divide the width by the height. 35 | 1. For the 1200 x 630 pixel image, the aspect ratio is 1200/630 = 1.91:1. 36 | 2. Similarly, for the 600 x 315 pixel image, the aspect ratio is 600/315 = 1.91:1. 37 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM debian:bullseye as builder 2 | 3 | ARG NODE_VERSION=16.17.0 4 | 5 | RUN apt-get update; apt install -y curl python-is-python3 pkg-config build-essential 6 | RUN curl https://get.volta.sh | bash 7 | ENV VOLTA_HOME /root/.volta 8 | ENV PATH /root/.volta/bin:$PATH 9 | RUN volta install node@${NODE_VERSION} 10 | 11 | ####################################################################### 12 | 13 | RUN mkdir /app 14 | WORKDIR /app 15 | 16 | # NPM will not install any package listed in "devDependencies" when NODE_ENV is set to "production", 17 | # to install all modules: "npm install --production=false". 18 | # Ref: https://docs.npmjs.com/cli/v9/commands/npm-install#description 19 | 20 | ENV NODE_ENV production 21 | 22 | COPY . . 23 | 24 | RUN npm install 25 | FROM debian:bullseye 26 | 27 | LABEL fly_launch_runtime="nodejs" 28 | 29 | COPY --from=builder /root/.volta /root/.volta 30 | COPY --from=builder /app /app 31 | 32 | RUN apt-get update; apt install -y fontconfig curl build-essential libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev 33 | 34 | WORKDIR /app 35 | ENV NODE_ENV production 36 | ENV PATH /root/.volta/bin:$PATH 37 | 38 | ENV FONTCONFIG_PATH /etc/fonts 39 | COPY fonts ./ 40 | RUN mkdir -p /usr/share/fonts/truetype 41 | RUN install -m644 ./*.ttf /usr/share/fonts/truetype/ 42 | RUN rm ./*.ttf 43 | 44 | # configure Fontconfig to use the new fonts 45 | RUN echo "export FONTCONFIG_PATH=/etc/fonts" >> /etc/profile 46 | RUN fc-cache -f -v 47 | 48 | EXPOSE 8080 49 | 50 | CMD [ "npm", "run", "start" ] 51 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | 3 | Version 3, 29 June 2007 4 | 5 | Copyright © 2007 Imam Ali 6 | Mustofa 7 | 8 | Everyone is permitted to copy and distribute verbatim copies of this 9 | license document, but changing it is not allowed. 10 | 11 | Preamble 12 | 13 | The GNU General 14 | Public License is a free, copyleft license for software and other kinds of 15 | works. 16 | 17 | The licenses for most software and other practical works are designed to 18 | take away your freedom to share and change the works. By contrast, the GNU 19 | General Public License is intended to guarantee your freedom to share and change 20 | all versions of a program--to make sure it remains free software for all its 21 | users. We, the Free Software Foundation, use the GNU General Public License for 22 | most of our software; it applies also to any other work released this way by its 23 | authors. You can apply it to your programs, too. 24 | 25 | When we speak of free software, 26 | we are referring to freedom, not price. Our General Public Licenses are designed 27 | to make sure that you have the freedom to distribute copies of free software (and 28 | charge for them if you wish), that you receive source code or can get it if you 29 | want it, that you can change the software or use pieces of it in new free 30 | programs, and that you know you can do these things. 31 | 32 | To protect your rights, we 33 | need to prevent others from denying you these rights or asking you to surrender 34 | the rights. Therefore, you have certain responsibilities if you distribute copies 35 | of the software, or if you modify it: responsibilities to respect the freedom of 36 | others. 37 | 38 | For example, if you distribute copies of such a program, whether gratis 39 | or for a fee, you must pass on to the recipients the same freedoms that you 40 | received. You must make sure that they, too, receive or can get the source code. 41 | And you must show them these terms so they know their rights. 42 | 43 | Developers that 44 | use the GNU GPL protect your rights with two steps: (1) assert copyright on the 45 | software, and (2) offer you this License giving you legal permission to copy, 46 | distribute and/or modify it. 47 | 48 | For the developers' and authors' protection, the 49 | GPL clearly explains that there is no warranty for this free software. For both 50 | users' and authors' sake, the GPL requires that modified versions be marked as 51 | changed, so that their problems will not be attributed erroneously to authors of 52 | previous versions. 53 | 54 | Some devices are designed to deny users access to install or 55 | run modified versions of the software inside them, although the manufacturer can 56 | do so. This is fundamentally incompatible with the aim of protecting users' 57 | freedom to change the software. The systematic pattern of such abuse occurs in 58 | the area of products for individuals to use, which is precisely where it is most 59 | unacceptable. Therefore, we have designed this version of the GPL to prohibit the 60 | practice for those products. If such problems arise substantially in other 61 | domains, we stand ready to extend this provision to those domains in future 62 | versions of the GPL, as needed to protect the freedom of users. 63 | 64 | Finally, every 65 | program is threatened constantly by software patents. States should not allow 66 | patents to restrict development and use of software on general-purpose computers, 67 | but in those that do, we wish to avoid the special danger that patents applied to 68 | a free program could make it effectively proprietary. To prevent this, the GPL 69 | assures that patents cannot be used to render the program non-free. 70 | 71 | The precise 72 | terms and conditions for copying, distribution and modification follow. 73 | 74 | TERMS 75 | AND CONDITIONS 76 | 77 | 0. Definitions. 78 | 79 | "This License" refers to version 3 of the 80 | GNU General Public License. 81 | 82 | "Copyright" also means copyright-like laws that 83 | apply to other kinds of works, such as semiconductor masks. 84 | 85 | "The Program" 86 | refers to any copyrightable work licensed under this License. Each licensee is 87 | addressed as "you". "Licensees" and "recipients" may be individuals or 88 | organizations. 89 | 90 | To "modify" a work means to copy from or adapt all or part of 91 | the work in a fashion requiring copyright permission, other than the making of an 92 | exact copy. The resulting work is called a "modified version" of the earlier work 93 | or a work "based on" the earlier work. 94 | 95 | A "covered work" means either the 96 | unmodified Program or a work based on the Program. 97 | 98 | To "propagate" a work 99 | means to do anything with it that, without permission, would make you directly or 100 | secondarily liable for infringement under applicable copyright law, except 101 | executing it on a computer or modifying a private copy. Propagation includes 102 | copying, distribution (with or without modification), making available to the 103 | public, and in some countries other activities as well. 104 | 105 | To "convey" a work 106 | means any kind of propagation that enables other parties to make or receive 107 | copies. Mere interaction with a user through a computer network, with no transfer 108 | of a copy, is not conveying. 109 | 110 | An interactive user interface displays 111 | "Appropriate Legal Notices" to the extent that it includes a convenient and 112 | prominently visible feature that (1) displays an appropriate copyright notice, 113 | and (2) tells the user that there is no warranty for the work (except to the 114 | extent that warranties are provided), that licensees may convey the work under 115 | this License, and how to view a copy of this License. If the interface presents a 116 | list of user commands or options, such as a menu, a prominent item in the list 117 | meets this criterion. 118 | 119 | 1. Source Code. 120 | 121 | The "source code" for a work means 122 | the preferred form of the work for making modifications to it. "Object code" 123 | means any non-source form of a work. 124 | 125 | A "Standard Interface" means an 126 | interface that either is an official standard defined by a recognized standards 127 | body, or, in the case of interfaces specified for a particular programming 128 | language, one that is widely used among developers working in that language. 129 | 130 | 131 | The "System Libraries" of an executable work include anything, other than the 132 | work as a whole, that (a) is included in the normal form of packaging a Major 133 | Component, but which is not part of that Major Component, and (b) serves only to 134 | enable use of the work with that Major Component, or to implement a Standard 135 | Interface for which an implementation is available to the public in source code 136 | form. A "Major Component", in this context, means a major essential component 137 | (kernel, window system, and so on) of the specific operating system (if any) on 138 | which the executable work runs, or a compiler used to produce the work, or an 139 | object code interpreter used to run it. 140 | 141 | The "Corresponding Source" for a work 142 | in object code form means all the source code needed to generate, install, and 143 | (for an executable work) run the object code and to modify the work, including 144 | scripts to control those activities. However, it does not include the work's 145 | System Libraries, or general-purpose tools or generally available free programs 146 | which are used unmodified in performing those activities but which are not part 147 | of the work. For example, Corresponding Source includes interface definition 148 | files associated with source files for the work, and the source code for shared 149 | libraries and dynamically linked subprograms that the work is specifically 150 | designed to require, such as by intimate data communication or control flow 151 | between those subprograms and other parts of the work. 152 | 153 | The Corresponding 154 | Source need not include anything that users can regenerate automatically from 155 | other parts of the Corresponding Source. 156 | 157 | The Corresponding Source for a work 158 | in source code form is that same work. 159 | 160 | 2. Basic Permissions. 161 | 162 | All rights 163 | granted under this License are granted for the term of copyright on the Program, 164 | and are irrevocable provided the stated conditions are met. This License 165 | explicitly affirms your unlimited permission to run the unmodified Program. The 166 | output from running a covered work is covered by this License only if the output, 167 | given its content, constitutes a covered work. This License acknowledges your 168 | rights of fair use or other equivalent, as provided by copyright law. 169 | 170 | You may 171 | make, run and propagate covered works that you do not convey, without conditions 172 | so long as your license otherwise remains in force. You may convey covered works 173 | to others for the sole purpose of having them make modifications exclusively for 174 | you, or provide you with facilities for running those works, provided that you 175 | comply with the terms of this License in conveying all material for which you do 176 | not control copyright. Those thus making or running the covered works for you 177 | must do so exclusively on your behalf, under your direction and control, on terms 178 | that prohibit them from making any copies of your copyrighted material outside 179 | their relationship with you. 180 | 181 | Conveying under any other circumstances is 182 | permitted solely under the conditions stated below. Sublicensing is not allowed; 183 | section 10 makes it unnecessary. 184 | 185 | 3. Protecting Users' Legal Rights From 186 | Anti-Circumvention Law. 187 | 188 | No covered work shall be deemed part of an effective 189 | technological measure under any applicable law fulfilling obligations under 190 | article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar 191 | laws prohibiting or restricting circumvention of such measures. 192 | 193 | When you 194 | convey a covered work, you waive any legal power to forbid circumvention of 195 | technological measures to the extent such circumvention is effected by exercising 196 | rights under this License with respect to the covered work, and you disclaim any 197 | intention to limit operation or modification of the work as a means of enforcing, 198 | against the work's users, your or third parties' legal rights to forbid 199 | circumvention of technological measures. 200 | 201 | 4. Conveying Verbatim Copies. 202 | 203 | 204 | You may convey verbatim copies of the Program's source code as you receive it, in 205 | any medium, provided that you conspicuously and appropriately publish on each 206 | copy an appropriate copyright notice; keep intact all notices stating that this 207 | License and any non-permissive terms added in accord with section 7 apply to the 208 | code; keep intact all notices of the absence of any warranty; and give all 209 | recipients a copy of this License along with the Program. 210 | 211 | You may charge any 212 | price or no price for each copy that you convey, and you may offer support or 213 | warranty protection for a fee. 214 | 215 | 5. Conveying Modified Source Versions. 216 | 217 | You 218 | may convey a work based on the Program, or the modifications to produce it from 219 | the Program, in the form of source code under the terms of section 4, provided 220 | that you also meet all of these conditions: 221 | 222 | a) The work must carry 223 | prominent notices stating that you modified it, and giving a relevant date. 224 | 225 | 226 | b) The work must carry prominent notices stating that it is released under this 227 | License and any conditions added under section 7. This requirement modifies the 228 | requirement in section 4 to "keep intact all notices". 229 | 230 | c) You must license 231 | the entire work, as a whole, under this License to anyone who comes into 232 | possession of a copy. This License will therefore apply, along with any 233 | applicable section 7 additional terms, to the whole of the work, and all its 234 | parts, regardless of how they are packaged. This License gives no permission to 235 | license the work in any other way, but it does not invalidate such permission if 236 | you have separately received it. 237 | 238 | d) If the work has interactive user 239 | interfaces, each must display Appropriate Legal Notices; however, if the Program 240 | has interactive interfaces that do not display Appropriate Legal Notices, your 241 | work need not make them do so. 242 | 243 | A compilation of a covered work with other 244 | separate and independent works, which are not by their nature extensions of the 245 | covered work, and which are not combined with it such as to form a larger 246 | program, in or on a volume of a storage or distribution medium, is called an 247 | "aggregate" if the compilation and its resulting copyright are not used to limit 248 | the access or legal rights of the compilation's users beyond what the individual 249 | works permit. Inclusion of a covered work in an aggregate does not cause this 250 | License to apply to the other parts of the aggregate. 251 | 252 | 6. Conveying Non-Source 253 | Forms. 254 | 255 | You may convey a covered work in object code form under the terms of 256 | sections 4 and 5, provided that you also convey the machine-readable 257 | Corresponding Source under the terms of this License, in one of these ways: 258 | 259 | 260 | a) Convey the object code in, or embodied in, a physical product (including a 261 | physical distribution medium), accompanied by the Corresponding Source fixed on a 262 | durable physical medium customarily used for software interchange. 263 | 264 | b) 265 | Convey the object code in, or embodied in, a physical product (including a 266 | physical distribution medium), accompanied by a written offer, valid for at least 267 | three years and valid for as long as you offer spare parts or customer support 268 | for that product model, to give anyone who possesses the object code either (1) a 269 | copy of the Corresponding Source for all the software in the product that is 270 | covered by this License, on a durable physical medium customarily used for 271 | software interchange, for a price no more than your reasonable cost of physically 272 | performing this conveying of source, or (2) access to copy the Corresponding 273 | Source from a network server at no charge. 274 | 275 | c) Convey individual copies of 276 | the object code with a copy of the written offer to provide the Corresponding 277 | Source. This alternative is allowed only occasionally and noncommercially, and 278 | only if you received the object code with such an offer, in accord with 279 | subsection 6b. 280 | 281 | d) Convey the object code by offering access from a 282 | designated place (gratis or for a charge), and offer equivalent access to the 283 | Corresponding Source in the same way through the same place at no further charge. 284 | You need not require recipients to copy the Corresponding Source along with the 285 | object code. If the place to copy the object code is a network server, the 286 | Corresponding Source may be on a different server (operated by you or a third 287 | party) that supports equivalent copying facilities, provided you maintain clear 288 | directions next to the object code saying where to find the Corresponding Source. 289 | Regardless of what server hosts the Corresponding Source, you remain obligated to 290 | ensure that it is available for as long as needed to satisfy these 291 | requirements. 292 | 293 | e) Convey the object code using peer-to-peer transmission, 294 | provided you inform other peers where the object code and Corresponding Source of 295 | the work are being offered to the general public at no charge under subsection 296 | 6d. 297 | 298 | A separable portion of the object code, whose source code is excluded 299 | from the Corresponding Source as a System Library, need not be included in 300 | conveying the object code work. 301 | 302 | A "User Product" is either (1) a "consumer 303 | product", which means any tangible personal property which is normally used for 304 | personal, family, or household purposes, or (2) anything designed or sold for 305 | incorporation into a dwelling. In determining whether a product is a consumer 306 | product, doubtful cases shall be resolved in favor of coverage. For a particular 307 | product received by a particular user, "normally used" refers to a typical or 308 | common use of that class of product, regardless of the status of the particular 309 | user or of the way in which the particular user actually uses, or expects or is 310 | expected to use, the product. A product is a consumer product regardless of 311 | whether the product has substantial commercial, industrial or non-consumer uses, 312 | unless such uses represent the only significant mode of use of the product. 313 | 314 | 315 | "Installation Information" for a User Product means any methods, procedures, 316 | authorization keys, or other information required to install and execute modified 317 | versions of a covered work in that User Product from a modified version of its 318 | Corresponding Source. The information must suffice to ensure that the continued 319 | functioning of the modified object code is in no case prevented or interfered 320 | with solely because modification has been made. 321 | 322 | If you convey an object code 323 | work under this section in, or with, or specifically for use in, a User Product, 324 | and the conveying occurs as part of a transaction in which the right of 325 | possession and use of the User Product is transferred to the recipient in 326 | perpetuity or for a fixed term (regardless of how the transaction is 327 | characterized), the Corresponding Source conveyed under this section must be 328 | accompanied by the Installation Information. But this requirement does not apply 329 | if neither you nor any third party retains the ability to install modified object 330 | code on the User Product (for example, the work has been installed in ROM). 331 | 332 | 333 | The requirement to provide Installation Information does not include a 334 | requirement to continue to provide support service, warranty, or updates for a 335 | work that has been modified or installed by the recipient, or for the User 336 | Product in which it has been modified or installed. Access to a network may be 337 | denied when the modification itself materially and adversely affects the 338 | operation of the network or violates the rules and protocols for communication 339 | across the network. 340 | 341 | Corresponding Source conveyed, and Installation 342 | Information provided, in accord with this section must be in a format that is 343 | publicly documented (and with an implementation available to the public in source 344 | code form), and must require no special password or key for unpacking, reading or 345 | copying. 346 | 347 | 7. Additional Terms. 348 | 349 | "Additional permissions" are terms that 350 | supplement the terms of this License by making exceptions from one or more of its 351 | conditions. Additional permissions that are applicable to the entire Program 352 | shall be treated as though they were included in this License, to the extent that 353 | they are valid under applicable law. If additional permissions apply only to part 354 | of the Program, that part may be used separately under those permissions, but the 355 | entire Program remains governed by this License without regard to the additional 356 | permissions. 357 | 358 | When you convey a copy of a covered work, you may at your option 359 | remove any additional permissions from that copy, or from any part of it. 360 | (Additional permissions may be written to require their own removal in certain 361 | cases when you modify the work.) You may place additional permissions on 362 | material, added by you to a covered work, for which you have or can give 363 | appropriate copyright permission. 364 | 365 | Notwithstanding any other provision of this 366 | License, for material you add to a covered work, you may (if authorized by the 367 | copyright holders of that material) supplement the terms of this License with 368 | terms: 369 | 370 | a) Disclaiming warranty or limiting liability differently from the 371 | terms of sections 15 and 16 of this License; or 372 | 373 | b) Requiring preservation 374 | of specified reasonable legal notices or author attributions in that material or 375 | in the Appropriate Legal Notices displayed by works containing it; or 376 | 377 | c) 378 | Prohibiting misrepresentation of the origin of that material, or requiring that 379 | modified versions of such material be marked in reasonable ways as different from 380 | the original version; or 381 | 382 | d) Limiting the use for publicity purposes of 383 | names of licensors or authors of the material; or 384 | 385 | e) Declining to grant 386 | rights under trademark law for use of some trade names, trademarks, or service 387 | marks; or 388 | 389 | f) Requiring indemnification of licensors and authors of that 390 | material by anyone who conveys the material (or modified versions of it) with 391 | contractual assumptions of liability to the recipient, for any liability that 392 | these contractual assumptions directly impose on those licensors and authors. 393 | 394 | 395 | All other non-permissive additional terms are considered "further restrictions" 396 | within the meaning of section 10. If the Program as you received it, or any part 397 | of it, contains a notice stating that it is governed by this License along with a 398 | term that is a further restriction, you may remove that term. If a license 399 | document contains a further restriction but permits relicensing or conveying 400 | under this License, you may add to a covered work material governed by the terms 401 | of that license document, provided that the further restriction does not survive 402 | such relicensing or conveying. 403 | 404 | If you add terms to a covered work in accord 405 | with this section, you must place, in the relevant source files, a statement of 406 | the additional terms that apply to those files, or a notice indicating where to 407 | find the applicable terms. 408 | 409 | Additional terms, permissive or non-permissive, 410 | may be stated in the form of a separately written license, or stated as 411 | exceptions; the above requirements apply either way. 412 | 413 | 8. Termination. 414 | 415 | You 416 | may not propagate or modify a covered work except as expressly provided under 417 | this License. Any attempt otherwise to propagate or modify it is void, and will 418 | automatically terminate your rights under this License (including any patent 419 | licenses granted under the third paragraph of section 11). 420 | 421 | However, if you 422 | cease all violation of this License, then your license from a particular 423 | copyright holder is reinstated (a) provisionally, unless and until the copyright 424 | holder explicitly and finally terminates your license, and (b) permanently, if 425 | the copyright holder fails to notify you of the violation by some reasonable 426 | means prior to 60 days after the cessation. 427 | 428 | Moreover, your license from a 429 | particular copyright holder is reinstated permanently if the copyright holder 430 | notifies you of the violation by some reasonable means, this is the first time 431 | you have received notice of violation of this License (for any work) from that 432 | copyright holder, and you cure the violation prior to 30 days after your receipt 433 | of the notice. 434 | 435 | Termination of your rights under this section does not 436 | terminate the licenses of parties who have received copies or rights from you 437 | under this License. If your rights have been terminated and not permanently 438 | reinstated, you do not qualify to receive new licenses for the same material 439 | under section 10. 440 | 441 | 9. Acceptance Not Required for Having Copies. 442 | 443 | You are 444 | not required to accept this License in order to receive or run a copy of the 445 | Program. Ancillary propagation of a covered work occurring solely as a 446 | consequence of using peer-to-peer transmission to receive a copy likewise does 447 | not require acceptance. However, nothing other than this License grants you 448 | permission to propagate or modify any covered work. These actions infringe 449 | copyright if you do not accept this License. Therefore, by modifying or 450 | propagating a covered work, you indicate your acceptance of this License to do 451 | so. 452 | 453 | 10. Automatic Licensing of Downstream Recipients. 454 | 455 | Each time you 456 | convey a covered work, the recipient automatically receives a license from the 457 | original licensors, to run, modify and propagate that work, subject to this 458 | License. You are not responsible for enforcing compliance by third parties with 459 | this License. 460 | 461 | An "entity transaction" is a transaction transferring control 462 | of an organization, or substantially all assets of one, or subdividing an 463 | organization, or merging organizations. If propagation of a covered work results 464 | from an entity transaction, each party to that transaction who receives a copy of 465 | the work also receives whatever licenses to the work the party's predecessor in 466 | interest had or could give under the previous paragraph, plus a right to 467 | possession of the Corresponding Source of the work from the predecessor in 468 | interest, if the predecessor has it or can get it with reasonable efforts. 469 | 470 | 471 | You may not impose any further restrictions on the exercise of the rights granted 472 | or affirmed under this License. For example, you may not impose a license fee, 473 | royalty, or other charge for exercise of rights granted under this License, and 474 | you may not initiate litigation (including a cross-claim or counterclaim in a 475 | lawsuit) alleging that any patent claim is infringed by making, using, selling, 476 | offering for sale, or importing the Program or any portion of it. 477 | 478 | 11. 479 | Patents. 480 | 481 | A "contributor" is a copyright holder who authorizes use under this 482 | License of the Program or a work on which the Program is based. The work thus 483 | licensed is called the contributor's "contributor version". 484 | 485 | A contributor's 486 | "essential patent claims" are all patent claims owned or controlled by the 487 | contributor, whether already acquired or hereafter acquired, that would be 488 | infringed by some manner, permitted by this License, of making, using, or selling 489 | its contributor version, but do not include claims that would be infringed only 490 | as a consequence of further modification of the contributor version. For purposes 491 | of this definition, "control" includes the right to grant patent sublicenses in a 492 | manner consistent with the requirements of this License. 493 | 494 | Each contributor 495 | grants you a non-exclusive, worldwide, royalty-free patent license under the 496 | contributor's essential patent claims, to make, use, sell, offer for sale, import 497 | and otherwise run, modify and propagate the contents of its contributor 498 | version. 499 | 500 | In the following three paragraphs, a "patent license" is any express 501 | agreement or commitment, however denominated, not to enforce a patent (such as an 502 | express permission to practice a patent or covenant not to sue for patent 503 | infringement). To "grant" such a patent license to a party means to make such an 504 | agreement or commitment not to enforce a patent against the party. 505 | 506 | If you 507 | convey a covered work, knowingly relying on a patent license, and the 508 | Corresponding Source of the work is not available for anyone to copy, free of 509 | charge and under the terms of this License, through a publicly available network 510 | server or other readily accessible means, then you must either (1) cause the 511 | Corresponding Source to be so available, or (2) arrange to deprive yourself of 512 | the benefit of the patent license for this particular work, or (3) arrange, in a 513 | manner consistent with the requirements of this License, to extend the patent 514 | license to downstream recipients. "Knowingly relying" means you have actual 515 | knowledge that, but for the patent license, your conveying the covered work in a 516 | country, or your recipient's use of the covered work in a country, would infringe 517 | one or more identifiable patents in that country that you have reason to believe 518 | are valid. 519 | 520 | If, pursuant to or in connection with a single transaction or 521 | arrangement, you convey, or propagate by procuring conveyance of, a covered work, 522 | and grant a patent license to some of the parties receiving the covered work 523 | authorizing them to use, propagate, modify or convey a specific copy of the 524 | covered work, then the patent license you grant is automatically extended to all 525 | recipients of the covered work and works based on it. 526 | 527 | A patent license is 528 | "discriminatory" if it does not include within the scope of its coverage, 529 | prohibits the exercise of, or is conditioned on the non-exercise of one or more 530 | of the rights that are specifically granted under this License. You may not 531 | convey a covered work if you are a party to an arrangement with a third party 532 | that is in the business of distributing software, under which you make payment to 533 | the third party based on the extent of your activity of conveying the work, and 534 | under which the third party grants, to any of the parties who would receive the 535 | covered work from you, a discriminatory patent license (a) in connection with 536 | copies of the covered work conveyed by you (or copies made from those copies), or 537 | (b) primarily for and in connection with specific products or compilations that 538 | contain the covered work, unless you entered into that arrangement, or that 539 | patent license was granted, prior to 28 March 2007. 540 | 541 | Nothing in this License 542 | shall be construed as excluding or limiting any implied license or other defenses 543 | to infringement that may otherwise be available to you under applicable patent 544 | law. 545 | 546 | 12. No Surrender of Others' Freedom. 547 | 548 | If conditions are imposed on 549 | you (whether by court order, agreement or otherwise) that contradict the 550 | conditions of this License, they do not excuse you from the conditions of this 551 | License. If you cannot convey a covered work so as to satisfy simultaneously your 552 | obligations under this License and any other pertinent obligations, then as a 553 | consequence you may not convey it at all. For example, if you agree to terms that 554 | obligate you to collect a royalty for further conveying from those to whom you 555 | convey the Program, the only way you could satisfy both those terms and this 556 | License would be to refrain entirely from conveying the Program. 557 | 558 | 13. Use with 559 | the GNU Affero General Public License. 560 | 561 | Notwithstanding any other provision of 562 | this License, you have permission to link or combine any covered work with a work 563 | licensed under version 3 of the GNU Affero General Public License into a single 564 | combined work, and to convey the resulting work. The terms of this License will 565 | continue to apply to the part which is the covered work, but the special 566 | requirements of the GNU Affero General Public License, section 13, concerning 567 | interaction through a network will apply to the combination as such. 568 | 569 | 14. 570 | Revised Versions of this License. 571 | 572 | The Free Software Foundation may publish 573 | revised and/or new versions of the GNU General Public License from time to time. 574 | Such new versions will be similar in spirit to the present version, but may 575 | differ in detail to address new problems or concerns. 576 | 577 | Each version is given a 578 | distinguishing version number. If the Program specifies that a certain numbered 579 | version of the GNU General Public License "or any later version" applies to it, 580 | you have the option of following the terms and conditions either of that numbered 581 | version or of any later version published by the Free Software Foundation. If the 582 | Program does not specify a version number of the GNU General Public License, you 583 | may choose any version ever published by the Free Software Foundation. 584 | 585 | If the 586 | Program specifies that a proxy can decide which future versions of the GNU 587 | General Public License can be used, that proxy's public statement of acceptance 588 | of a version permanently authorizes you to choose that version for the Program. 589 | 590 | 591 | Later license versions may give you additional or different permissions. However, 592 | no additional obligations are imposed on any author or copyright holder as a 593 | result of your choosing to follow a later version. 594 | 595 | 15. Disclaimer of 596 | Warranty. 597 | 598 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 599 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS 600 | AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, 601 | EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 602 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE 603 | RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 604 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR 605 | OR CORRECTION. 606 | 607 | 16. Limitation of Liability. 608 | 609 | IN NO EVENT UNLESS REQUIRED 610 | BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER 611 | PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO 612 | YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL 613 | DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT 614 | LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 615 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 616 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY 617 | OF SUCH DAMAGES. 618 | 619 | 17. Interpretation of Sections 15 and 16. 620 | 621 | If the 622 | disclaimer of warranty and limitation of liability provided above cannot be given 623 | local legal effect according to their terms, reviewing courts shall apply local 624 | law that most closely approximates an absolute waiver of all civil liability in 625 | connection with the Program, unless a warranty or assumption of liability 626 | accompanies a copy of the Program in return for a fee. END OF TERMS AND 627 | CONDITIONS 628 | 629 | How to Apply These Terms to Your New Programs 630 | 631 | If you develop a new 632 | program, and you want it to be of the greatest possible use to the public, the 633 | best way to achieve this is to make it free software which everyone can 634 | redistribute and change under these terms. 635 | 636 | To do so, attach the following 637 | notices to the program. It is safest to attach them to the start of each source 638 | file to most effectively state the exclusion of warranty; and each file should 639 | have at least the "copyright" line and a pointer to where the full notice is 640 | found. 641 | 642 | 644 | 645 | Copyright (C) 2023 646 | 647 | This program is free software: you 648 | can redistribute it and/or modify it under the terms of the GNU General Public 649 | License as published by the Free Software Foundation, either version 3 of the 650 | License, or (at your option) any later version. 651 | 652 | This program is distributed in 653 | the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the 654 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 655 | GNU General Public License for more details. 656 | 657 | You should have received a copy of 658 | the GNU General Public License along with this program. If not, see 659 | . 660 | 661 | Also add information on how to contact you by 662 | electronic and paper mail. 663 | 664 | If the program does terminal interaction, make it 665 | output a short notice like this when it starts in an interactive mode: 666 | 667 | 668 | Copyright (C) 2023 669 | 670 | This program comes with ABSOLUTELY NO 671 | WARRANTY; for details type `show w'. 672 | 673 | This is free software, and you are welcome 674 | to redistribute it under certain conditions; type `show c' for details. 675 | 676 | The 677 | hypothetical commands `show w' and `show c' should show the appropriate parts of 678 | the General Public License. Of course, your program's commands might be 679 | different; for a GUI interface, you would use an "about box". 680 | 681 | You should also 682 | get your employer (if you work as a programmer) or school, if any, to sign a 683 | "copyright disclaimer" for the program, if necessary. For more information on 684 | this, and how to apply and follow the GNU GPL, see 685 | . 686 | 687 | The GNU General Public License does not permit 688 | incorporating your program into proprietary programs. If your program is a 689 | subroutine library, you may consider it more useful to permit linking proprietary 690 | applications with the library. If this is what you want to do, use the GNU Lesser 691 | General Public License instead of this License. But first, please read 692 | . -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | ![Sample Image Generator](https://og-image-rest-generator.fly.dev/seo-banner?title=OG:IMAGE%20REST%20Generator%20-%20Free%20And%20Open%20Source!&author=darkterminal&head=Baby%20Tyrex%20Release&writer=Punk%20Storyteller) 3 | 4 |

OG:IMAGE REST Generator

5 | 6 |

7 | OG:IMAGE REST Generator is a free and powerful tool that simplifies the process of generating Open Graph images for your website or application. With our RESTful API, you can quickly and easily create customized images that will make your content stand out on social media platforms like Facebook, Twitter, Instagram, Pinterest and LinkedIn. 8 |

9 | 10 |

11 | Try This! 12 |

13 | 14 | ## Endpoint URL 15 | ```bash 16 | https://og-image-rest-generator.fly.dev 17 | ``` 18 | 19 | ## Usage 20 | ```http 21 | GET /seo-banner 22 | ``` 23 | 24 | | Query | Type | Description | 25 | | :-------- | :------- | :-------------------------------- | 26 | | `head` | `string` | the head title legend | 27 | | `title` | `string` | the title of the article or site you want to appear in the image | 28 | | `writer` | `string` | the author legend | 29 | | `author` | `string` | the name of author | 30 | | `logo` | `string` | the logo of your app / web | 31 | | `template` | `string` | Choose one: `default`, `facebook`, `facebook-minimal`, `twitter`, `twitter-minimal`, `instagram`, `instagram-minimal`, `linkedin`, `linkedin-minimal`, `pinterest` | 32 | 33 | ## Sample Images 34 | 35 | ### Default template (1342x853) 36 | ![Template Default](images/sample-ogDefault.png) 37 | 38 | ### Facebook template (Recommended size: 1200 x 630 pixels) 39 | ![Template Facebook](images/sample-ogFacebook.png) 40 | 41 | ### Facebook Minimal template (Minimum size: 600 x 315 pixels) 42 | ![Template Facebook Minimal](images/sample-ogFacebookMinimal.png) 43 | 44 | ### Twitter template (Recommended size: 1200 x 675 pixels) 45 | ![Template Twitter](images/sample-ogTwitter.png) 46 | 47 | ### Twitter Minimal template (Minimum size: 600 x 335 pixels) 48 | ![Template Twitter Minimal](images/sample-ogTwitterMinimal.png) 49 | 50 | ### Linkedin template (Recommended size: 1200 x 675 pixels) 51 | ![Template Linkedin](images/sample-ogLinkedin.png) 52 | 53 | ### Linkedin Minimal template (Minimum size: 600 x 400 pixels) 54 | ![Template Linkedin Minimal](images/sample-ogLinkedinMinimal.png) 55 | 56 | ### Instagram template (Recommended size: 1080 x 1080 pixels) 57 | ![Template Instagram](images/sample-ogInstagram.png) 58 | 59 | ### Instagram Minimal template (Minimum size: 600 x 600 pixels) 60 | ![Template Instagram Minimal](images/sample-ogInstagramMinimal.png) 61 | 62 | ### Pinterest template (Recommended size: 1000 x 1500 pixels) 63 | ![Template Pinterest](images/sample-ogPinterest.png) 64 | 65 | ## Help Wanted 66 | - [ ] Improve font scaling and title truncation 67 | - [ ] Improve layouts 68 | - [ ] Adding more fonts (Currently using `Inter Extrabold` and `Inter Medium`) 69 | 70 | Welcoming everyone that have passion and skill to make this app powerfull and free. 71 | 72 | ## Contribute 73 | 74 | OG:IMAGE REST Generator is an open-source project, and we welcome contributions from developers and enthusiasts of all levels of experience. 75 | 76 | [CONTRIBUTING.md](CONTRIBUTING.md) 77 | 78 | ## Donation / Support 79 | If you find OG:IMAGE REST Generator to be a helpful tool for your website or application, please consider supporting the project. Your donation or sponsorship can help ensure that the project continues to thrive and improve over time. You can sponsor the project directly through Github Sponsor or donate through Paypal. Your support is greatly appreciated and will help to ensure that this powerful tool remains available for free to users all over the world. Thank you for your generosity and support! 80 | -------------------------------------------------------------------------------- /fly.toml: -------------------------------------------------------------------------------- 1 | # fly.toml file generated for og-image-rest-generator on 2023-03-15T21:17:50+07:00 2 | 3 | app = "og-image-rest-generator" 4 | kill_signal = "SIGINT" 5 | kill_timeout = 5 6 | primary_region = "sin" 7 | processes = [] 8 | 9 | [env] 10 | FONTCONFIG_PATH = "/etc/fonts" 11 | PORT = "8080" 12 | 13 | [experimental] 14 | auto_rollback = true 15 | 16 | [[services]] 17 | http_checks = [] 18 | internal_port = 8080 19 | processes = ["app"] 20 | protocol = "tcp" 21 | script_checks = [] 22 | [services.concurrency] 23 | hard_limit = 25 24 | soft_limit = 20 25 | type = "connections" 26 | 27 | [[services.ports]] 28 | force_https = true 29 | handlers = ["http"] 30 | port = 80 31 | 32 | [[services.ports]] 33 | handlers = ["tls", "http"] 34 | port = 443 35 | 36 | [[services.tcp_checks]] 37 | grace_period = "1s" 38 | interval = "15s" 39 | restart_limit = 0 40 | timeout = "2s" 41 | -------------------------------------------------------------------------------- /fonts/Apple-Emoji.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkterminal/og-image-rest-generator/dc7f1e976936502337a330722ac513cfcba97b32/fonts/Apple-Emoji.ttf -------------------------------------------------------------------------------- /fonts/Inter-ExtraBold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkterminal/og-image-rest-generator/dc7f1e976936502337a330722ac513cfcba97b32/fonts/Inter-ExtraBold.ttf -------------------------------------------------------------------------------- /fonts/Inter-Medium.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkterminal/og-image-rest-generator/dc7f1e976936502337a330722ac513cfcba97b32/fonts/Inter-Medium.ttf -------------------------------------------------------------------------------- /images/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkterminal/og-image-rest-generator/dc7f1e976936502337a330722ac513cfcba97b32/images/.gitkeep -------------------------------------------------------------------------------- /images/classic-seo-banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkterminal/og-image-rest-generator/dc7f1e976936502337a330722ac513cfcba97b32/images/classic-seo-banner.png -------------------------------------------------------------------------------- /images/create-banner-image-from-grithub-action.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkterminal/og-image-rest-generator/dc7f1e976936502337a330722ac513cfcba97b32/images/create-banner-image-from-grithub-action.png -------------------------------------------------------------------------------- /images/sample-ogDefault.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkterminal/og-image-rest-generator/dc7f1e976936502337a330722ac513cfcba97b32/images/sample-ogDefault.png -------------------------------------------------------------------------------- /images/sample-ogFacebook.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkterminal/og-image-rest-generator/dc7f1e976936502337a330722ac513cfcba97b32/images/sample-ogFacebook.png -------------------------------------------------------------------------------- /images/sample-ogFacebookMinimal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkterminal/og-image-rest-generator/dc7f1e976936502337a330722ac513cfcba97b32/images/sample-ogFacebookMinimal.png -------------------------------------------------------------------------------- /images/sample-ogInstagram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkterminal/og-image-rest-generator/dc7f1e976936502337a330722ac513cfcba97b32/images/sample-ogInstagram.png -------------------------------------------------------------------------------- /images/sample-ogInstagramMinimal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkterminal/og-image-rest-generator/dc7f1e976936502337a330722ac513cfcba97b32/images/sample-ogInstagramMinimal.png -------------------------------------------------------------------------------- /images/sample-ogLinkedin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkterminal/og-image-rest-generator/dc7f1e976936502337a330722ac513cfcba97b32/images/sample-ogLinkedin.png -------------------------------------------------------------------------------- /images/sample-ogLinkedinMinimal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkterminal/og-image-rest-generator/dc7f1e976936502337a330722ac513cfcba97b32/images/sample-ogLinkedinMinimal.png -------------------------------------------------------------------------------- /images/sample-ogPinterest.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkterminal/og-image-rest-generator/dc7f1e976936502337a330722ac513cfcba97b32/images/sample-ogPinterest.png -------------------------------------------------------------------------------- /images/sample-ogTwitter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkterminal/og-image-rest-generator/dc7f1e976936502337a330722ac513cfcba97b32/images/sample-ogTwitter.png -------------------------------------------------------------------------------- /images/sample-ogTwitterMinimal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkterminal/og-image-rest-generator/dc7f1e976936502337a330722ac513cfcba97b32/images/sample-ogTwitterMinimal.png -------------------------------------------------------------------------------- /images/seo-banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darkterminal/og-image-rest-generator/dc7f1e976936502337a330722ac513cfcba97b32/images/seo-banner.png -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | const app = require('./src/app'); 2 | 3 | const port = process.env.PORT || "8080"; 4 | app.listen(port, () => { 5 | console.log(`Listening: http://localhost:${port}`); 6 | }); 7 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "og-image-rest-generator", 3 | "version": "1.1.0", 4 | "description": "free and powerful tool that simplifies the process of generating Open Graph images for your website or application", 5 | "main": "index.js", 6 | "scripts": { 7 | "dev": "nodemon index.js", 8 | "start": "node index.js" 9 | }, 10 | "keywords": [ 11 | "SEO Banner", 12 | "Banner Generator", 13 | "Node Image Generator", 14 | "Free Banner Generator", 15 | "Javascript" 16 | ], 17 | "author": "Imam Ali Mustofa (https://github.com/darkterminal)", 18 | "license": "GPL-3.0-only", 19 | "dependencies": { 20 | "canvas": "^2.11.0", 21 | "compression": "^1.7.4", 22 | "cors": "^2.8.5", 23 | "express": "^4.18.2", 24 | "helmet": "^6.0.1", 25 | "morgan": "^1.10.0" 26 | }, 27 | "devDependencies": { 28 | "nodemon": "^2.0.21" 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /pnpm-lock.yaml: -------------------------------------------------------------------------------- 1 | lockfileVersion: 5.4 2 | 3 | specifiers: 4 | canvas: ^2.11.0 5 | compression: ^1.7.4 6 | cors: ^2.8.5 7 | express: ^4.18.2 8 | helmet: ^6.0.1 9 | morgan: ^1.10.0 10 | nodemon: ^2.0.21 11 | 12 | dependencies: 13 | canvas: 2.11.0 14 | compression: 1.7.4 15 | cors: 2.8.5 16 | express: 4.18.2 17 | helmet: 6.0.1 18 | morgan: 1.10.0 19 | 20 | devDependencies: 21 | nodemon: 2.0.21 22 | 23 | packages: 24 | 25 | /@mapbox/node-pre-gyp/1.0.10: 26 | resolution: {integrity: sha512-4ySo4CjzStuprMwk35H5pPbkymjv1SF3jGLj6rAHp/xT/RF7TL7bd9CTm1xDY49K2qF7jmR/g7k+SkLETP6opA==} 27 | hasBin: true 28 | dependencies: 29 | detect-libc: 2.0.1 30 | https-proxy-agent: 5.0.1 31 | make-dir: 3.1.0 32 | node-fetch: 2.6.9 33 | nopt: 5.0.0 34 | npmlog: 5.0.1 35 | rimraf: 3.0.2 36 | semver: 7.3.8 37 | tar: 6.1.13 38 | transitivePeerDependencies: 39 | - encoding 40 | - supports-color 41 | dev: false 42 | 43 | /abbrev/1.1.1: 44 | resolution: {integrity: sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==} 45 | 46 | /accepts/1.3.8: 47 | resolution: {integrity: sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==} 48 | engines: {node: '>= 0.6'} 49 | dependencies: 50 | mime-types: 2.1.35 51 | negotiator: 0.6.3 52 | dev: false 53 | 54 | /agent-base/6.0.2: 55 | resolution: {integrity: sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==} 56 | engines: {node: '>= 6.0.0'} 57 | dependencies: 58 | debug: 4.3.4 59 | transitivePeerDependencies: 60 | - supports-color 61 | dev: false 62 | 63 | /ansi-regex/5.0.1: 64 | resolution: {integrity: sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==} 65 | engines: {node: '>=8'} 66 | dev: false 67 | 68 | /anymatch/3.1.3: 69 | resolution: {integrity: sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==} 70 | engines: {node: '>= 8'} 71 | dependencies: 72 | normalize-path: 3.0.0 73 | picomatch: 2.3.1 74 | dev: true 75 | 76 | /aproba/2.0.0: 77 | resolution: {integrity: sha512-lYe4Gx7QT+MKGbDsA+Z+he/Wtef0BiwDOlK/XkBrdfsh9J/jPPXbX0tE9x9cl27Tmu5gg3QUbUrQYa/y+KOHPQ==} 78 | dev: false 79 | 80 | /are-we-there-yet/2.0.0: 81 | resolution: {integrity: sha512-Ci/qENmwHnsYo9xKIcUJN5LeDKdJ6R1Z1j9V/J5wyq8nh/mYPEpIKJbBZXtZjG04HiK7zV/p6Vs9952MrMeUIw==} 82 | engines: {node: '>=10'} 83 | dependencies: 84 | delegates: 1.0.0 85 | readable-stream: 3.6.2 86 | dev: false 87 | 88 | /array-flatten/1.1.1: 89 | resolution: {integrity: sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==} 90 | dev: false 91 | 92 | /balanced-match/1.0.2: 93 | resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==} 94 | 95 | /basic-auth/2.0.1: 96 | resolution: {integrity: sha512-NF+epuEdnUYVlGuhaxbbq+dvJttwLnGY+YixlXlME5KpQ5W3CnXA5cVTneY3SPbPDRkcjMbifrwmFYcClgOZeg==} 97 | engines: {node: '>= 0.8'} 98 | dependencies: 99 | safe-buffer: 5.1.2 100 | dev: false 101 | 102 | /binary-extensions/2.2.0: 103 | resolution: {integrity: sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==} 104 | engines: {node: '>=8'} 105 | dev: true 106 | 107 | /body-parser/1.20.1: 108 | resolution: {integrity: sha512-jWi7abTbYwajOytWCQc37VulmWiRae5RyTpaCyDcS5/lMdtwSz5lOpDE67srw/HYe35f1z3fDQw+3txg7gNtWw==} 109 | engines: {node: '>= 0.8', npm: 1.2.8000 || >= 1.4.16} 110 | dependencies: 111 | bytes: 3.1.2 112 | content-type: 1.0.5 113 | debug: 2.6.9 114 | depd: 2.0.0 115 | destroy: 1.2.0 116 | http-errors: 2.0.0 117 | iconv-lite: 0.4.24 118 | on-finished: 2.4.1 119 | qs: 6.11.0 120 | raw-body: 2.5.1 121 | type-is: 1.6.18 122 | unpipe: 1.0.0 123 | transitivePeerDependencies: 124 | - supports-color 125 | dev: false 126 | 127 | /brace-expansion/1.1.11: 128 | resolution: {integrity: sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==} 129 | dependencies: 130 | balanced-match: 1.0.2 131 | concat-map: 0.0.1 132 | 133 | /braces/3.0.2: 134 | resolution: {integrity: sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==} 135 | engines: {node: '>=8'} 136 | dependencies: 137 | fill-range: 7.0.1 138 | dev: true 139 | 140 | /bytes/3.0.0: 141 | resolution: {integrity: sha512-pMhOfFDPiv9t5jjIXkHosWmkSyQbvsgEVNkz0ERHbuLh2T/7j4Mqqpz523Fe8MVY89KC6Sh/QfS2sM+SjgFDcw==} 142 | engines: {node: '>= 0.8'} 143 | dev: false 144 | 145 | /bytes/3.1.2: 146 | resolution: {integrity: sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==} 147 | engines: {node: '>= 0.8'} 148 | dev: false 149 | 150 | /call-bind/1.0.2: 151 | resolution: {integrity: sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==} 152 | dependencies: 153 | function-bind: 1.1.1 154 | get-intrinsic: 1.2.0 155 | dev: false 156 | 157 | /canvas/2.11.0: 158 | resolution: {integrity: sha512-bdTjFexjKJEwtIo0oRx8eD4G2yWoUOXP9lj279jmQ2zMnTQhT8C3512OKz3s+ZOaQlLbE7TuVvRDYDB3Llyy5g==} 159 | engines: {node: '>=6'} 160 | requiresBuild: true 161 | dependencies: 162 | '@mapbox/node-pre-gyp': 1.0.10 163 | nan: 2.17.0 164 | simple-get: 3.1.1 165 | transitivePeerDependencies: 166 | - encoding 167 | - supports-color 168 | dev: false 169 | 170 | /chokidar/3.5.3: 171 | resolution: {integrity: sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==} 172 | engines: {node: '>= 8.10.0'} 173 | dependencies: 174 | anymatch: 3.1.3 175 | braces: 3.0.2 176 | glob-parent: 5.1.2 177 | is-binary-path: 2.1.0 178 | is-glob: 4.0.3 179 | normalize-path: 3.0.0 180 | readdirp: 3.6.0 181 | optionalDependencies: 182 | fsevents: 2.3.2 183 | dev: true 184 | 185 | /chownr/2.0.0: 186 | resolution: {integrity: sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==} 187 | engines: {node: '>=10'} 188 | dev: false 189 | 190 | /color-support/1.1.3: 191 | resolution: {integrity: sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg==} 192 | hasBin: true 193 | dev: false 194 | 195 | /compressible/2.0.18: 196 | resolution: {integrity: sha512-AF3r7P5dWxL8MxyITRMlORQNaOA2IkAFaTr4k7BUumjPtRpGDTZpl0Pb1XCO6JeDCBdp126Cgs9sMxqSjgYyRg==} 197 | engines: {node: '>= 0.6'} 198 | dependencies: 199 | mime-db: 1.52.0 200 | dev: false 201 | 202 | /compression/1.7.4: 203 | resolution: {integrity: sha512-jaSIDzP9pZVS4ZfQ+TzvtiWhdpFhE2RDHz8QJkpX9SIpLq88VueF5jJw6t+6CUQcAoA6t+x89MLrWAqpfDE8iQ==} 204 | engines: {node: '>= 0.8.0'} 205 | dependencies: 206 | accepts: 1.3.8 207 | bytes: 3.0.0 208 | compressible: 2.0.18 209 | debug: 2.6.9 210 | on-headers: 1.0.2 211 | safe-buffer: 5.1.2 212 | vary: 1.1.2 213 | transitivePeerDependencies: 214 | - supports-color 215 | dev: false 216 | 217 | /concat-map/0.0.1: 218 | resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==} 219 | 220 | /console-control-strings/1.1.0: 221 | resolution: {integrity: sha512-ty/fTekppD2fIwRvnZAVdeOiGd1c7YXEixbgJTNzqcxJWKQnjJ/V1bNEEE6hygpM3WjwHFUVK6HTjWSzV4a8sQ==} 222 | dev: false 223 | 224 | /content-disposition/0.5.4: 225 | resolution: {integrity: sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==} 226 | engines: {node: '>= 0.6'} 227 | dependencies: 228 | safe-buffer: 5.2.1 229 | dev: false 230 | 231 | /content-type/1.0.5: 232 | resolution: {integrity: sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==} 233 | engines: {node: '>= 0.6'} 234 | dev: false 235 | 236 | /cookie-signature/1.0.6: 237 | resolution: {integrity: sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==} 238 | dev: false 239 | 240 | /cookie/0.5.0: 241 | resolution: {integrity: sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==} 242 | engines: {node: '>= 0.6'} 243 | dev: false 244 | 245 | /cors/2.8.5: 246 | resolution: {integrity: sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==} 247 | engines: {node: '>= 0.10'} 248 | dependencies: 249 | object-assign: 4.1.1 250 | vary: 1.1.2 251 | dev: false 252 | 253 | /debug/2.6.9: 254 | resolution: {integrity: sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==} 255 | peerDependencies: 256 | supports-color: '*' 257 | peerDependenciesMeta: 258 | supports-color: 259 | optional: true 260 | dependencies: 261 | ms: 2.0.0 262 | dev: false 263 | 264 | /debug/3.2.7_supports-color@5.5.0: 265 | resolution: {integrity: sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==} 266 | peerDependencies: 267 | supports-color: '*' 268 | peerDependenciesMeta: 269 | supports-color: 270 | optional: true 271 | dependencies: 272 | ms: 2.1.3 273 | supports-color: 5.5.0 274 | dev: true 275 | 276 | /debug/4.3.4: 277 | resolution: {integrity: sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==} 278 | engines: {node: '>=6.0'} 279 | peerDependencies: 280 | supports-color: '*' 281 | peerDependenciesMeta: 282 | supports-color: 283 | optional: true 284 | dependencies: 285 | ms: 2.1.2 286 | dev: false 287 | 288 | /decompress-response/4.2.1: 289 | resolution: {integrity: sha512-jOSne2qbyE+/r8G1VU+G/82LBs2Fs4LAsTiLSHOCOMZQl2OKZ6i8i4IyHemTe+/yIXOtTcRQMzPcgyhoFlqPkw==} 290 | engines: {node: '>=8'} 291 | dependencies: 292 | mimic-response: 2.1.0 293 | dev: false 294 | 295 | /delegates/1.0.0: 296 | resolution: {integrity: sha512-bd2L678uiWATM6m5Z1VzNCErI3jiGzt6HGY8OVICs40JQq/HALfbyNJmp0UDakEY4pMMaN0Ly5om/B1VI/+xfQ==} 297 | dev: false 298 | 299 | /depd/2.0.0: 300 | resolution: {integrity: sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==} 301 | engines: {node: '>= 0.8'} 302 | dev: false 303 | 304 | /destroy/1.2.0: 305 | resolution: {integrity: sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==} 306 | engines: {node: '>= 0.8', npm: 1.2.8000 || >= 1.4.16} 307 | dev: false 308 | 309 | /detect-libc/2.0.1: 310 | resolution: {integrity: sha512-463v3ZeIrcWtdgIg6vI6XUncguvr2TnGl4SzDXinkt9mSLpBJKXT3mW6xT3VQdDN11+WVs29pgvivTc4Lp8v+w==} 311 | engines: {node: '>=8'} 312 | dev: false 313 | 314 | /ee-first/1.1.1: 315 | resolution: {integrity: sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==} 316 | dev: false 317 | 318 | /emoji-regex/8.0.0: 319 | resolution: {integrity: sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==} 320 | dev: false 321 | 322 | /encodeurl/1.0.2: 323 | resolution: {integrity: sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==} 324 | engines: {node: '>= 0.8'} 325 | dev: false 326 | 327 | /escape-html/1.0.3: 328 | resolution: {integrity: sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==} 329 | dev: false 330 | 331 | /etag/1.8.1: 332 | resolution: {integrity: sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==} 333 | engines: {node: '>= 0.6'} 334 | dev: false 335 | 336 | /express/4.18.2: 337 | resolution: {integrity: sha512-5/PsL6iGPdfQ/lKM1UuielYgv3BUoJfz1aUwU9vHZ+J7gyvwdQXFEBIEIaxeGf0GIcreATNyBExtalisDbuMqQ==} 338 | engines: {node: '>= 0.10.0'} 339 | dependencies: 340 | accepts: 1.3.8 341 | array-flatten: 1.1.1 342 | body-parser: 1.20.1 343 | content-disposition: 0.5.4 344 | content-type: 1.0.5 345 | cookie: 0.5.0 346 | cookie-signature: 1.0.6 347 | debug: 2.6.9 348 | depd: 2.0.0 349 | encodeurl: 1.0.2 350 | escape-html: 1.0.3 351 | etag: 1.8.1 352 | finalhandler: 1.2.0 353 | fresh: 0.5.2 354 | http-errors: 2.0.0 355 | merge-descriptors: 1.0.1 356 | methods: 1.1.2 357 | on-finished: 2.4.1 358 | parseurl: 1.3.3 359 | path-to-regexp: 0.1.7 360 | proxy-addr: 2.0.7 361 | qs: 6.11.0 362 | range-parser: 1.2.1 363 | safe-buffer: 5.2.1 364 | send: 0.18.0 365 | serve-static: 1.15.0 366 | setprototypeof: 1.2.0 367 | statuses: 2.0.1 368 | type-is: 1.6.18 369 | utils-merge: 1.0.1 370 | vary: 1.1.2 371 | transitivePeerDependencies: 372 | - supports-color 373 | dev: false 374 | 375 | /fill-range/7.0.1: 376 | resolution: {integrity: sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==} 377 | engines: {node: '>=8'} 378 | dependencies: 379 | to-regex-range: 5.0.1 380 | dev: true 381 | 382 | /finalhandler/1.2.0: 383 | resolution: {integrity: sha512-5uXcUVftlQMFnWC9qu/svkWv3GTd2PfUhK/3PLkYNAe7FbqJMt3515HaxE6eRL74GdsriiwujiawdaB1BpEISg==} 384 | engines: {node: '>= 0.8'} 385 | dependencies: 386 | debug: 2.6.9 387 | encodeurl: 1.0.2 388 | escape-html: 1.0.3 389 | on-finished: 2.4.1 390 | parseurl: 1.3.3 391 | statuses: 2.0.1 392 | unpipe: 1.0.0 393 | transitivePeerDependencies: 394 | - supports-color 395 | dev: false 396 | 397 | /forwarded/0.2.0: 398 | resolution: {integrity: sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==} 399 | engines: {node: '>= 0.6'} 400 | dev: false 401 | 402 | /fresh/0.5.2: 403 | resolution: {integrity: sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==} 404 | engines: {node: '>= 0.6'} 405 | dev: false 406 | 407 | /fs-minipass/2.1.0: 408 | resolution: {integrity: sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==} 409 | engines: {node: '>= 8'} 410 | dependencies: 411 | minipass: 3.3.6 412 | dev: false 413 | 414 | /fs.realpath/1.0.0: 415 | resolution: {integrity: sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==} 416 | dev: false 417 | 418 | /fsevents/2.3.2: 419 | resolution: {integrity: sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==} 420 | engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} 421 | os: [darwin] 422 | requiresBuild: true 423 | dev: true 424 | optional: true 425 | 426 | /function-bind/1.1.1: 427 | resolution: {integrity: sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==} 428 | dev: false 429 | 430 | /gauge/3.0.2: 431 | resolution: {integrity: sha512-+5J6MS/5XksCuXq++uFRsnUd7Ovu1XenbeuIuNRJxYWjgQbPuFhT14lAvsWfqfAmnwluf1OwMjz39HjfLPci0Q==} 432 | engines: {node: '>=10'} 433 | dependencies: 434 | aproba: 2.0.0 435 | color-support: 1.1.3 436 | console-control-strings: 1.1.0 437 | has-unicode: 2.0.1 438 | object-assign: 4.1.1 439 | signal-exit: 3.0.7 440 | string-width: 4.2.3 441 | strip-ansi: 6.0.1 442 | wide-align: 1.1.5 443 | dev: false 444 | 445 | /get-intrinsic/1.2.0: 446 | resolution: {integrity: sha512-L049y6nFOuom5wGyRc3/gdTLO94dySVKRACj1RmJZBQXlbTMhtNIgkWkUHq+jYmZvKf14EW1EoJnnjbmoHij0Q==} 447 | dependencies: 448 | function-bind: 1.1.1 449 | has: 1.0.3 450 | has-symbols: 1.0.3 451 | dev: false 452 | 453 | /glob-parent/5.1.2: 454 | resolution: {integrity: sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==} 455 | engines: {node: '>= 6'} 456 | dependencies: 457 | is-glob: 4.0.3 458 | dev: true 459 | 460 | /glob/7.2.3: 461 | resolution: {integrity: sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==} 462 | dependencies: 463 | fs.realpath: 1.0.0 464 | inflight: 1.0.6 465 | inherits: 2.0.4 466 | minimatch: 3.1.2 467 | once: 1.4.0 468 | path-is-absolute: 1.0.1 469 | dev: false 470 | 471 | /has-flag/3.0.0: 472 | resolution: {integrity: sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==} 473 | engines: {node: '>=4'} 474 | dev: true 475 | 476 | /has-symbols/1.0.3: 477 | resolution: {integrity: sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==} 478 | engines: {node: '>= 0.4'} 479 | dev: false 480 | 481 | /has-unicode/2.0.1: 482 | resolution: {integrity: sha512-8Rf9Y83NBReMnx0gFzA8JImQACstCYWUplepDa9xprwwtmgEZUF0h/i5xSA625zB/I37EtrswSST6OXxwaaIJQ==} 483 | dev: false 484 | 485 | /has/1.0.3: 486 | resolution: {integrity: sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==} 487 | engines: {node: '>= 0.4.0'} 488 | dependencies: 489 | function-bind: 1.1.1 490 | dev: false 491 | 492 | /helmet/6.0.1: 493 | resolution: {integrity: sha512-8wo+VdQhTMVBMCITYZaGTbE4lvlthelPYSvoyNvk4RECTmrVjMerp9RfUOQXZWLvCcAn1pKj7ZRxK4lI9Alrcw==} 494 | engines: {node: '>=14.0.0'} 495 | dev: false 496 | 497 | /http-errors/2.0.0: 498 | resolution: {integrity: sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==} 499 | engines: {node: '>= 0.8'} 500 | dependencies: 501 | depd: 2.0.0 502 | inherits: 2.0.4 503 | setprototypeof: 1.2.0 504 | statuses: 2.0.1 505 | toidentifier: 1.0.1 506 | dev: false 507 | 508 | /https-proxy-agent/5.0.1: 509 | resolution: {integrity: sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==} 510 | engines: {node: '>= 6'} 511 | dependencies: 512 | agent-base: 6.0.2 513 | debug: 4.3.4 514 | transitivePeerDependencies: 515 | - supports-color 516 | dev: false 517 | 518 | /iconv-lite/0.4.24: 519 | resolution: {integrity: sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==} 520 | engines: {node: '>=0.10.0'} 521 | dependencies: 522 | safer-buffer: 2.1.2 523 | dev: false 524 | 525 | /ignore-by-default/1.0.1: 526 | resolution: {integrity: sha512-Ius2VYcGNk7T90CppJqcIkS5ooHUZyIQK+ClZfMfMNFEF9VSE73Fq+906u/CWu92x4gzZMWOwfFYckPObzdEbA==} 527 | dev: true 528 | 529 | /inflight/1.0.6: 530 | resolution: {integrity: sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==} 531 | dependencies: 532 | once: 1.4.0 533 | wrappy: 1.0.2 534 | dev: false 535 | 536 | /inherits/2.0.4: 537 | resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==} 538 | dev: false 539 | 540 | /ipaddr.js/1.9.1: 541 | resolution: {integrity: sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==} 542 | engines: {node: '>= 0.10'} 543 | dev: false 544 | 545 | /is-binary-path/2.1.0: 546 | resolution: {integrity: sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==} 547 | engines: {node: '>=8'} 548 | dependencies: 549 | binary-extensions: 2.2.0 550 | dev: true 551 | 552 | /is-extglob/2.1.1: 553 | resolution: {integrity: sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==} 554 | engines: {node: '>=0.10.0'} 555 | dev: true 556 | 557 | /is-fullwidth-code-point/3.0.0: 558 | resolution: {integrity: sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==} 559 | engines: {node: '>=8'} 560 | dev: false 561 | 562 | /is-glob/4.0.3: 563 | resolution: {integrity: sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==} 564 | engines: {node: '>=0.10.0'} 565 | dependencies: 566 | is-extglob: 2.1.1 567 | dev: true 568 | 569 | /is-number/7.0.0: 570 | resolution: {integrity: sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==} 571 | engines: {node: '>=0.12.0'} 572 | dev: true 573 | 574 | /lru-cache/6.0.0: 575 | resolution: {integrity: sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==} 576 | engines: {node: '>=10'} 577 | dependencies: 578 | yallist: 4.0.0 579 | dev: false 580 | 581 | /make-dir/3.1.0: 582 | resolution: {integrity: sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==} 583 | engines: {node: '>=8'} 584 | dependencies: 585 | semver: 6.3.0 586 | dev: false 587 | 588 | /media-typer/0.3.0: 589 | resolution: {integrity: sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==} 590 | engines: {node: '>= 0.6'} 591 | dev: false 592 | 593 | /merge-descriptors/1.0.1: 594 | resolution: {integrity: sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w==} 595 | dev: false 596 | 597 | /methods/1.1.2: 598 | resolution: {integrity: sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==} 599 | engines: {node: '>= 0.6'} 600 | dev: false 601 | 602 | /mime-db/1.52.0: 603 | resolution: {integrity: sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==} 604 | engines: {node: '>= 0.6'} 605 | dev: false 606 | 607 | /mime-types/2.1.35: 608 | resolution: {integrity: sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==} 609 | engines: {node: '>= 0.6'} 610 | dependencies: 611 | mime-db: 1.52.0 612 | dev: false 613 | 614 | /mime/1.6.0: 615 | resolution: {integrity: sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==} 616 | engines: {node: '>=4'} 617 | hasBin: true 618 | dev: false 619 | 620 | /mimic-response/2.1.0: 621 | resolution: {integrity: sha512-wXqjST+SLt7R009ySCglWBCFpjUygmCIfD790/kVbiGmUgfYGuB14PiTd5DwVxSV4NcYHjzMkoj5LjQZwTQLEA==} 622 | engines: {node: '>=8'} 623 | dev: false 624 | 625 | /minimatch/3.1.2: 626 | resolution: {integrity: sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==} 627 | dependencies: 628 | brace-expansion: 1.1.11 629 | 630 | /minipass/3.3.6: 631 | resolution: {integrity: sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==} 632 | engines: {node: '>=8'} 633 | dependencies: 634 | yallist: 4.0.0 635 | dev: false 636 | 637 | /minipass/4.2.5: 638 | resolution: {integrity: sha512-+yQl7SX3bIT83Lhb4BVorMAHVuqsskxRdlmO9kTpyukp8vsm2Sn/fUOV9xlnG8/a5JsypJzap21lz/y3FBMJ8Q==} 639 | engines: {node: '>=8'} 640 | dev: false 641 | 642 | /minizlib/2.1.2: 643 | resolution: {integrity: sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==} 644 | engines: {node: '>= 8'} 645 | dependencies: 646 | minipass: 3.3.6 647 | yallist: 4.0.0 648 | dev: false 649 | 650 | /mkdirp/1.0.4: 651 | resolution: {integrity: sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==} 652 | engines: {node: '>=10'} 653 | hasBin: true 654 | dev: false 655 | 656 | /morgan/1.10.0: 657 | resolution: {integrity: sha512-AbegBVI4sh6El+1gNwvD5YIck7nSA36weD7xvIxG4in80j/UoK8AEGaWnnz8v1GxonMCltmlNs5ZKbGvl9b1XQ==} 658 | engines: {node: '>= 0.8.0'} 659 | dependencies: 660 | basic-auth: 2.0.1 661 | debug: 2.6.9 662 | depd: 2.0.0 663 | on-finished: 2.3.0 664 | on-headers: 1.0.2 665 | transitivePeerDependencies: 666 | - supports-color 667 | dev: false 668 | 669 | /ms/2.0.0: 670 | resolution: {integrity: sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==} 671 | dev: false 672 | 673 | /ms/2.1.2: 674 | resolution: {integrity: sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==} 675 | dev: false 676 | 677 | /ms/2.1.3: 678 | resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==} 679 | 680 | /nan/2.17.0: 681 | resolution: {integrity: sha512-2ZTgtl0nJsO0KQCjEpxcIr5D+Yv90plTitZt9JBfQvVJDS5seMl3FOvsh3+9CoYWXf/1l5OaZzzF6nDm4cagaQ==} 682 | dev: false 683 | 684 | /negotiator/0.6.3: 685 | resolution: {integrity: sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==} 686 | engines: {node: '>= 0.6'} 687 | dev: false 688 | 689 | /node-fetch/2.6.9: 690 | resolution: {integrity: sha512-DJm/CJkZkRjKKj4Zi4BsKVZh3ValV5IR5s7LVZnW+6YMh0W1BfNA8XSs6DLMGYlId5F3KnA70uu2qepcR08Qqg==} 691 | engines: {node: 4.x || >=6.0.0} 692 | peerDependencies: 693 | encoding: ^0.1.0 694 | peerDependenciesMeta: 695 | encoding: 696 | optional: true 697 | dependencies: 698 | whatwg-url: 5.0.0 699 | dev: false 700 | 701 | /nodemon/2.0.21: 702 | resolution: {integrity: sha512-djN/n2549DUtY33S7o1djRCd7dEm0kBnj9c7S9XVXqRUbuggN1MZH/Nqa+5RFQr63Fbefq37nFXAE9VU86yL1A==} 703 | engines: {node: '>=8.10.0'} 704 | hasBin: true 705 | dependencies: 706 | chokidar: 3.5.3 707 | debug: 3.2.7_supports-color@5.5.0 708 | ignore-by-default: 1.0.1 709 | minimatch: 3.1.2 710 | pstree.remy: 1.1.8 711 | semver: 5.7.1 712 | simple-update-notifier: 1.1.0 713 | supports-color: 5.5.0 714 | touch: 3.1.0 715 | undefsafe: 2.0.5 716 | dev: true 717 | 718 | /nopt/1.0.10: 719 | resolution: {integrity: sha512-NWmpvLSqUrgrAC9HCuxEvb+PSloHpqVu+FqcO4eeF2h5qYRhA7ev6KvelyQAKtegUbC6RypJnlEOhd8vloNKYg==} 720 | hasBin: true 721 | dependencies: 722 | abbrev: 1.1.1 723 | dev: true 724 | 725 | /nopt/5.0.0: 726 | resolution: {integrity: sha512-Tbj67rffqceeLpcRXrT7vKAN8CwfPeIBgM7E6iBkmKLV7bEMwpGgYLGv0jACUsECaa/vuxP0IjEont6umdMgtQ==} 727 | engines: {node: '>=6'} 728 | hasBin: true 729 | dependencies: 730 | abbrev: 1.1.1 731 | dev: false 732 | 733 | /normalize-path/3.0.0: 734 | resolution: {integrity: sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==} 735 | engines: {node: '>=0.10.0'} 736 | dev: true 737 | 738 | /npmlog/5.0.1: 739 | resolution: {integrity: sha512-AqZtDUWOMKs1G/8lwylVjrdYgqA4d9nu8hc+0gzRxlDb1I10+FHBGMXs6aiQHFdCUUlqH99MUMuLfzWDNDtfxw==} 740 | dependencies: 741 | are-we-there-yet: 2.0.0 742 | console-control-strings: 1.1.0 743 | gauge: 3.0.2 744 | set-blocking: 2.0.0 745 | dev: false 746 | 747 | /object-assign/4.1.1: 748 | resolution: {integrity: sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==} 749 | engines: {node: '>=0.10.0'} 750 | dev: false 751 | 752 | /object-inspect/1.12.3: 753 | resolution: {integrity: sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g==} 754 | dev: false 755 | 756 | /on-finished/2.3.0: 757 | resolution: {integrity: sha512-ikqdkGAAyf/X/gPhXGvfgAytDZtDbr+bkNUJ0N9h5MI/dmdgCs3l6hoHrcUv41sRKew3jIwrp4qQDXiK99Utww==} 758 | engines: {node: '>= 0.8'} 759 | dependencies: 760 | ee-first: 1.1.1 761 | dev: false 762 | 763 | /on-finished/2.4.1: 764 | resolution: {integrity: sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==} 765 | engines: {node: '>= 0.8'} 766 | dependencies: 767 | ee-first: 1.1.1 768 | dev: false 769 | 770 | /on-headers/1.0.2: 771 | resolution: {integrity: sha512-pZAE+FJLoyITytdqK0U5s+FIpjN0JP3OzFi/u8Rx+EV5/W+JTWGXG8xFzevE7AjBfDqHv/8vL8qQsIhHnqRkrA==} 772 | engines: {node: '>= 0.8'} 773 | dev: false 774 | 775 | /once/1.4.0: 776 | resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==} 777 | dependencies: 778 | wrappy: 1.0.2 779 | dev: false 780 | 781 | /parseurl/1.3.3: 782 | resolution: {integrity: sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==} 783 | engines: {node: '>= 0.8'} 784 | dev: false 785 | 786 | /path-is-absolute/1.0.1: 787 | resolution: {integrity: sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==} 788 | engines: {node: '>=0.10.0'} 789 | dev: false 790 | 791 | /path-to-regexp/0.1.7: 792 | resolution: {integrity: sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ==} 793 | dev: false 794 | 795 | /picomatch/2.3.1: 796 | resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==} 797 | engines: {node: '>=8.6'} 798 | dev: true 799 | 800 | /proxy-addr/2.0.7: 801 | resolution: {integrity: sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==} 802 | engines: {node: '>= 0.10'} 803 | dependencies: 804 | forwarded: 0.2.0 805 | ipaddr.js: 1.9.1 806 | dev: false 807 | 808 | /pstree.remy/1.1.8: 809 | resolution: {integrity: sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w==} 810 | dev: true 811 | 812 | /qs/6.11.0: 813 | resolution: {integrity: sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==} 814 | engines: {node: '>=0.6'} 815 | dependencies: 816 | side-channel: 1.0.4 817 | dev: false 818 | 819 | /range-parser/1.2.1: 820 | resolution: {integrity: sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==} 821 | engines: {node: '>= 0.6'} 822 | dev: false 823 | 824 | /raw-body/2.5.1: 825 | resolution: {integrity: sha512-qqJBtEyVgS0ZmPGdCFPWJ3FreoqvG4MVQln/kCgF7Olq95IbOp0/BWyMwbdtn4VTvkM8Y7khCQ2Xgk/tcrCXig==} 826 | engines: {node: '>= 0.8'} 827 | dependencies: 828 | bytes: 3.1.2 829 | http-errors: 2.0.0 830 | iconv-lite: 0.4.24 831 | unpipe: 1.0.0 832 | dev: false 833 | 834 | /readable-stream/3.6.2: 835 | resolution: {integrity: sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==} 836 | engines: {node: '>= 6'} 837 | dependencies: 838 | inherits: 2.0.4 839 | string_decoder: 1.3.0 840 | util-deprecate: 1.0.2 841 | dev: false 842 | 843 | /readdirp/3.6.0: 844 | resolution: {integrity: sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==} 845 | engines: {node: '>=8.10.0'} 846 | dependencies: 847 | picomatch: 2.3.1 848 | dev: true 849 | 850 | /rimraf/3.0.2: 851 | resolution: {integrity: sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==} 852 | hasBin: true 853 | dependencies: 854 | glob: 7.2.3 855 | dev: false 856 | 857 | /safe-buffer/5.1.2: 858 | resolution: {integrity: sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==} 859 | dev: false 860 | 861 | /safe-buffer/5.2.1: 862 | resolution: {integrity: sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==} 863 | dev: false 864 | 865 | /safer-buffer/2.1.2: 866 | resolution: {integrity: sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==} 867 | dev: false 868 | 869 | /semver/5.7.1: 870 | resolution: {integrity: sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==} 871 | hasBin: true 872 | dev: true 873 | 874 | /semver/6.3.0: 875 | resolution: {integrity: sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==} 876 | hasBin: true 877 | dev: false 878 | 879 | /semver/7.0.0: 880 | resolution: {integrity: sha512-+GB6zVA9LWh6zovYQLALHwv5rb2PHGlJi3lfiqIHxR0uuwCgefcOJc59v9fv1w8GbStwxuuqqAjI9NMAOOgq1A==} 881 | hasBin: true 882 | dev: true 883 | 884 | /semver/7.3.8: 885 | resolution: {integrity: sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==} 886 | engines: {node: '>=10'} 887 | hasBin: true 888 | dependencies: 889 | lru-cache: 6.0.0 890 | dev: false 891 | 892 | /send/0.18.0: 893 | resolution: {integrity: sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==} 894 | engines: {node: '>= 0.8.0'} 895 | dependencies: 896 | debug: 2.6.9 897 | depd: 2.0.0 898 | destroy: 1.2.0 899 | encodeurl: 1.0.2 900 | escape-html: 1.0.3 901 | etag: 1.8.1 902 | fresh: 0.5.2 903 | http-errors: 2.0.0 904 | mime: 1.6.0 905 | ms: 2.1.3 906 | on-finished: 2.4.1 907 | range-parser: 1.2.1 908 | statuses: 2.0.1 909 | transitivePeerDependencies: 910 | - supports-color 911 | dev: false 912 | 913 | /serve-static/1.15.0: 914 | resolution: {integrity: sha512-XGuRDNjXUijsUL0vl6nSD7cwURuzEgglbOaFuZM9g3kwDXOWVTck0jLzjPzGD+TazWbboZYu52/9/XPdUgne9g==} 915 | engines: {node: '>= 0.8.0'} 916 | dependencies: 917 | encodeurl: 1.0.2 918 | escape-html: 1.0.3 919 | parseurl: 1.3.3 920 | send: 0.18.0 921 | transitivePeerDependencies: 922 | - supports-color 923 | dev: false 924 | 925 | /set-blocking/2.0.0: 926 | resolution: {integrity: sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==} 927 | dev: false 928 | 929 | /setprototypeof/1.2.0: 930 | resolution: {integrity: sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==} 931 | dev: false 932 | 933 | /side-channel/1.0.4: 934 | resolution: {integrity: sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==} 935 | dependencies: 936 | call-bind: 1.0.2 937 | get-intrinsic: 1.2.0 938 | object-inspect: 1.12.3 939 | dev: false 940 | 941 | /signal-exit/3.0.7: 942 | resolution: {integrity: sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==} 943 | dev: false 944 | 945 | /simple-concat/1.0.1: 946 | resolution: {integrity: sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==} 947 | dev: false 948 | 949 | /simple-get/3.1.1: 950 | resolution: {integrity: sha512-CQ5LTKGfCpvE1K0n2us+kuMPbk/q0EKl82s4aheV9oXjFEz6W/Y7oQFVJuU6QG77hRT4Ghb5RURteF5vnWjupA==} 951 | dependencies: 952 | decompress-response: 4.2.1 953 | once: 1.4.0 954 | simple-concat: 1.0.1 955 | dev: false 956 | 957 | /simple-update-notifier/1.1.0: 958 | resolution: {integrity: sha512-VpsrsJSUcJEseSbMHkrsrAVSdvVS5I96Qo1QAQ4FxQ9wXFcB+pjj7FB7/us9+GcgfW4ziHtYMc1J0PLczb55mg==} 959 | engines: {node: '>=8.10.0'} 960 | dependencies: 961 | semver: 7.0.0 962 | dev: true 963 | 964 | /statuses/2.0.1: 965 | resolution: {integrity: sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==} 966 | engines: {node: '>= 0.8'} 967 | dev: false 968 | 969 | /string-width/4.2.3: 970 | resolution: {integrity: sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==} 971 | engines: {node: '>=8'} 972 | dependencies: 973 | emoji-regex: 8.0.0 974 | is-fullwidth-code-point: 3.0.0 975 | strip-ansi: 6.0.1 976 | dev: false 977 | 978 | /string_decoder/1.3.0: 979 | resolution: {integrity: sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==} 980 | dependencies: 981 | safe-buffer: 5.2.1 982 | dev: false 983 | 984 | /strip-ansi/6.0.1: 985 | resolution: {integrity: sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==} 986 | engines: {node: '>=8'} 987 | dependencies: 988 | ansi-regex: 5.0.1 989 | dev: false 990 | 991 | /supports-color/5.5.0: 992 | resolution: {integrity: sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==} 993 | engines: {node: '>=4'} 994 | dependencies: 995 | has-flag: 3.0.0 996 | dev: true 997 | 998 | /tar/6.1.13: 999 | resolution: {integrity: sha512-jdIBIN6LTIe2jqzay/2vtYLlBHa3JF42ot3h1dW8Q0PaAG4v8rm0cvpVePtau5C6OKXGGcgO9q2AMNSWxiLqKw==} 1000 | engines: {node: '>=10'} 1001 | dependencies: 1002 | chownr: 2.0.0 1003 | fs-minipass: 2.1.0 1004 | minipass: 4.2.5 1005 | minizlib: 2.1.2 1006 | mkdirp: 1.0.4 1007 | yallist: 4.0.0 1008 | dev: false 1009 | 1010 | /to-regex-range/5.0.1: 1011 | resolution: {integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==} 1012 | engines: {node: '>=8.0'} 1013 | dependencies: 1014 | is-number: 7.0.0 1015 | dev: true 1016 | 1017 | /toidentifier/1.0.1: 1018 | resolution: {integrity: sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==} 1019 | engines: {node: '>=0.6'} 1020 | dev: false 1021 | 1022 | /touch/3.1.0: 1023 | resolution: {integrity: sha512-WBx8Uy5TLtOSRtIq+M03/sKDrXCLHxwDcquSP2c43Le03/9serjQBIztjRz6FkJez9D/hleyAXTBGLwwZUw9lA==} 1024 | hasBin: true 1025 | dependencies: 1026 | nopt: 1.0.10 1027 | dev: true 1028 | 1029 | /tr46/0.0.3: 1030 | resolution: {integrity: sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==} 1031 | dev: false 1032 | 1033 | /type-is/1.6.18: 1034 | resolution: {integrity: sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==} 1035 | engines: {node: '>= 0.6'} 1036 | dependencies: 1037 | media-typer: 0.3.0 1038 | mime-types: 2.1.35 1039 | dev: false 1040 | 1041 | /undefsafe/2.0.5: 1042 | resolution: {integrity: sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA==} 1043 | dev: true 1044 | 1045 | /unpipe/1.0.0: 1046 | resolution: {integrity: sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==} 1047 | engines: {node: '>= 0.8'} 1048 | dev: false 1049 | 1050 | /util-deprecate/1.0.2: 1051 | resolution: {integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==} 1052 | dev: false 1053 | 1054 | /utils-merge/1.0.1: 1055 | resolution: {integrity: sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==} 1056 | engines: {node: '>= 0.4.0'} 1057 | dev: false 1058 | 1059 | /vary/1.1.2: 1060 | resolution: {integrity: sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==} 1061 | engines: {node: '>= 0.8'} 1062 | dev: false 1063 | 1064 | /webidl-conversions/3.0.1: 1065 | resolution: {integrity: sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==} 1066 | dev: false 1067 | 1068 | /whatwg-url/5.0.0: 1069 | resolution: {integrity: sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==} 1070 | dependencies: 1071 | tr46: 0.0.3 1072 | webidl-conversions: 3.0.1 1073 | dev: false 1074 | 1075 | /wide-align/1.1.5: 1076 | resolution: {integrity: sha512-eDMORYaPNZ4sQIuuYPDHdQvf4gyCF9rEEV/yPxGfwPkRodwEgiMUUXTx/dex+Me0wxx53S+NgUHaP7y3MGlDmg==} 1077 | dependencies: 1078 | string-width: 4.2.3 1079 | dev: false 1080 | 1081 | /wrappy/1.0.2: 1082 | resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==} 1083 | dev: false 1084 | 1085 | /yallist/4.0.0: 1086 | resolution: {integrity: sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==} 1087 | dev: false 1088 | -------------------------------------------------------------------------------- /src/app.js: -------------------------------------------------------------------------------- 1 | const express = require('express'); 2 | const morgan = require('morgan'); 3 | const helmet = require('helmet'); 4 | const cors = require('cors'); 5 | const compression = require("compression"); 6 | 7 | const middlewares = require('./middlewares'); 8 | const { seoBanner } = require('./nodecanvas'); 9 | 10 | const app = express(); 11 | 12 | app.use(morgan('dev')); 13 | app.use(helmet()); 14 | app.use(cors()); 15 | app.use((req, res, next) => { 16 | res.setHeader('Cross-Origin-Resource-Policy', 'cross-origin'); 17 | next(); 18 | }); 19 | app.use(express.json()); 20 | app.use(compression()); 21 | 22 | app.get('/', (req, res) => { 23 | res.json({ 24 | message: 25 | "Create OG:IMAGE Banner Image with Github Action & REST API - use /seo-banner endpoint to generate your image and get image/png result", 26 | templates: { 27 | detail: 'You can choose available template. (Default is: default)', 28 | data: [ 29 | 'default', 30 | 'facebook', 31 | 'facebook-minimal', 32 | 'twitter', 33 | 'twitter-minimal', 34 | 'instagram', 35 | 'instagram-minimal', 36 | 'linkedin', 37 | 'linkedin-minimal', 38 | 'pinterest', 39 | ] 40 | } 41 | }); 42 | }); 43 | app.get('/seo-banner', seoBanner) 44 | 45 | app.use(middlewares.notFound); 46 | app.use(middlewares.errorHandler); 47 | 48 | module.exports = app; 49 | -------------------------------------------------------------------------------- /src/layouts/ogDefault.js: -------------------------------------------------------------------------------- 1 | const { createCanvas, loadImage } = require("canvas"); 2 | const shorten = require("../utils/shorten"); 3 | const wrapText = require("../utils/wrapText"); 4 | 5 | module.exports = async ( 6 | title, 7 | author, 8 | logo = "https://metaphore.vercel.app/_next/image?url=%2F_next%2Fstatic%2Fmedia%2Fmetaphor.ee0ad64a.webp&w=640&q=75", 9 | head, 10 | writer 11 | ) => { 12 | const WIDTH = 1342; 13 | const HEIGHT = 853; 14 | const BORDER_SIZE = 15; 15 | 16 | const canvas = createCanvas(WIDTH, HEIGHT); 17 | const ctx = canvas.getContext("2d"); 18 | 19 | ctx.fillStyle = "#ffffff"; 20 | ctx.fillRect(0, 0, WIDTH, HEIGHT); 21 | 22 | ctx.lineWidth = BORDER_SIZE; 23 | ctx.strokeStyle = "#000000"; 24 | ctx.strokeRect( 25 | BORDER_SIZE / 2, 26 | BORDER_SIZE / 2, 27 | WIDTH - BORDER_SIZE, 28 | HEIGHT - BORDER_SIZE 29 | ); 30 | 31 | // Write Metaphor Story 32 | ctx.font = "45px Inter Medium"; 33 | ctx.fillStyle = "#03001C"; 34 | ctx.fillText(head, 70, 200); 35 | // Draw underline 36 | var text = ctx.measureText(head); 37 | ctx.strokeStyle = "#03001C"; 38 | ctx.lineWidth = 5; 39 | ctx.beginPath(); 40 | ctx.lineTo(70, 220); 41 | ctx.lineTo(70 + text.width, 220); 42 | ctx.stroke(); 43 | 44 | // Write Metaphor Story 45 | const titleLength = title.length; 46 | const yTitle = titleLength > 70 ? 730 : 620; 47 | const titleTruncate = titleLength > 70 ? shorten(title, 42) : title; 48 | ctx.font = "95px Inter ExtraBold"; 49 | ctx.fillStyle = "#03001C"; 50 | let wrappedText = wrapText(ctx, titleTruncate, 70, yTitle, 1200, 100); 51 | wrappedText[0].forEach(function (item) { 52 | ctx.fillText(item[0], item[1], item[2] - wrappedText[1] - 100); 53 | }); 54 | 55 | // Draw Image 56 | const img = await loadImage(`https://github.com/${author}.png`); 57 | const imgPat = ctx.createPattern(img, "no-repeat"); 58 | const minRadius = Math.min(img.width, img.height) / 2; 59 | // get scale of circle image 60 | const scale = 70 / minRadius; 61 | // transform to put origin at top left of bounding rectangle scaling to fit image pattern 62 | ctx.setTransform(scale, 0, 0, scale, 70, 657); 63 | ctx.fillStyle = imgPat; 64 | ctx.beginPath(); 65 | ctx.arc(minRadius, minRadius, minRadius, 0, Math.PI * 2); 66 | ctx.fill(); 67 | // reset the default transform 68 | ctx.setTransform(1, 0, 0, 1, 0, 0); 69 | 70 | // Write the story teller 71 | ctx.font = "20px Inter ExtraBold"; 72 | ctx.fillStyle = "#03001C"; 73 | ctx.fillText(`${writer}:`, 230, 710); 74 | // Write author name 75 | ctx.font = "35px Inter ExtraBold"; 76 | ctx.fillStyle = "#03001C"; 77 | ctx.fillText(`git@${author}`, 230, 750); 78 | 79 | const logoImage = await loadImage(logo); 80 | const scaleFactor = Math.min(640 / logoImage.width, 440 / logoImage.height); 81 | const scaledWidth = logoImage.width * scaleFactor; 82 | const scaledHeight = logoImage.height * scaleFactor; 83 | 84 | ctx.drawImage( 85 | logoImage, 86 | 1000, 87 | 660, 88 | scaledWidth / 2 - 65, 89 | scaledHeight / 2 - 65 90 | ); 91 | 92 | return canvas; 93 | }; 94 | -------------------------------------------------------------------------------- /src/layouts/ogFacebook.js: -------------------------------------------------------------------------------- 1 | const { createCanvas, loadImage } = require("canvas"); 2 | const calculateFontSize = require("../utils/calculateFontSize"); 3 | const shorten = require("../utils/shorten"); 4 | const wrapText = require("../utils/wrapText"); 5 | 6 | module.exports = async (title, author, logo, head, writer) => { 7 | const WIDTH = 1200; 8 | const HEIGHT = 630; 9 | const BORDER_SIZE = 20; 10 | const PADDING_LEFT = 70; 11 | 12 | const canvas = createCanvas(WIDTH, HEIGHT); 13 | const ctx = canvas.getContext("2d"); 14 | 15 | ctx.fillStyle = "#ffffff"; 16 | ctx.fillRect(0, 0, WIDTH, HEIGHT); 17 | 18 | ctx.lineWidth = BORDER_SIZE; 19 | ctx.strokeStyle = "#000000"; 20 | ctx.strokeRect(BORDER_SIZE / 2, BORDER_SIZE / 2, WIDTH - BORDER_SIZE, HEIGHT - BORDER_SIZE); 21 | 22 | // Write Metaphor Story 23 | ctx.font = "25px Inter Medium"; 24 | ctx.fillStyle = "#03001C"; 25 | ctx.fillText(head, PADDING_LEFT, 120); 26 | 27 | // Draw underline 28 | ctx.strokeStyle = "#03001C"; 29 | ctx.lineWidth = 5; 30 | ctx.beginPath(); 31 | ctx.lineTo(PADDING_LEFT, 133); 32 | ctx.lineTo(PADDING_LEFT + ctx.measureText(head).width, 133); 33 | ctx.stroke(); 34 | 35 | // Write Metaphor Story 36 | const titleLength = title.length; 37 | const yTitle = titleLength > 60 ? 40 : 60; 38 | const theTitle = shorten(title, 60); 39 | 40 | const titleFontSize = calculateFontSize(ctx, theTitle, WIDTH - BORDER_SIZE * 2, HEIGHT - BORDER_SIZE * 2, 65, titleLength > 60 ? 75 : 95); 41 | ctx.font = `${titleFontSize}px Inter ExtraBold`; 42 | let wrappedText = wrapText(ctx, theTitle, PADDING_LEFT, yTitle, 1080, titleLength > 60 ? 80 : 90); 43 | let yAddition = 340; 44 | 45 | if (wrappedText[0].length > 3) { 46 | wrappedText[0].pop(); 47 | yAddition = 340 + 40; 48 | } 49 | 50 | wrappedText[0].forEach(item => { 51 | ctx.fillText(item[0], item[1], item[2] - wrappedText[1] + yAddition); 52 | }); 53 | 54 | // Draw Image 55 | const img = await loadImage(`https://github.com/${author}.png`); 56 | const imgPat = ctx.createPattern(img, "no-repeat"); 57 | const minRadius = Math.min(img.width, img.height) / 2; 58 | 59 | // get scale of circle image 60 | const scale = 50 / minRadius; 61 | 62 | // transform to put origin at top left of bounding rectangle scaling to fit image pattern 63 | ctx.setTransform(scale, 0, 0, scale, PADDING_LEFT, 470); 64 | ctx.fillStyle = imgPat; 65 | ctx.beginPath(); 66 | ctx.arc(minRadius, minRadius, minRadius, 0, Math.PI * 2); 67 | ctx.fill(); 68 | 69 | // reset the default transform 70 | ctx.setTransform(1, 0, 0, 1, 0, 0); 71 | 72 | // Write the story teller 73 | ctx.font = "20px Inter ExtraBold"; 74 | ctx.fillStyle = "#03001C"; 75 | ctx.fillText(`${writer}:`, 180, 500); 76 | 77 | // Write author name 78 | ctx.font = "35px Inter ExtraBold"; 79 | ctx.fillStyle = "#03001C"; 80 | ctx.fillText(`git@${author}`, 180, 540); 81 | 82 | const logoImage = await loadImage(logo); 83 | const scaleFactor = 0.3; 84 | const logoWidth = logoImage.width * scaleFactor; 85 | const logoHeight = logoImage.height * scaleFactor; 86 | 87 | // Draw Logo 88 | ctx.drawImage(logoImage, WIDTH - BORDER_SIZE - (logoWidth + 45), HEIGHT - BORDER_SIZE - (logoHeight + 20), logoWidth, logoHeight); 89 | 90 | return canvas; 91 | }; 92 | -------------------------------------------------------------------------------- /src/layouts/ogFacebookMinimal.js: -------------------------------------------------------------------------------- 1 | const { createCanvas, loadImage } = require("canvas"); 2 | const calculateFontSize = require("../utils/calculateFontSize"); 3 | const shorten = require("../utils/shorten"); 4 | const wrapText = require("../utils/wrapText"); 5 | 6 | module.exports = async ( 7 | title, 8 | author, 9 | logo = "https://metaphore.vercel.app/_next/image?url=%2F_next%2Fstatic%2Fmedia%2Fmetaphor.ee0ad64a.webp&w=640&q=75", 10 | head, 11 | writer 12 | ) => { 13 | // Canvas size 14 | const WIDTH = 600; 15 | const HEIGHT = 315; 16 | const BORDER_SIZE = 10; 17 | const PADDING_LEFT = 70; 18 | 19 | const canvas = createCanvas(WIDTH, HEIGHT); 20 | const ctx = canvas.getContext("2d"); 21 | 22 | ctx.fillStyle = "#ffffff"; 23 | ctx.fillRect(0, 0, WIDTH, HEIGHT); 24 | 25 | ctx.lineWidth = BORDER_SIZE; 26 | ctx.strokeStyle = "#000000"; 27 | ctx.strokeRect( 28 | BORDER_SIZE / 2, 29 | BORDER_SIZE / 2, 30 | WIDTH - BORDER_SIZE, 31 | HEIGHT - BORDER_SIZE 32 | ); 33 | 34 | // Write Metaphor Story 35 | ctx.font = "15px Inter Medium"; 36 | ctx.fillStyle = "#03001C"; 37 | ctx.fillText(head, PADDING_LEFT / 2, 120 / 2); 38 | // Draw underline 39 | var text = ctx.measureText(head); 40 | ctx.strokeStyle = "#03001C"; 41 | ctx.lineWidth = 5 / 2; 42 | ctx.beginPath(); 43 | ctx.lineTo(PADDING_LEFT / 2, 133 / 2); 44 | ctx.lineTo(PADDING_LEFT / 2 + text.width, 133 / 2); 45 | ctx.stroke(); 46 | 47 | // Write Metaphor Story 48 | const titleLength = title.length; 49 | const yTitle = titleLength > 60 ? 40 : 60; 50 | const shortTitle = shorten(title, 60); 51 | 52 | ctx.font = `${calculateFontSize( 53 | ctx, 54 | shortTitle, 55 | WIDTH - BORDER_SIZE * 2, 56 | HEIGHT - BORDER_SIZE * 2, 57 | 65 / 2, 58 | titleLength > 60 ? 75 / 2 : 95 / 2 59 | )}px Inter ExtraBold`; 60 | let wrappedText = wrapText( 61 | ctx, 62 | shortTitle, 63 | PADDING_LEFT / 2, 64 | yTitle / 2, 65 | 1080 / 2, 66 | titleLength > 60 ? 80 / 2 : 90 / 2 67 | ); 68 | let yAddition = (340 / 2) 69 | if (wrappedText[0].length > 3) { 70 | wrappedText[0].pop(); 71 | yAddition = (340 / 2) + 40 72 | } 73 | wrappedText[0].forEach(function (item) { 74 | ctx.fillText(item[0], item[1], (item[2] - wrappedText[1]) + yAddition); 75 | }); 76 | 77 | // Draw Image 78 | const img = await loadImage(`https://github.com/${author}.png`); 79 | const imgPat = ctx.createPattern(img, "no-repeat"); 80 | const minRadius = Math.min(img.width, img.height) / 2; 81 | // get scale of circle image 82 | const scale = 50 / 2 / minRadius; 83 | // transform to put origin at top left of bounding rectangle scaling to fit image pattern 84 | ctx.setTransform(scale, 0, 0, scale, PADDING_LEFT / 2, 470 / 2); 85 | ctx.fillStyle = imgPat; 86 | ctx.beginPath(); 87 | ctx.arc(minRadius, minRadius, minRadius, 0, Math.PI * 2); 88 | ctx.fill(); 89 | // reset the default transform 90 | ctx.setTransform(1, 0, 0, 1, 0, 0); 91 | 92 | // Write the story teller 93 | ctx.font = `${20 / 2}px Inter ExtraBold`; 94 | ctx.fillStyle = "#03001C"; 95 | ctx.fillText(`${writer}:`, 180 / 2, 500 / 2); 96 | // Write author name 97 | ctx.font = `${35 / 2}px Inter ExtraBold`; 98 | ctx.fillStyle = "#03001C"; 99 | ctx.fillText(`git@${author}`, 180 / 2, 540 / 2); 100 | 101 | const logoImage = await loadImage(logo); 102 | const scaleFactor = Math.min(640 / logoImage.width, 440 / logoImage.height); 103 | const scaledWidth = logoImage.width * scaleFactor; 104 | const scaledHeight = logoImage.height * scaleFactor; 105 | 106 | ctx.drawImage( 107 | logoImage, 108 | 890 / 2, 109 | 460 / 2, 110 | (scaledWidth / 2 - 90) / 2, 111 | (scaledHeight / 2 - 90) / 2 112 | ); 113 | 114 | return canvas; 115 | }; 116 | -------------------------------------------------------------------------------- /src/layouts/ogInstagram.js: -------------------------------------------------------------------------------- 1 | const { createCanvas, loadImage } = require("canvas"); 2 | const calculateFontSize = require("../utils/calculateFontSize"); 3 | const shorten = require("../utils/shorten"); 4 | const wrapText = require("../utils/wrapText"); 5 | 6 | module.exports = async ( 7 | title, 8 | author, 9 | logo = "https://metaphore.vercel.app/_next/image?url=%2F_next%2Fstatic%2Fmedia%2Fmetaphor.ee0ad64a.webp&w=640&q=75", 10 | head, 11 | writer 12 | ) => { 13 | // Canvas size 14 | const WIDTH = 1080; 15 | const HEIGHT = 1080; 16 | const BORDER_SIZE = 10; 17 | const PADDING_LEFT = 70; 18 | 19 | const canvas = createCanvas(WIDTH, HEIGHT); 20 | const ctx = canvas.getContext("2d"); 21 | 22 | ctx.fillStyle = "#ffffff"; 23 | ctx.fillRect(0, 0, WIDTH, HEIGHT); 24 | 25 | ctx.lineWidth = BORDER_SIZE; 26 | ctx.strokeStyle = "#000000"; 27 | ctx.strokeRect( 28 | BORDER_SIZE / 2, 29 | BORDER_SIZE / 2, 30 | WIDTH - BORDER_SIZE, 31 | HEIGHT - BORDER_SIZE 32 | ); 33 | 34 | // Write Metaphor Story 35 | ctx.font = "35px Inter Medium"; 36 | ctx.fillStyle = "#03001C"; 37 | ctx.fillText(head, PADDING_LEFT, 120); 38 | // Draw underline 39 | var text = ctx.measureText(head); 40 | ctx.strokeStyle = "#03001C"; 41 | ctx.lineWidth = 5; 42 | ctx.beginPath(); 43 | ctx.lineTo(PADDING_LEFT, 133); 44 | ctx.lineTo(PADDING_LEFT + text.width, 133); 45 | ctx.stroke(); 46 | 47 | // Write Metaphor Story 48 | const titleLength = title.length; 49 | const yTitle = titleLength > 300 ? 100 : 80; 50 | const shortTitle = shorten(title, 300); 51 | 52 | ctx.font = `${calculateFontSize( 53 | ctx, 54 | shortTitle, 55 | WIDTH - BORDER_SIZE, 56 | HEIGHT - BORDER_SIZE, 57 | 40, 58 | titleLength > 265 ? 60 : 80 59 | )}px Inter ExtraBold`; 60 | let wrappedText = wrapText( 61 | ctx, 62 | shortTitle, 63 | PADDING_LEFT, 64 | yTitle, 65 | 1000, 66 | titleLength > 265 ? 50 : 45 67 | ); 68 | let yAddition = 550; 69 | wrappedText[0].forEach(function (item) { 70 | ctx.fillText(item[0], item[1], (item[2] - wrappedText[1]) + yAddition); 71 | }); 72 | 73 | // Draw Image 74 | const img = await loadImage(`https://github.com/${author}.png`); 75 | const imgPat = ctx.createPattern(img, "no-repeat"); 76 | const minRadius = Math.min(img.width, img.height) / 2; 77 | // get scale of circle image 78 | const scale = 70 / minRadius; 79 | // transform to put origin at top left of bounding rectangle scaling to fit image pattern 80 | ctx.setTransform(scale, 0, 0, scale, PADDING_LEFT, 860); 81 | ctx.fillStyle = imgPat; 82 | ctx.beginPath(); 83 | ctx.arc(minRadius, minRadius, minRadius, 0, Math.PI * 2); 84 | ctx.fill(); 85 | // reset the default transform 86 | ctx.setTransform(1, 0, 0, 1, 0, 0); 87 | 88 | // Write the story teller 89 | ctx.font = `${25}px Inter ExtraBold`; 90 | ctx.fillStyle = "#03001C"; 91 | ctx.fillText(`${writer}:`, 220, 910); 92 | // Write author name 93 | ctx.font = `${35}px Inter ExtraBold`; 94 | ctx.fillStyle = "#03001C"; 95 | ctx.fillText(`git@${author}`, 220, 945); 96 | 97 | const logoImage = await loadImage(logo); 98 | const scaleFactor = Math.min(640 / logoImage.width, 440 / logoImage.height); 99 | const scaledWidth = logoImage.width * scaleFactor; 100 | const scaledHeight = logoImage.height * scaleFactor; 101 | 102 | ctx.drawImage( 103 | logoImage, 104 | 684, 105 | 856, 106 | scaledWidth - 320, 107 | scaledHeight - 285 108 | ); 109 | 110 | return canvas; 111 | }; 112 | -------------------------------------------------------------------------------- /src/layouts/ogInstagramMinimal.js: -------------------------------------------------------------------------------- 1 | const { createCanvas, loadImage } = require("canvas"); 2 | const calculateFontSize = require("../utils/calculateFontSize"); 3 | const shorten = require("../utils/shorten"); 4 | const wrapText = require("../utils/wrapText"); 5 | 6 | module.exports = async ( 7 | title, 8 | author, 9 | logo = "https://metaphore.vercel.app/_next/image?url=%2F_next%2Fstatic%2Fmedia%2Fmetaphor.ee0ad64a.webp&w=640&q=75", 10 | head, 11 | writer 12 | ) => { 13 | // Canvas size 14 | const WIDTH = 600; 15 | const HEIGHT = 600; 16 | const BORDER_SIZE = 5; 17 | const PADDING_LEFT = 35; 18 | 19 | const canvas = createCanvas(WIDTH, HEIGHT); 20 | const ctx = canvas.getContext("2d"); 21 | 22 | ctx.fillStyle = "#ffffff"; 23 | ctx.fillRect(0, 0, WIDTH, HEIGHT); 24 | 25 | ctx.lineWidth = BORDER_SIZE; 26 | ctx.strokeStyle = "#000000"; 27 | ctx.strokeRect( 28 | BORDER_SIZE / 2, 29 | BORDER_SIZE / 2, 30 | WIDTH - BORDER_SIZE, 31 | HEIGHT - BORDER_SIZE 32 | ); 33 | 34 | // Write Metaphor Story 35 | ctx.font = `${35 / 2}px Inter Medium`; 36 | ctx.fillStyle = "#03001C"; 37 | ctx.fillText(head, PADDING_LEFT, 170); 38 | // Draw underline 39 | var text = ctx.measureText(head); 40 | ctx.strokeStyle = "#03001C"; 41 | ctx.lineWidth = 5 / 2; 42 | ctx.beginPath(); 43 | ctx.lineTo(PADDING_LEFT, 180); 44 | ctx.lineTo(PADDING_LEFT + text.width, 180); 45 | ctx.stroke(); 46 | 47 | // Write Metaphor Story 48 | const titleLength = title.length; 49 | const yTitle = titleLength > 300 ? 90 : 80; 50 | const shortTitle = shorten(title, 300); 51 | 52 | ctx.font = `${calculateFontSize( 53 | ctx, 54 | shortTitle, 55 | WIDTH - BORDER_SIZE / 2, 56 | HEIGHT - BORDER_SIZE / 2, 57 | 20, 58 | titleLength > 175 ? 60 : 80 59 | )}px Inter ExtraBold`; 60 | let wrappedText = wrapText( 61 | ctx, 62 | shortTitle, 63 | PADDING_LEFT, 64 | yTitle, 65 | 500, 66 | titleLength > 175 ? 23 : 25 67 | ); 68 | let yAddition = 290; 69 | wrappedText[0].forEach(function (item) { 70 | ctx.fillText(item[0], item[1], (item[2] - wrappedText[1]) + yAddition); 71 | }); 72 | 73 | // Draw Image 74 | const img = await loadImage(`https://github.com/${author}.png`); 75 | const imgPat = ctx.createPattern(img, "no-repeat"); 76 | const minRadius = Math.min(img.width, img.height) / 2; 77 | // get scale of circle image 78 | const scale = 35 / minRadius; 79 | // transform to put origin at top left of bounding rectangle scaling to fit image pattern 80 | ctx.setTransform(scale, 0, 0, scale, PADDING_LEFT, 485); 81 | ctx.fillStyle = imgPat; 82 | ctx.beginPath(); 83 | ctx.arc(minRadius, minRadius, minRadius, 0, Math.PI * 2); 84 | ctx.fill(); 85 | // reset the default transform 86 | ctx.setTransform(1, 0, 0, 1, 0, 0); 87 | 88 | // Write the story teller 89 | ctx.font = `${25 / 2}px Inter ExtraBold`; 90 | ctx.fillStyle = "#03001C"; 91 | ctx.fillText(`${writer}:`, 115, 510); 92 | // Write author name 93 | ctx.font = `${35 / 2}px Inter ExtraBold`; 94 | ctx.fillStyle = "#03001C"; 95 | ctx.fillText(`git@${author}`, 115, 530); 96 | 97 | const logoImage = await loadImage(logo); 98 | const scaleFactor = Math.min(640 / logoImage.width, 440 / logoImage.height); 99 | const scaledWidth = logoImage.width * scaleFactor; 100 | const scaledHeight = logoImage.height * scaleFactor; 101 | 102 | ctx.drawImage( 103 | logoImage, 104 | 354, 105 | 460, 106 | scaledWidth - 440, 107 | scaledHeight - 325 108 | ); 109 | 110 | return canvas; 111 | }; 112 | -------------------------------------------------------------------------------- /src/layouts/ogLinkedin.js: -------------------------------------------------------------------------------- 1 | const { createCanvas, loadImage } = require("canvas"); 2 | const calculateFontSize = require("../utils/calculateFontSize"); 3 | const shorten = require("../utils/shorten"); 4 | const wrapText = require("../utils/wrapText"); 5 | 6 | module.exports = async ( 7 | title, 8 | author, 9 | logo = "https://metaphore.vercel.app/_next/image?url=%2F_next%2Fstatic%2Fmedia%2Fmetaphor.ee0ad64a.webp&w=640&q=75", 10 | head, 11 | writer 12 | ) => { 13 | // Canvas size 14 | const WIDTH = 1200; 15 | const HEIGHT = 628; 16 | const BORDER_SIZE = 20; 17 | const PADDING_LEFT = 70; 18 | 19 | const canvas = createCanvas(WIDTH, HEIGHT); 20 | const ctx = canvas.getContext("2d"); 21 | 22 | ctx.fillStyle = "#ffffff"; 23 | ctx.fillRect(0, 0, WIDTH, HEIGHT); 24 | 25 | ctx.lineWidth = BORDER_SIZE; 26 | ctx.strokeStyle = "#000000"; 27 | ctx.strokeRect( 28 | BORDER_SIZE / 2, 29 | BORDER_SIZE / 2, 30 | WIDTH - BORDER_SIZE, 31 | HEIGHT - BORDER_SIZE 32 | ); 33 | 34 | // Write Metaphor Story 35 | ctx.font = "25px Inter Medium"; 36 | ctx.fillStyle = "#03001C"; 37 | ctx.fillText(head, PADDING_LEFT, 120); 38 | // Draw underline 39 | var text = ctx.measureText(head); 40 | ctx.strokeStyle = "#03001C"; 41 | ctx.lineWidth = 5; 42 | ctx.beginPath(); 43 | ctx.lineTo(PADDING_LEFT, 133); 44 | ctx.lineTo(PADDING_LEFT + text.width, 133); 45 | ctx.stroke(); 46 | 47 | // Write Metaphor Story 48 | const titleLength = title.length; 49 | const yTitle = titleLength > 60 ? 40 : 60; 50 | const shortTitle = shorten(title, 60); 51 | 52 | ctx.font = `${calculateFontSize( 53 | ctx, 54 | shortTitle, 55 | WIDTH - BORDER_SIZE * 2, 56 | HEIGHT - BORDER_SIZE * 2, 57 | 65, 58 | titleLength > 60 ? 75 : 95 59 | )}px Inter ExtraBold`; 60 | let wrappedText = wrapText( 61 | ctx, 62 | shortTitle, 63 | PADDING_LEFT, 64 | yTitle, 65 | 1080, 66 | titleLength > 60 ? 80 : 90 67 | ); 68 | let yAddition = 350; 69 | if (wrappedText[0].length > 3) { 70 | wrappedText[0].pop(); 71 | yAddition = 350 + 40; 72 | } 73 | wrappedText[0].forEach(function (item) { 74 | ctx.fillText(item[0], item[1], item[2] - wrappedText[1] + yAddition); 75 | }); 76 | 77 | // Draw Image 78 | const img = await loadImage(`https://github.com/${author}.png`); 79 | const imgPat = ctx.createPattern(img, "no-repeat"); 80 | const minRadius = Math.min(img.width, img.height) / 2; 81 | // get scale of circle image 82 | const scale = 50 / minRadius; 83 | // transform to put origin at top left of bounding rectangle scaling to fit image pattern 84 | ctx.setTransform(scale, 0, 0, scale, PADDING_LEFT, 480); 85 | ctx.fillStyle = imgPat; 86 | ctx.beginPath(); 87 | ctx.arc(minRadius, minRadius, minRadius, 0, Math.PI * 2); 88 | ctx.fill(); 89 | // reset the default transform 90 | ctx.setTransform(1, 0, 0, 1, 0, 0); 91 | 92 | // Write the story teller 93 | ctx.font = `${20}px Inter ExtraBold`; 94 | ctx.fillStyle = "#03001C"; 95 | ctx.fillText(`${writer}:`, 180, 515); 96 | // Write author name 97 | ctx.font = `${35}px Inter ExtraBold`; 98 | ctx.fillStyle = "#03001C"; 99 | ctx.fillText(`git@${author}`, 180, 553); 100 | 101 | const logoImage = await loadImage(logo); 102 | const scaleFactor = Math.min(640 / logoImage.width, 440 / logoImage.height); 103 | const scaledWidth = logoImage.width * scaleFactor; 104 | const scaledHeight = logoImage.height * scaleFactor; 105 | 106 | ctx.drawImage( 107 | logoImage, 108 | 890, 109 | 470, 110 | scaledWidth / 2 - 90, 111 | scaledHeight / 2 - 90 112 | ); 113 | 114 | return canvas; 115 | }; 116 | -------------------------------------------------------------------------------- /src/layouts/ogLinkedinMinimal.js: -------------------------------------------------------------------------------- 1 | const { createCanvas, loadImage } = require("canvas"); 2 | const calculateFontSize = require("../utils/calculateFontSize"); 3 | const shorten = require("../utils/shorten"); 4 | const wrapText = require("../utils/wrapText"); 5 | 6 | module.exports = async ( 7 | title, 8 | author, 9 | logo = "https://metaphore.vercel.app/_next/image?url=%2F_next%2Fstatic%2Fmedia%2Fmetaphor.ee0ad64a.webp&w=640&q=75", 10 | head, 11 | writer 12 | ) => { 13 | // Canvas size 14 | const WIDTH = 600; 15 | const HEIGHT = 400; 16 | const BORDER_SIZE = 10; 17 | const PADDING_LEFT = 70; 18 | 19 | const canvas = createCanvas(WIDTH, HEIGHT); 20 | const ctx = canvas.getContext("2d"); 21 | 22 | ctx.fillStyle = "#ffffff"; 23 | ctx.fillRect(0, 0, WIDTH, HEIGHT); 24 | 25 | ctx.lineWidth = BORDER_SIZE; 26 | ctx.strokeStyle = "#000000"; 27 | ctx.strokeRect( 28 | BORDER_SIZE / 2, 29 | BORDER_SIZE / 2, 30 | WIDTH - BORDER_SIZE, 31 | HEIGHT - BORDER_SIZE 32 | ); 33 | 34 | // Write Metaphor Story 35 | ctx.font = "15px Inter Medium"; 36 | ctx.fillStyle = "#03001C"; 37 | ctx.fillText(head, PADDING_LEFT / 2, 120 / 2); 38 | // Draw underline 39 | var text = ctx.measureText(head); 40 | ctx.strokeStyle = "#03001C"; 41 | ctx.lineWidth = 5 / 2; 42 | ctx.beginPath(); 43 | ctx.lineTo(PADDING_LEFT / 2, 133 / 2); 44 | ctx.lineTo(PADDING_LEFT / 2 + text.width, 133 / 2); 45 | ctx.stroke(); 46 | 47 | // Write Metaphor Story 48 | const titleLength = title.length; 49 | const yTitle = titleLength > 110 ? 40 : 60; 50 | const shortTitle = shorten(title, 110); 51 | 52 | ctx.font = `${calculateFontSize( 53 | ctx, 54 | shortTitle, 55 | WIDTH - BORDER_SIZE * 2, 56 | HEIGHT - BORDER_SIZE * 2, 57 | 65 / 2, 58 | titleLength > 60 ? 75 / 2 : 95 / 2 59 | )}px Inter ExtraBold`; 60 | let wrappedText = wrapText( 61 | ctx, 62 | shortTitle, 63 | PADDING_LEFT / 2, 64 | yTitle / 2, 65 | 1080 / 2, 66 | titleLength > 60 ? 80 / 2 : 90 / 2 67 | ); 68 | let yAddition = (450 / 2) 69 | if (wrappedText[0].length > 5) { 70 | wrappedText[0].pop(); 71 | yAddition = (450 / 2) + 40 72 | } 73 | wrappedText[0].forEach(function (item) { 74 | ctx.fillText(item[0], item[1], (item[2] - wrappedText[1]) + yAddition); 75 | }); 76 | 77 | // Draw Image 78 | const img = await loadImage(`https://github.com/${author}.png`); 79 | const imgPat = ctx.createPattern(img, "no-repeat"); 80 | const minRadius = Math.min(img.width, img.height) / 2; 81 | // get scale of circle image 82 | const scale = 50 / 2 / minRadius; 83 | // transform to put origin at top left of bounding rectangle scaling to fit image pattern 84 | ctx.setTransform(scale, 0, 0, scale, PADDING_LEFT / 2, 635 / 2); 85 | ctx.fillStyle = imgPat; 86 | ctx.beginPath(); 87 | ctx.arc(minRadius, minRadius, minRadius, 0, Math.PI * 2); 88 | ctx.fill(); 89 | // reset the default transform 90 | ctx.setTransform(1, 0, 0, 1, 0, 0); 91 | 92 | // Write the story teller 93 | ctx.font = `${20 / 2}px Inter ExtraBold`; 94 | ctx.fillStyle = "#03001C"; 95 | ctx.fillText(`${writer}:`, 180 / 2, 675 / 2); 96 | // Write author name 97 | ctx.font = `${35 / 2}px Inter ExtraBold`; 98 | ctx.fillStyle = "#03001C"; 99 | ctx.fillText(`git@${author}`, 180 / 2, 710 / 2); 100 | 101 | const logoImage = await loadImage(logo); 102 | const scaleFactor = Math.min(640 / logoImage.width, 440 / logoImage.height); 103 | const scaledWidth = logoImage.width * scaleFactor; 104 | const scaledHeight = logoImage.height * scaleFactor; 105 | 106 | ctx.drawImage( 107 | logoImage, 108 | 890 / 2, 109 | 625 / 2, 110 | (scaledWidth / 2 - 90) / 2, 111 | (scaledHeight / 2 - 90) / 2 112 | ); 113 | 114 | return canvas; 115 | }; 116 | -------------------------------------------------------------------------------- /src/layouts/ogPinterest.js: -------------------------------------------------------------------------------- 1 | const { createCanvas, loadImage } = require("canvas"); 2 | const shorten = require("../utils/shorten"); 3 | const wrapText = require("../utils/wrapText"); 4 | 5 | module.exports = async ( 6 | title, 7 | author, 8 | logo = "https://metaphore.vercel.app/_next/image?url=%2F_next%2Fstatic%2Fmedia%2Fmetaphor.ee0ad64a.webp&w=640&q=75", 9 | head, 10 | writer 11 | ) => { 12 | const WIDTH = 1000; 13 | const HEIGHT = 1500; 14 | const BORDER_SIZE = 20; 15 | 16 | const canvas = createCanvas(WIDTH, HEIGHT); 17 | const ctx = canvas.getContext("2d"); 18 | 19 | ctx.fillStyle = "#ffffff"; 20 | ctx.fillRect(0, 0, WIDTH, HEIGHT); 21 | 22 | ctx.lineWidth = BORDER_SIZE; 23 | ctx.strokeStyle = "#000000"; 24 | ctx.strokeRect( 25 | BORDER_SIZE / 2, 26 | BORDER_SIZE / 2, 27 | WIDTH - BORDER_SIZE, 28 | HEIGHT - BORDER_SIZE 29 | ); 30 | 31 | // Write Metaphor Story 32 | ctx.font = "45px Inter Medium"; 33 | ctx.fillStyle = "#03001C"; 34 | ctx.fillText(head, 70, 200); 35 | // Draw underline 36 | var text = ctx.measureText(head); 37 | ctx.strokeStyle = "#03001C"; 38 | ctx.lineWidth = 5; 39 | ctx.beginPath(); 40 | ctx.lineTo(70, 220); 41 | ctx.lineTo(70 + text.width, 220); 42 | ctx.stroke(); 43 | 44 | // Write Metaphor Story 45 | const titleLength = title.length; 46 | const yTitle = titleLength > 300 ? 730 : 620; 47 | const titleTruncate = titleLength > 300 ? shorten(title, 42) : title; 48 | ctx.font = "40px Inter ExtraBold"; 49 | ctx.fillStyle = "#03001C"; 50 | let wrappedText = wrapText(ctx, titleTruncate, 70, yTitle, 900, 55); 51 | wrappedText[0].forEach(function (item) { 52 | ctx.fillText(item[0], item[1], item[2] - wrappedText[1] + 240); 53 | }); 54 | 55 | // Draw Image 56 | const img = await loadImage(`https://github.com/${author}.png`); 57 | const imgPat = ctx.createPattern(img, "no-repeat"); 58 | const minRadius = Math.min(img.width, img.height) / 2; 59 | // get scale of circle image 60 | const scale = 65 / minRadius; 61 | // transform to put origin at top left of bounding rectangle scaling to fit image pattern 62 | ctx.setTransform(scale, 0, 0, scale, 70, HEIGHT - 370); 63 | ctx.fillStyle = imgPat; 64 | ctx.beginPath(); 65 | ctx.arc(minRadius, minRadius, minRadius, 0, Math.PI * 2); 66 | ctx.fill(); 67 | // reset the default transform 68 | ctx.setTransform(1, 0, 0, 1, 0, 0); 69 | 70 | // Write the story teller 71 | ctx.font = "25px Inter ExtraBold"; 72 | ctx.fillStyle = "#03001C"; 73 | ctx.fillText(`${writer}:`, 210, HEIGHT - 325); 74 | // Write author name 75 | ctx.font = "35px Inter ExtraBold"; 76 | ctx.fillStyle = "#03001C"; 77 | ctx.fillText(`git@${author}`, 210, HEIGHT - 280); 78 | 79 | const logoImage = await loadImage(logo); 80 | const scaleFactor = Math.min(640 / logoImage.width, 440 / logoImage.height); 81 | const scaledWidth = logoImage.width * scaleFactor; 82 | const scaledHeight = logoImage.height * scaleFactor; 83 | 84 | ctx.drawImage( 85 | logoImage, 86 | WIDTH - 335, 87 | HEIGHT - 385, 88 | scaledWidth / 2 - 65, 89 | scaledHeight / 2 - 65 90 | ); 91 | 92 | return canvas; 93 | }; 94 | -------------------------------------------------------------------------------- /src/layouts/ogTwitter.js: -------------------------------------------------------------------------------- 1 | const { createCanvas, loadImage } = require("canvas"); 2 | const calculateFontSize = require("../utils/calculateFontSize"); 3 | const shorten = require("../utils/shorten"); 4 | const wrapText = require("../utils/wrapText"); 5 | 6 | module.exports = async ( 7 | title, 8 | author, 9 | logo = "https://metaphore.vercel.app/_next/image?url=%2F_next%2Fstatic%2Fmedia%2Fmetaphor.ee0ad64a.webp&w=640&q=75", 10 | head, 11 | writer 12 | ) => { 13 | // Canvas size 14 | const WIDTH = 1200; 15 | const HEIGHT = 675; 16 | const BORDER_SIZE = 20; 17 | const PADDING_LEFT = 70; 18 | 19 | const canvas = createCanvas(WIDTH, HEIGHT); 20 | const ctx = canvas.getContext("2d"); 21 | 22 | ctx.fillStyle = "#ffffff"; 23 | ctx.fillRect(0, 0, WIDTH, HEIGHT); 24 | 25 | ctx.lineWidth = BORDER_SIZE; 26 | ctx.strokeStyle = "#000000"; 27 | ctx.strokeRect( 28 | BORDER_SIZE / 2, 29 | BORDER_SIZE / 2, 30 | WIDTH - BORDER_SIZE, 31 | HEIGHT - BORDER_SIZE 32 | ); 33 | 34 | // Write Metaphor Story 35 | ctx.font = "25px Inter Medium"; 36 | ctx.fillStyle = "#03001C"; 37 | ctx.fillText(head, PADDING_LEFT, 120); 38 | // Draw underline 39 | var text = ctx.measureText(head); 40 | ctx.strokeStyle = "#03001C"; 41 | ctx.lineWidth = 5; 42 | ctx.beginPath(); 43 | ctx.lineTo(PADDING_LEFT, 133); 44 | ctx.lineTo(PADDING_LEFT + text.width, 133); 45 | ctx.stroke(); 46 | 47 | // Write Metaphor Story 48 | const titleLength = title.length; 49 | const yTitle = titleLength > 60 ? 40 : 60; 50 | const shortTitle = shorten(title, 60); 51 | 52 | ctx.font = `${calculateFontSize( 53 | ctx, 54 | shortTitle, 55 | WIDTH - BORDER_SIZE * 2, 56 | HEIGHT - BORDER_SIZE * 2, 57 | 65, 58 | titleLength > 60 ? 75 : 95 59 | )}px Inter ExtraBold`; 60 | let wrappedText = wrapText( 61 | ctx, 62 | shortTitle, 63 | PADDING_LEFT, 64 | yTitle, 65 | 1080, 66 | titleLength > 60 ? 80 : 90 67 | ); 68 | let yAddition = 350; 69 | if (wrappedText[0].length > 3) { 70 | wrappedText[0].pop(); 71 | yAddition = 350 + 40; 72 | } 73 | wrappedText[0].forEach(function (item) { 74 | ctx.fillText(item[0], item[1], item[2] - wrappedText[1] + yAddition); 75 | }); 76 | 77 | // Draw Image 78 | const img = await loadImage(`https://github.com/${author}.png`); 79 | const imgPat = ctx.createPattern(img, "no-repeat"); 80 | const minRadius = Math.min(img.width, img.height) / 2; 81 | // get scale of circle image 82 | const scale = 50 / minRadius; 83 | // transform to put origin at top left of bounding rectangle scaling to fit image pattern 84 | ctx.setTransform(scale, 0, 0, scale, PADDING_LEFT, 520); 85 | ctx.fillStyle = imgPat; 86 | ctx.beginPath(); 87 | ctx.arc(minRadius, minRadius, minRadius, 0, Math.PI * 2); 88 | ctx.fill(); 89 | // reset the default transform 90 | ctx.setTransform(1, 0, 0, 1, 0, 0); 91 | 92 | // Write the story teller 93 | ctx.font = `${20}px Inter ExtraBold`; 94 | ctx.fillStyle = "#03001C"; 95 | ctx.fillText(`${writer}:`, 180, 550); 96 | // Write author name 97 | ctx.font = `${35}px Inter ExtraBold`; 98 | ctx.fillStyle = "#03001C"; 99 | ctx.fillText(`git@${author}`, 180, 585); 100 | 101 | const logoImage = await loadImage(logo); 102 | const scaleFactor = Math.min(640 / logoImage.width, 440 / logoImage.height); 103 | const scaledWidth = logoImage.width * scaleFactor; 104 | const scaledHeight = logoImage.height * scaleFactor; 105 | 106 | ctx.drawImage( 107 | logoImage, 108 | 890, 109 | 510, 110 | scaledWidth / 2 - 90, 111 | scaledHeight / 2 - 90 112 | ); 113 | 114 | return canvas; 115 | }; 116 | -------------------------------------------------------------------------------- /src/layouts/ogTwitterMinimal.js: -------------------------------------------------------------------------------- 1 | const { createCanvas, loadImage } = require("canvas"); 2 | const calculateFontSize = require("../utils/calculateFontSize"); 3 | const shorten = require("../utils/shorten"); 4 | const wrapText = require("../utils/wrapText"); 5 | 6 | module.exports = async ( 7 | title, 8 | author, 9 | logo = "https://metaphore.vercel.app/_next/image?url=%2F_next%2Fstatic%2Fmedia%2Fmetaphor.ee0ad64a.webp&w=640&q=75", 10 | head, 11 | writer 12 | ) => { 13 | // Canvas size 14 | const WIDTH = 600; 15 | const HEIGHT = 335; 16 | const BORDER_SIZE = 10; 17 | const PADDING_LEFT = 70; 18 | 19 | const canvas = createCanvas(WIDTH, HEIGHT); 20 | const ctx = canvas.getContext("2d"); 21 | 22 | ctx.fillStyle = "#ffffff"; 23 | ctx.fillRect(0, 0, WIDTH, HEIGHT); 24 | 25 | ctx.lineWidth = BORDER_SIZE; 26 | ctx.strokeStyle = "#000000"; 27 | ctx.strokeRect( 28 | BORDER_SIZE / 2, 29 | BORDER_SIZE / 2, 30 | WIDTH - BORDER_SIZE, 31 | HEIGHT - BORDER_SIZE 32 | ); 33 | 34 | // Write Metaphor Story 35 | ctx.font = "15px Inter Medium"; 36 | ctx.fillStyle = "#03001C"; 37 | ctx.fillText(head, PADDING_LEFT / 2, 120 / 2); 38 | // Draw underline 39 | var text = ctx.measureText(head); 40 | ctx.strokeStyle = "#03001C"; 41 | ctx.lineWidth = 5 / 2; 42 | ctx.beginPath(); 43 | ctx.lineTo(PADDING_LEFT / 2, 133 / 2); 44 | ctx.lineTo(PADDING_LEFT / 2 + text.width, 133 / 2); 45 | ctx.stroke(); 46 | 47 | // Write Metaphor Story 48 | const titleLength = title.length; 49 | const yTitle = titleLength > 60 ? 40 : 60; 50 | const shortTitle = shorten(title, 60); 51 | 52 | ctx.font = `${calculateFontSize( 53 | ctx, 54 | shortTitle, 55 | WIDTH - BORDER_SIZE * 2, 56 | HEIGHT - BORDER_SIZE * 2, 57 | 65 / 2, 58 | titleLength > 60 ? 75 / 2 : 95 / 2 59 | )}px Inter ExtraBold`; 60 | let wrappedText = wrapText( 61 | ctx, 62 | shortTitle, 63 | PADDING_LEFT / 2, 64 | yTitle / 2, 65 | 1080 / 2, 66 | titleLength > 60 ? 80 / 2 : 90 / 2 67 | ); 68 | let yAddition = (350 / 2) 69 | if (wrappedText[0].length > 3) { 70 | wrappedText[0].pop(); 71 | yAddition = (350 / 2) + 40 72 | } 73 | wrappedText[0].forEach(function (item) { 74 | ctx.fillText(item[0], item[1], (item[2] - wrappedText[1]) + yAddition); 75 | }); 76 | 77 | // Draw Image 78 | const img = await loadImage(`https://github.com/${author}.png`); 79 | const imgPat = ctx.createPattern(img, "no-repeat"); 80 | const minRadius = Math.min(img.width, img.height) / 2; 81 | // get scale of circle image 82 | const scale = 50 / 2 / minRadius; 83 | // transform to put origin at top left of bounding rectangle scaling to fit image pattern 84 | ctx.setTransform(scale, 0, 0, scale, PADDING_LEFT / 2, 470 / 2); 85 | ctx.fillStyle = imgPat; 86 | ctx.beginPath(); 87 | ctx.arc(minRadius, minRadius, minRadius, 0, Math.PI * 2); 88 | ctx.fill(); 89 | // reset the default transform 90 | ctx.setTransform(1, 0, 0, 1, 0, 0); 91 | 92 | // Write the story teller 93 | ctx.font = `${20 / 2}px Inter ExtraBold`; 94 | ctx.fillStyle = "#03001C"; 95 | ctx.fillText(`${writer}:`, 180 / 2, 500 / 2); 96 | // Write author name 97 | ctx.font = `${35 / 2}px Inter ExtraBold`; 98 | ctx.fillStyle = "#03001C"; 99 | ctx.fillText(`git@${author}`, 180 / 2, 540 / 2); 100 | 101 | const logoImage = await loadImage(logo); 102 | const scaleFactor = Math.min(640 / logoImage.width, 440 / logoImage.height); 103 | const scaledWidth = logoImage.width * scaleFactor; 104 | const scaledHeight = logoImage.height * scaleFactor; 105 | 106 | ctx.drawImage( 107 | logoImage, 108 | 890 / 2, 109 | 460 / 2, 110 | (scaledWidth / 2 - 90) / 2, 111 | (scaledHeight / 2 - 90) / 2 112 | ); 113 | 114 | return canvas; 115 | }; 116 | -------------------------------------------------------------------------------- /src/middlewares.js: -------------------------------------------------------------------------------- 1 | function notFound(req, res, next) { 2 | res.status(404); 3 | const error = new Error(`🔍 - Not Found - ${req.originalUrl}`); 4 | next(error); 5 | } 6 | 7 | /* eslint-disable no-unused-vars */ 8 | function errorHandler(err, req, res, next) { 9 | /* eslint-enable no-unused-vars */ 10 | const statusCode = res.statusCode !== 200 ? res.statusCode : 500; 11 | res.status(statusCode); 12 | res.json({ 13 | message: err.message, 14 | stack: process.env.NODE_ENV === 'production' ? '🥞' : err.stack, 15 | }); 16 | } 17 | 18 | module.exports = { 19 | notFound, 20 | errorHandler, 21 | }; -------------------------------------------------------------------------------- /src/nodecanvas.js: -------------------------------------------------------------------------------- 1 | const ogDefault = require("./layouts/ogDefault"); 2 | const ogFacebook = require("./layouts/ogFacebook"); 3 | const ogFacebookMinimal = require("./layouts/ogFacebookMinimal"); 4 | const ogInstagram = require("./layouts/ogInstagram"); 5 | const ogInstagramMinimal = require("./layouts/ogInstagramMinimal"); 6 | const ogLinkedin = require("./layouts/ogLinkedin"); 7 | const ogLinkedinMinimal = require("./layouts/ogLinkedinMinimal"); 8 | const ogPinterest = require("./layouts/ogPinterest"); 9 | const ogTwitter = require("./layouts/ogTwitter"); 10 | const ogTwitterMinimal = require("./layouts/ogTwitterMinimal"); 11 | 12 | // @deprecated 13 | exports.classicSeoBanner = async (req, res) => { 14 | try { 15 | let { articleName, author, language = "javascript" } = req.query; 16 | 17 | const WIDTH = 1342; 18 | const HEIGHT = 853; 19 | const BORDER_SIZE = 10; 20 | 21 | const canvas = createCanvas(WIDTH, HEIGHT); 22 | const ctx = canvas.getContext("2d"); 23 | 24 | ctx.fillStyle = "#ffffff"; 25 | ctx.fillRect(0, 0, WIDTH, HEIGHT); 26 | 27 | ctx.lineWidth = BORDER_SIZE; 28 | ctx.strokeStyle = "#000000"; 29 | ctx.strokeRect( 30 | BORDER_SIZE / 2, 31 | BORDER_SIZE / 2, 32 | WIDTH - BORDER_SIZE, 33 | HEIGHT - BORDER_SIZE 34 | ); 35 | 36 | ctx.fillStyle = "#03001C"; 37 | ctx.font = "35px Inter ExtraBold"; 38 | ctx.fillText(`Storyteller: ${author} - Language: ${language}`, 85, 600); 39 | 40 | ctx.font = "65px Inter ExtraBold"; 41 | ctx.fillStyle = "#03001C"; 42 | let wrappedText = wrapText(ctx, articleName, 85, 723, 1200, 80); 43 | wrappedText[0].forEach(function (item) { 44 | ctx.fillText(item[0], item[1], item[2] - wrappedText[1] - 200); 45 | }); 46 | 47 | ctx.font = "35px Inter Medium"; 48 | ctx.fillStyle = "#03001C"; 49 | ctx.fillText("Metaphor Story", 85, 553 - wrappedText[1] - 100); 50 | 51 | const buffer = canvas.toBuffer("image/png"); 52 | res.setHeader("Content-Type", "image/png"); 53 | res.send(buffer); 54 | } catch (err) { 55 | console.error(err); 56 | res.status(500).send("Failed to generate SEO banner"); 57 | } 58 | }; 59 | 60 | exports.seoBanner = async (req, res) => { 61 | const { 62 | title = "Untitle", 63 | author = "darkterminal", 64 | logo = "https://metaphore.vercel.app/_next/image?url=%2F_next%2Fstatic%2Fmedia%2Fmetaphor.ee0ad64a.webp&w=640&q=75", 65 | head = "Metaphor Story", 66 | writer = "The Storyteller", 67 | template = 'default' 68 | } = req.query; 69 | 70 | let canvas; 71 | switch (template) { 72 | case "facebook": 73 | canvas = await ogFacebook(title, author, logo, head, writer); 74 | break; 75 | case "facebook-minimal": 76 | canvas = await ogFacebookMinimal(title, author, logo, head, writer); 77 | break; 78 | case "twitter": 79 | canvas = await ogTwitter(title, author, logo, head, writer); 80 | break; 81 | case "twitter-minimal": 82 | canvas = await ogTwitterMinimal(title, author, logo, head, writer); 83 | break; 84 | case "instagram": 85 | canvas = await ogInstagram(title, author, logo, head, writer); 86 | break; 87 | case "instagram-minimal": 88 | canvas = await ogInstagramMinimal(title, author, logo, head, writer); 89 | break; 90 | case "linkedin": 91 | canvas = await ogLinkedin(title, author, logo, head, writer); 92 | break; 93 | case "linkedin-minimal": 94 | canvas = await ogLinkedinMinimal(title, author, logo, head, writer); 95 | break; 96 | case "pinterest": 97 | canvas = await ogPinterest(title, author, logo, head, writer); 98 | break; 99 | default: 100 | canvas = await ogDefault(title, author, logo, head, writer); 101 | break; 102 | } 103 | 104 | const buffer = canvas.toBuffer("image/png"); 105 | res.setHeader("Content-Type", "image/png"); 106 | res.send(buffer); 107 | }; 108 | -------------------------------------------------------------------------------- /src/utils/calculateFontSize.js: -------------------------------------------------------------------------------- 1 | module.exports = function ( 2 | ctx, 3 | text, 4 | maxWidth, 5 | maxHeight, 6 | minFontSize, 7 | maxFontSize 8 | ) { 9 | let fontSize = maxFontSize; 10 | let width = ctx.measureText(text).width; 11 | 12 | while (width > maxWidth || fontSize > maxHeight) { 13 | fontSize--; 14 | 15 | if (fontSize < minFontSize) { 16 | fontSize = minFontSize; 17 | break; 18 | } 19 | width = ctx.measureText(text).width; 20 | } 21 | 22 | return fontSize; 23 | }; 24 | -------------------------------------------------------------------------------- /src/utils/shorten.js: -------------------------------------------------------------------------------- 1 | // Shorten a string to less than maxLen characters without truncating words. 2 | module.exports = function (str, maxLen, separator = " ") { 3 | if (str.length <= maxLen) return str; 4 | return str.substr(0, str.lastIndexOf(separator, maxLen)) + '...'; 5 | } 6 | -------------------------------------------------------------------------------- /src/utils/wrapText.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * @param {Object} ctx the context for the canvas 4 | * @param {String} text the text we wish to wrap 5 | * @param {Number} x the starting x position of the text 6 | * @param {Number} y the starting y position of the text 7 | * @param {Number} maxWidth the maximum width, i.e the width of the container 8 | * @param {Number} lineHeight the height of one line (as defined by us) 9 | * @returns Array 10 | */ 11 | module.exports = function wrapText(ctx, text, x, y, maxWidth, lineHeight) { 12 | const words = text.split(' '); 13 | const lines = []; 14 | let line = ''; 15 | 16 | for (let i = 0; i < words.length; i++) { 17 | const testLine = line + words[i] + ' '; 18 | const metrics = ctx.measureText(testLine); 19 | const testWidth = metrics.width; 20 | 21 | if (testWidth > maxWidth) { 22 | // truncate text if line is too long 23 | let truncatedText; 24 | if (line.length <= 60) { 25 | truncatedText = line.trim() + ' '; 26 | } else { 27 | truncatedText = line.trim().substring(0, 60) + '...'; 28 | } 29 | lines.push([truncatedText, x, y]); 30 | line = words[i] + ' '; 31 | y += lineHeight; 32 | } else { 33 | line = testLine; 34 | } 35 | } 36 | 37 | // add the last line 38 | const lastLine = line.trim(); 39 | if (lastLine) { 40 | lines.push([lastLine, x, y]); 41 | } 42 | 43 | // calculate total line height 44 | const totalLineHeight = (lines.length - 1) * lineHeight; 45 | 46 | // return the words in array, along with the total line height 47 | return [lines, totalLineHeight]; 48 | }; 49 | --------------------------------------------------------------------------------