Compare commits
2 Commits
019652ca67
...
9b9d222546
Author | SHA1 | Date | |
---|---|---|---|
|
9b9d222546 | ||
|
86d7823aae |
47
license_server/Dockerfile
Normal file
47
license_server/Dockerfile
Normal file
|
@ -0,0 +1,47 @@
|
|||
FROM rust:1.69-slim-bullseye AS builder
|
||||
|
||||
ADD sources.list /etc/apt/
|
||||
RUN apt-get update && apt-get install -y \
|
||||
rpcsvc-proto \
|
||||
libc6-dev \
|
||||
libclang-dev \
|
||||
pkg-config \
|
||||
libssl-dev
|
||||
ADD crates.conf /root/.cargo/config
|
||||
RUN USER=root cargo new --bin license_service
|
||||
WORKDIR /license_service
|
||||
COPY ./Cargo.toml ./Cargo.toml
|
||||
|
||||
RUN cargo build --release && rm src/*.rs target/release/deps/license_server*
|
||||
|
||||
ADD ./src ./src
|
||||
|
||||
RUN cargo build --release
|
||||
|
||||
FROM debian:bullseye-slim AS deployer
|
||||
|
||||
ADD sources.list /etc/apt/
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get install -y ca-certificates tzdata && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
EXPOSE 8080
|
||||
|
||||
ENV TZ=Asia/Shanghai \
|
||||
APP_USER=license_usr
|
||||
|
||||
RUN groupadd service && \
|
||||
useradd -g service $APP_USER && \
|
||||
mkdir -p /license_service
|
||||
|
||||
COPY --from=builder /license_service/target/release/license_server /license_service/license_server
|
||||
|
||||
RUN chown -R $APP_USER:service license_server
|
||||
|
||||
USER $APP_USER
|
||||
WORKDIR /license_service
|
||||
|
||||
VOLUME ["/license_service/license.key", "/license_service/license.pem", "/license_service/netfilter.zip", "/license_service/products.json"]
|
||||
|
||||
CMD ["./license_server"]
|
14
license_server/crates.conf
Normal file
14
license_server/crates.conf
Normal file
|
@ -0,0 +1,14 @@
|
|||
[source.crates-io]
|
||||
# To use sparse index, change 'rsproxy' to 'rsproxy-sparse'
|
||||
replace-with = 'rsproxy-sparse'
|
||||
|
||||
[source.rsproxy]
|
||||
registry = "https://rsproxy.cn/crates.io-index"
|
||||
[source.rsproxy-sparse]
|
||||
registry = "sparse+https://rsproxy.cn/index/"
|
||||
|
||||
[registries.rsproxy]
|
||||
index = "https://rsproxy.cn/crates.io-index"
|
||||
|
||||
[net]
|
||||
git-fetch-with-cli = true
|
23
license_server/sources.list
Normal file
23
license_server/sources.list
Normal file
|
@ -0,0 +1,23 @@
|
|||
deb http://mirrors.163.com/debian/ bullseye main non-free contrib
|
||||
|
||||
deb http://mirrors.163.com/debian/ bullseye-updates main non-free contrib
|
||||
|
||||
deb http://mirrors.163.com/debian/ bullseye-backports main non-free contrib
|
||||
|
||||
deb-src http://mirrors.163.com/debian/ bullseye main non-free contrib
|
||||
|
||||
deb-src http://mirrors.163.com/debian/ bullseye-updates main non-free contrib
|
||||
|
||||
deb-src http://mirrors.163.com/debian/ bullseye-backports main non-free contrib
|
||||
|
||||
#deb http://mirrors.163.com/debian-security/ bullseye/updates main non-free contrib
|
||||
|
||||
#deb http://mirrors.ustc.edu.cn/debian-security/ bullseye/updates main non-free contrib
|
||||
|
||||
#deb-src http://mirrors.163.com/debian-security/ bullseye/updates main non-free contrib
|
||||
|
||||
#deb-src http://mirrors.ustc.edu.cn/debian-security/ bullseye/updates main non-free contrib
|
||||
|
||||
deb http://mirrors.ustc.edu.cn/debian-security/ stable-security main non-free contrib
|
||||
|
||||
deb-src http://mirrors.ustc.edu.cn/debian-security/ stable-security main non-free contri
|
|
@ -9,9 +9,9 @@ export function LicenseCode() {
|
|||
const licenseCode = useLicenseCodeStore((state) => state.licenceCode);
|
||||
const copyLicenseCode = async () => {
|
||||
if (not(isEmpty(licenseCode))) {
|
||||
await navigator.clipboard.writeText(licenseCode);
|
||||
await navigator.clipboard.writeText(licenseCode ?? "");
|
||||
notifications.show({
|
||||
title: "授权码已复制",
|
||||
message: "授权码已复制",
|
||||
color: "green",
|
||||
});
|
||||
}
|
||||
|
|
|
@ -80,7 +80,7 @@ async function generateLicense(form: LicenseInfoForm, selectedProducts: string[]
|
|||
const validDays = now.add(validYears, "year").diff(now, "day");
|
||||
if (isEmpty(selectedProducts)) {
|
||||
notifications.show({
|
||||
title: "至少需要选择一个产品",
|
||||
message: "至少需要选择一个产品",
|
||||
color: "red",
|
||||
});
|
||||
return "";
|
||||
|
|
|
@ -22,7 +22,7 @@ export const useProductsStore = create<ProductsStore>((set, get) => ({
|
|||
append: (code: string) => {
|
||||
const selectedProduct: Product | undefined = find(propEq(code, "id"), get().products);
|
||||
set((state) => ({
|
||||
selectedProducts: uniq([...state.selectedProducts, code, ...(selectedProduct.couple ?? [])]),
|
||||
selectedProducts: uniq([...state.selectedProducts, code, ...(selectedProduct?.couple ?? [])]),
|
||||
}));
|
||||
},
|
||||
remove: (code: string) =>
|
||||
|
|
|
@ -4,5 +4,11 @@ export const theme = createTheme({
|
|||
focusRing: "never",
|
||||
fontSmoothing: true,
|
||||
defaultRadius: "xs",
|
||||
lineHeights: "xs",
|
||||
lineHeights: {
|
||||
xs: "1.2",
|
||||
sm: "1.25",
|
||||
md: "1.35",
|
||||
lg: "1.4",
|
||||
xl: "1.5",
|
||||
},
|
||||
});
|
||||
|
|
|
@ -1,21 +1,5 @@
|
|||
import cx, { ClassDictionary } from "clsx";
|
||||
import { defaultTo, isEmpty, isNil, prop } from "ramda";
|
||||
import { ChangeHandler } from "react-hook-form";
|
||||
|
||||
export function convertFormEvent(
|
||||
name: string,
|
||||
event: InputEvent,
|
||||
property: string = "value",
|
||||
defaultValue?: unknown = null
|
||||
): Parameters<ChangeHandler> {
|
||||
return {
|
||||
target: {
|
||||
name,
|
||||
value: defaultTo(defaultValue)(prop(property, event.currentTarget)),
|
||||
},
|
||||
type: event.type,
|
||||
};
|
||||
}
|
||||
import { isEmpty, isNil, prop } from "ramda";
|
||||
|
||||
export function composite(classesDefination: ClassDictionary, ...classes: string[]) {
|
||||
/** @type {import("clsx").ClassArray} */
|
||||
|
|
Loading…
Reference in New Issue
Block a user