Compare commits
No commits in common. "main" and "1.0.0" have entirely different histories.
10 changed files with 45 additions and 82 deletions
|
@ -1 +0,0 @@
|
|||
tabWidth = 4
|
|
@ -17,7 +17,6 @@
|
|||
- [ ] more themes
|
||||
- [ ] more variations of the themes in version 1.0
|
||||
- [X] Dockerize
|
||||
- [ ] Redirection with Routes (your-domain.xyz/mastodon redirects to your mastodon account)
|
||||
|
||||
### TODO until 1.0:
|
||||
- [X] Import my themes from the old socialtree
|
||||
|
@ -30,7 +29,7 @@
|
|||
A up to date docker image is provided at my gitea, but you can also build it yourself.
|
||||
|
||||
### Build
|
||||
1. Clone the repository `git clone https://dev.cat-enby.club/Nikurasu/socialtree.git`
|
||||
1. Clone the repository `git clone https://git.oishi-ra.men/Nikurasu/socialtree-js.git`
|
||||
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 ;)
|
||||
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
name: "Nikurasu" # The name on the linktree
|
||||
# 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
|
||||
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
|
||||
theme: '98' # Your theme
|
||||
links: # the links to your social accounts
|
||||
|
|
|
@ -2,7 +2,9 @@ FROM node:lts-alpine
|
|||
LABEL maintainer="nikurasu_tan publicmail@nikurasu.gay"
|
||||
WORKDIR /app
|
||||
COPY src/ ./src
|
||||
COPY package.json yarn.loc[k] .en[v] ./
|
||||
COPY package.json ./
|
||||
COPY yarn.lock ./
|
||||
COPY .env ./.env
|
||||
COPY assets /assets
|
||||
RUN mv /assets/config/config.yml.example /assets/config/config.yml
|
||||
COPY dev/shell/entrypoint.sh /entrypoint.sh
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
cd /app
|
||||
yarn
|
||||
yarn build
|
||||
yarn dev
|
|
@ -1,7 +1,7 @@
|
|||
version: '3'
|
||||
services:
|
||||
app:
|
||||
image: dev.cat-enby.club/nikurasu/socialtree:latest
|
||||
image: git.oishi-ra.men/nikurasu/socialtree-js:latest
|
||||
container_name: socialtree
|
||||
environment:
|
||||
PORT: 3000
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
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:$1 -f dev/docker/images/main/Dockerfile .
|
||||
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-js:$1 -f dev/docker/images/main/Dockerfile .
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "socialtree",
|
||||
"version": "1.0.0",
|
||||
"version": "0.3.0",
|
||||
"description": "The awesome and damn simple, selfhosted alternative to linktree",
|
||||
"main": "src/index.js",
|
||||
"author": "nikurasu",
|
||||
|
|
62
src/index.js
62
src/index.js
|
@ -1,48 +1,36 @@
|
|||
import express from "express";
|
||||
import yaml from "js-yaml";
|
||||
import fs from "node:fs";
|
||||
import * as dotenv from "dotenv";
|
||||
import express from 'express'
|
||||
import yaml from 'js-yaml'
|
||||
import fs from 'node:fs'
|
||||
import * as dotenv from 'dotenv'
|
||||
|
||||
console.log("🔧 Configuring socialtree...");
|
||||
console.log('🔧 Configuring socialtree...')
|
||||
|
||||
dotenv.config();
|
||||
const app = express();
|
||||
const port = process.env.PORT || 3000;
|
||||
const engine = "ejs";
|
||||
dotenv.config()
|
||||
const app = express()
|
||||
const port = process.env.PORT || 3000
|
||||
const engine = 'ejs'
|
||||
|
||||
const customMainPartialThemes = [
|
||||
// Array of themes that require a custom main partial
|
||||
"98",
|
||||
];
|
||||
const customMainPartialThemes = [ // Array of themes that require a custom main partial
|
||||
'98'
|
||||
]
|
||||
|
||||
app.set("view engine", engine);
|
||||
app.set("views", "./src/views");
|
||||
app.use(express.static("src/dist"));
|
||||
app.use(express.static("assets"));
|
||||
app.set('view engine', engine)
|
||||
app.set('views', './src/views')
|
||||
app.use(express.static('src/dist'))
|
||||
app.use(express.static('assets'))
|
||||
|
||||
app.get("/", (req, res) => {
|
||||
let config = yaml.load(fs.readFileSync("assets/config/config.yml"), "utf8");
|
||||
res.render("index", {
|
||||
app.get('/', (req, res) => {
|
||||
let config = yaml.load(fs.readFileSync('assets/config/config.yml'), 'utf8')
|
||||
res.render('index', {
|
||||
name: config.name,
|
||||
url: config.url,
|
||||
filenameProfilePic: config.profilePic
|
||||
? config.profilePic
|
||||
: "profilepic.jpg",
|
||||
summaryText: config.summaryText ? config.summaryText : "",
|
||||
filenameProfilePic: config.profilePic ? config.profilePic : 'profilepic.jpg',
|
||||
summaryText: config.summaryText ? config.summaryText: '',
|
||||
links: config.links,
|
||||
smallLinks: config.smallLinks,
|
||||
theme: config.theme,
|
||||
roundPB: config.roundPB,
|
||||
customMainPartialThemes: customMainPartialThemes,
|
||||
metaDescription: config.summaryText
|
||||
? config.summaryText
|
||||
: config.links.map((link) => link.text).join(" | "),
|
||||
siteName: config.siteName ? config.siteName : "SocialTree",
|
||||
});
|
||||
});
|
||||
customMainPartialThemes: customMainPartialThemes
|
||||
})
|
||||
})
|
||||
|
||||
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,35 +1,13 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<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 rel="stylesheet" href="style/<%= theme %>.css" />
|
||||
<head>
|
||||
<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 rel="stylesheet" href="style/<%= theme %>.css">
|
||||
<% if(theme === '98') { %>
|
||||
<link rel="stylesheet" href="https://unpkg.com/98.css" />
|
||||
<% } %> <% if(roundPB) { %>
|
||||
<link rel="stylesheet" href="style/round-pb.css" />
|
||||
<link rel="stylesheet" href="https://unpkg.com/98.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>
|
||||
<% if(roundPB) { %>
|
||||
<link rel="stylesheet" href="style/round-pb.css">
|
||||
<% } %>
|
||||
</head>
|
||||
|
|
Loading…
Reference in a new issue