Compare commits
8 commits
Author | SHA1 | Date | |
---|---|---|---|
18a214551a | |||
ce874eec4f | |||
6b9fbc0316 | |||
ed3de776b0 | |||
741a9c3250 | |||
343c2b95ed | |||
19147d231e | |||
3d6ae756a6 |
10 changed files with 82 additions and 45 deletions
1
.prettierrc.toml
Normal file
1
.prettierrc.toml
Normal file
|
@ -0,0 +1 @@
|
||||||
|
tabWidth = 4
|
|
@ -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 ;)
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
cd /app
|
cd /app
|
||||||
yarn
|
yarn
|
||||||
|
yarn build
|
||||||
yarn dev
|
yarn dev
|
|
@ -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
|
||||||
|
|
|
@ -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 .
|
||||||
|
|
|
@ -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",
|
||||||
|
|
62
src/index.js
62
src/index.js
|
@ -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}`
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
|
@ -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>
|
||||||
|
|
Loading…
Reference in a new issue