Compare commits

...

8 commits
1.0.0 ... main

Author SHA1 Message Date
18a214551a
Fix for preview images 2023-05-19 08:24:03 +02:00
ce874eec4f fix share preview images (#3)
Co-authored-by: nikurasu <publicmail@nikurasu.gay>
Reviewed-on: #3
2023-05-19 07:46:46 +02:00
6b9fbc0316 Add preview cards (#2)
Added preview cards for Twitter, Mastodon, Discord, etc.

Co-authored-by: nikurasu <publicmail@nikurasu.gay>
Reviewed-on: #2
2023-05-14 11:39:53 +02:00
ed3de776b0
Set correct image tag in docker build-script 2023-03-03 15:01:54 +01:00
741a9c3250 Update 'dev/docker/stacks/main/compose.yml'
Switched to correct container url
2023-03-02 20:08:40 +01:00
343c2b95ed Update 'README.md'
With current Domain
2023-03-02 20:07:37 +01:00
19147d231e
Bumped package.json to 1.0.0 and added new todo 2023-02-03 08:23:51 +01:00
3d6ae756a6 Fixed Docker not building when yarn.lock and .env not present 2023-01-20 22:17:21 +01:00
10 changed files with 82 additions and 45 deletions

1
.prettierrc.toml Normal file
View file

@ -0,0 +1 @@
tabWidth = 4

View file

@ -17,6 +17,7 @@
- [ ] more themes - [ ] more themes
- [ ] more variations of the themes in version 1.0 - [ ] more variations of the themes in version 1.0
- [X] Dockerize - [X] Dockerize
- [ ] Redirection with Routes (your-domain.xyz/mastodon redirects to your mastodon account)
### TODO until 1.0: ### TODO until 1.0:
- [X] Import my themes from the old socialtree - [X] Import my themes from the old socialtree
@ -29,7 +30,7 @@
A up to date docker image is provided at my gitea, but you can also build it yourself. A up to date docker image is provided at my gitea, but you can also build it yourself.
### Build ### Build
1. Clone the repository `git clone https://git.oishi-ra.men/Nikurasu/socialtree-js.git` 1. Clone the repository `git clone https://dev.cat-enby.club/Nikurasu/socialtree.git`
2. Copy .env.example to .env and edit it to your needs 2. Copy .env.example to .env and edit it to your needs
3. Build the image. For unix like systems I provide a bash script in `dev/shell/docker-prod.sh`. I hated the hassle to type the full command every time ;) 3. Build the image. For unix like systems I provide a bash script in `dev/shell/docker-prod.sh`. I hated the hassle to type the full command every time ;)
@ -53,4 +54,4 @@ If you want a completely new layout that requires another layout in the HTML you
3. Write your own layout. You can see the available variables and their names in `src/index.js` 3. Write your own layout. You can see the available variables and their names in `src/index.js`
4. Do the Stuff needed for a SCSS only theme. 4. Do the Stuff needed for a SCSS only theme.
To use your themes in Docker you have to rebuild the image. To use your themes in Docker you have to rebuild the image.

View file

@ -1,6 +1,8 @@
name: "Nikurasu" # The name on the linktree name: "Nikurasu" # The name on the linktree
# summaryText: 'A simple sample text' # A short summary for what you do, will appear if uncommened # summaryText: 'A simple sample text' # A short summary for what you do, will appear if uncommened
# profilePic: # uncomment and set this if your profile pic has a custom name # profilePic: # uncomment and set this if your profile pic has a custom name
url: "https://links.nikurasu.gay" # URL of your SocialTree
siteName: 'NikuHost' # Name of the site visible in embeds, used for Link previews
roundPB: false # Set true if you want a round profile picture roundPB: false # Set true if you want a round profile picture
theme: '98' # Your theme theme: '98' # Your theme
links: # the links to your social accounts links: # the links to your social accounts

View file

@ -2,9 +2,7 @@ FROM node:lts-alpine
LABEL maintainer="nikurasu_tan publicmail@nikurasu.gay" LABEL maintainer="nikurasu_tan publicmail@nikurasu.gay"
WORKDIR /app WORKDIR /app
COPY src/ ./src COPY src/ ./src
COPY package.json ./ COPY package.json yarn.loc[k] .en[v] ./
COPY yarn.lock ./
COPY .env ./.env
COPY assets /assets COPY assets /assets
RUN mv /assets/config/config.yml.example /assets/config/config.yml RUN mv /assets/config/config.yml.example /assets/config/config.yml
COPY dev/shell/entrypoint.sh /entrypoint.sh COPY dev/shell/entrypoint.sh /entrypoint.sh

View file

@ -1,3 +1,4 @@
cd /app cd /app
yarn yarn
yarn build
yarn dev yarn dev

View file

@ -1,7 +1,7 @@
version: '3' version: '3'
services: services:
app: app:
image: git.oishi-ra.men/nikurasu/socialtree-js:latest image: dev.cat-enby.club/nikurasu/socialtree:latest
container_name: socialtree container_name: socialtree
environment: environment:
PORT: 3000 PORT: 3000

View file

@ -1,2 +1,2 @@
docker build -t dev.cat-enby.club/nikurasu/socialtree-js:latest -f dev/docker/images/main/Dockerfile --no-cache . docker build -t dev.cat-enby.club/nikurasu/socialtree:latest -f dev/docker/images/main/Dockerfile --no-cache .
docker build -t dev.cat-enby.club/nikurasu/socialtree-js:$1 -f dev/docker/images/main/Dockerfile . docker build -t dev.cat-enby.club/nikurasu/socialtree:$1 -f dev/docker/images/main/Dockerfile .

View file

@ -1,6 +1,6 @@
{ {
"name": "socialtree", "name": "socialtree",
"version": "0.3.0", "version": "1.0.0",
"description": "The awesome and damn simple, selfhosted alternative to linktree", "description": "The awesome and damn simple, selfhosted alternative to linktree",
"main": "src/index.js", "main": "src/index.js",
"author": "nikurasu", "author": "nikurasu",

View file

@ -1,36 +1,48 @@
import express from 'express' import express from "express";
import yaml from 'js-yaml' import yaml from "js-yaml";
import fs from 'node:fs' import fs from "node:fs";
import * as dotenv from 'dotenv' import * as dotenv from "dotenv";
console.log('🔧 Configuring socialtree...') console.log("🔧 Configuring socialtree...");
dotenv.config() dotenv.config();
const app = express() const app = express();
const port = process.env.PORT || 3000 const port = process.env.PORT || 3000;
const engine = 'ejs' const engine = "ejs";
const customMainPartialThemes = [ // Array of themes that require a custom main partial const customMainPartialThemes = [
'98' // Array of themes that require a custom main partial
] "98",
];
app.set('view engine', engine) app.set("view engine", engine);
app.set('views', './src/views') app.set("views", "./src/views");
app.use(express.static('src/dist')) app.use(express.static("src/dist"));
app.use(express.static('assets')) app.use(express.static("assets"));
app.get('/', (req, res) => { app.get("/", (req, res) => {
let config = yaml.load(fs.readFileSync('assets/config/config.yml'), 'utf8') let config = yaml.load(fs.readFileSync("assets/config/config.yml"), "utf8");
res.render('index', { res.render("index", {
name: config.name, name: config.name,
filenameProfilePic: config.profilePic ? config.profilePic : 'profilepic.jpg', url: config.url,
summaryText: config.summaryText ? config.summaryText: '', filenameProfilePic: config.profilePic
? config.profilePic
: "profilepic.jpg",
summaryText: config.summaryText ? config.summaryText : "",
links: config.links, links: config.links,
smallLinks: config.smallLinks, smallLinks: config.smallLinks,
theme: config.theme, theme: config.theme,
roundPB: config.roundPB, roundPB: config.roundPB,
customMainPartialThemes: customMainPartialThemes customMainPartialThemes: customMainPartialThemes,
}) metaDescription: config.summaryText
}) ? config.summaryText
: config.links.map((link) => link.text).join(" | "),
siteName: config.siteName ? config.siteName : "SocialTree",
});
});
app.listen(port, () => console.log(`🚀 Socialtree started on port ${port}, with view engine ${engine}`)) app.listen(port, () =>
console.log(
`🚀 Socialtree started on port ${port}, with view engine ${engine}`
)
);

View file

@ -1,13 +1,35 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/fork-awesome@1.2.0/css/fork-awesome.min.css" integrity="sha256-XoaMnoYC5TH6/+ihMEnospgm0J1PM/nioxbOUdnM8HY=" crossorigin="anonymous"> <link
<link rel="stylesheet" href="style/<%= theme %>.css"> rel="stylesheet"
<% if(theme === '98') { %> href="https://cdn.jsdelivr.net/npm/fork-awesome@1.2.0/css/fork-awesome.min.css"
<link rel="stylesheet" href="https://unpkg.com/98.css"> integrity="sha256-XoaMnoYC5TH6/+ihMEnospgm0J1PM/nioxbOUdnM8HY="
<% } %> crossorigin="anonymous"
<% if(roundPB) { %> />
<link rel="stylesheet" href="style/round-pb.css"> <link rel="stylesheet" href="style/<%= theme %>.css" />
<% } %> <% if(theme === '98') { %>
</head> <link rel="stylesheet" href="https://unpkg.com/98.css" />
<% } %> <% if(roundPB) { %>
<link rel="stylesheet" href="style/round-pb.css" />
<% } %>
<title><%= name %> - SocialTree</title>
<meta property="og:title" content="<%= name %> - SocialTree" />
<meta
property="og:image"
content="<%= url %>/img/<%= filenameProfilePic %>"
/>
<meta property="description" content="<%= metaDescription %>" />
<meta property="og:description" content="<%= metaDescription %>" />
<meta property="og:site_name" content="<%= siteName %>" />
<meta property="og:url" content="<%= url %>" />
<meta
property="twitter:image"
content="<%= url %>/img/<%= filenameProfilePic %>"
/>
<meta property="twitter:card" content="summary" />
<meta property="twitter:title" content="<%= name %> - SocialTree" />
<meta property="twitter:description" content="<%= metaDescription %>" />
</head>
</html>