├── .gitignore ├── LICENSE ├── README.md ├── build.gradle ├── config ├── example.fleet.properties ├── fleet_static │ └── logo.png ├── log4j2.local.xml └── log4j2.release.xml ├── doc ├── actions.png ├── admin_image_list.png ├── repo_list.png └── unstable.png ├── gradle └── wrapper │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── settings.gradle └── src ├── main ├── java │ └── io │ │ └── linuxserver │ │ └── fleet │ │ ├── auth │ │ ├── AuthenticatedUser.java │ │ ├── AuthenticationDelegate.java │ │ ├── AuthenticationResult.java │ │ ├── DefaultAuthenticationDelegate.java │ │ ├── UserCredentials.java │ │ ├── authenticator │ │ │ ├── DefaultUserAuthenticator.java │ │ │ └── UserAuthenticator.java │ │ └── security │ │ │ ├── PBKDF2PasswordEncoder.java │ │ │ ├── PasswordEncoder.java │ │ │ └── util │ │ │ └── SaltGenerator.java │ │ ├── core │ │ ├── AbstractAppController.java │ │ ├── BaseRuntimeLoader.java │ │ ├── FleetAppController.java │ │ ├── FleetRuntime.java │ │ ├── Main.java │ │ ├── PropertiesLoader.java │ │ ├── ServiceProvider.java │ │ ├── config │ │ │ ├── AppProperties.java │ │ │ ├── DatabaseConnectionProperties.java │ │ │ ├── Version.java │ │ │ ├── VersionProperties.java │ │ │ └── WebConfiguration.java │ │ └── db │ │ │ ├── DatabaseConnection.java │ │ │ ├── DatabaseProvider.java │ │ │ └── DefaultDatabaseProvider.java │ │ ├── db │ │ ├── DefaultDatabaseConnection.java │ │ ├── PoolingDatabaseConnection.java │ │ ├── dao │ │ │ └── Utils.java │ │ ├── migration │ │ │ └── DatabaseVersion.java │ │ └── query │ │ │ ├── InsertUpdateResult.java │ │ │ ├── InsertUpdateStatus.java │ │ │ ├── LimitOffset.java │ │ │ └── LimitedResult.java │ │ ├── dockerhub │ │ ├── DockerHubException.java │ │ ├── model │ │ │ ├── DockerHubV2Image.java │ │ │ ├── DockerHubV2ImageListResult.java │ │ │ ├── DockerHubV2NamespaceLookupResult.java │ │ │ ├── DockerHubV2ScanResult.java │ │ │ ├── DockerHubV2Tag.java │ │ │ ├── DockerHubV2TagDigest.java │ │ │ └── DockerHubV2TagListResult.java │ │ └── util │ │ │ └── DockerTagFinder.java │ │ ├── exception │ │ └── SaveException.java │ │ └── v2 │ │ ├── LoggerOwner.java │ │ ├── Utils.java │ │ ├── cache │ │ ├── AbstractItemCache.java │ │ ├── BasicItemCache.java │ │ ├── ImageCache.java │ │ ├── ItemCache.java │ │ ├── RepositoryCache.java │ │ └── ScheduleCache.java │ │ ├── client │ │ ├── docker │ │ │ ├── AbstractDockerApiClient.java │ │ │ ├── DockerApiClient.java │ │ │ ├── DockerImageNotFoundException.java │ │ │ ├── converter │ │ │ │ ├── AbstractDockerResponseConverter.java │ │ │ │ └── DockerResponseConverter.java │ │ │ ├── dockerhub │ │ │ │ ├── DockerHubApiClient.java │ │ │ │ ├── DockerHubAuthenticator.java │ │ │ │ ├── DockerHubCredentials.java │ │ │ │ ├── DockerHubImageConverter.java │ │ │ │ ├── DockerHubTagConverter.java │ │ │ │ ├── IDockerHubAuthenticator.java │ │ │ │ └── NoOpDockerHubAuthenticator.java │ │ │ ├── github │ │ │ │ ├── GitHubContainerRegistryClient.java │ │ │ │ ├── GitHubImageConverter.java │ │ │ │ ├── GitHubTagConverter.java │ │ │ │ └── model │ │ │ │ │ ├── GitHubImage.java │ │ │ │ │ └── GitHubTag.java │ │ │ └── queue │ │ │ │ ├── AsyncDockerApiRequest.java │ │ │ │ ├── AsyncDockerApiResponse.java │ │ │ │ ├── DockerApiDelegate.java │ │ │ │ ├── DockerApiTaskConsumer.java │ │ │ │ ├── DockerImageMissingUpdateResponse.java │ │ │ │ ├── DockerImageUpdateRequest.java │ │ │ │ ├── DockerImageUpdateResponse.java │ │ │ │ └── TaskQueue.java │ │ └── rest │ │ │ ├── HttpException.java │ │ │ ├── RestClient.java │ │ │ ├── RestResponse.java │ │ │ ├── marshalling │ │ │ ├── JacksonMarshallingStrategy.java │ │ │ └── MarshallingStrategy.java │ │ │ └── proxy │ │ │ ├── LazyLoadPayloadProxy.java │ │ │ └── PayloadProxy.java │ │ ├── db │ │ ├── AbstractDAO.java │ │ ├── DbUpdateStatus.java │ │ ├── DefaultImageDAO.java │ │ ├── DefaultScheduleDAO.java │ │ ├── DefaultUserDAO.java │ │ ├── ImageDAO.java │ │ ├── ImageTemplateFactory.java │ │ ├── ScheduleDAO.java │ │ ├── UserDAO.java │ │ └── Utils.java │ │ ├── file │ │ └── FileManager.java │ │ ├── key │ │ ├── AbstractDatabaseKey.java │ │ ├── AbstractHasKey.java │ │ ├── AbstractLookupKey.java │ │ ├── AlertKey.java │ │ ├── HasKey.java │ │ ├── ImageKey.java │ │ ├── ImageLookupKey.java │ │ ├── Key.java │ │ ├── RepositoryKey.java │ │ ├── ScheduleKey.java │ │ ├── TagBranchKey.java │ │ └── UserKey.java │ │ ├── service │ │ ├── AbstractAppService.java │ │ ├── ImageService.java │ │ ├── ScheduleService.java │ │ ├── SynchronisationService.java │ │ ├── UserService.java │ │ └── util │ │ │ └── TemplateMerger.java │ │ ├── thread │ │ ├── AbstractAppTask.java │ │ ├── AbstractAppThread.java │ │ ├── AbstractTaskQueueConsumer.java │ │ ├── AsyncTask.java │ │ ├── AsyncTaskDelegate.java │ │ ├── AsyncTaskResponse.java │ │ ├── TaskExecutionException.java │ │ ├── TaskResponseControllerProxy.java │ │ ├── ThreadStatus.java │ │ └── schedule │ │ │ ├── AbstractAppSchedule.java │ │ │ ├── AppSchedule.java │ │ │ ├── CheckAppVersionSchedule.java │ │ │ ├── ScheduleSpec.java │ │ │ ├── TidyHistoricDataSchedule.java │ │ │ ├── TimeWithUnit.java │ │ │ ├── cache │ │ │ └── RefreshCacheSchedule.java │ │ │ └── sync │ │ │ ├── AllImagesSyncSchedule.java │ │ │ ├── CleanRemovedImagesSchedule.java │ │ │ └── GetMissingImagesSchedule.java │ │ ├── types │ │ ├── AbstractSyncItem.java │ │ ├── AppAlert.java │ │ ├── FilePathDetails.java │ │ ├── HasSyncSpec.java │ │ ├── Image.java │ │ ├── ImageCountData.java │ │ ├── Repository.java │ │ ├── Tag.java │ │ ├── TagBranch.java │ │ ├── TagDigest.java │ │ ├── User.java │ │ ├── api │ │ │ ├── AbstractApiWrapper.java │ │ │ ├── ApiImagePullHistoryWrapper.java │ │ │ ├── ApiImageWrapper.java │ │ │ ├── ApiRepositoryWrapper.java │ │ │ ├── ApiScheduleWrapper.java │ │ │ └── external │ │ │ │ ├── AllImagesExternalApiResponse.java │ │ │ │ ├── ExternalApiImage.java │ │ │ │ ├── ExternalApiResponse.java │ │ │ │ └── templates │ │ │ │ ├── ApiDeviceTemplate.java │ │ │ │ ├── ApiEnvTemplate.java │ │ │ │ ├── ApiPortTemplate.java │ │ │ │ ├── ApiTemplateHolder.java │ │ │ │ └── ApiVolumeTemplate.java │ │ ├── docker │ │ │ ├── DockerCapability.java │ │ │ ├── DockerImage.java │ │ │ ├── DockerTag.java │ │ │ └── DockerTagManifestDigest.java │ │ ├── internal │ │ │ ├── AbstractParamRequest.java │ │ │ ├── ImageAppLogo.java │ │ │ ├── ImageGeneralInfoUpdateRequest.java │ │ │ ├── ImageOutlineRequest.java │ │ │ ├── ImageTemplateRequest.java │ │ │ ├── ImageUrlsUpdateRequest.java │ │ │ ├── RepositoryOutlineRequest.java │ │ │ ├── TagBranchOutlineRequest.java │ │ │ └── UserOutlineRequest.java │ │ └── meta │ │ │ ├── ExternalUrl.java │ │ │ ├── ExternalUrlKey.java │ │ │ ├── ImageCoreMeta.java │ │ │ ├── ImageMetaData.java │ │ │ ├── ItemSyncSpec.java │ │ │ ├── history │ │ │ ├── ImagePullHistory.java │ │ │ └── ImagePullStatistic.java │ │ │ └── template │ │ │ ├── AbstractTemplateItem.java │ │ │ ├── DeviceTemplateItem.java │ │ │ ├── EnvironmentTemplateItem.java │ │ │ ├── ImageTemplateHolder.java │ │ │ ├── PortTemplateItem.java │ │ │ ├── TemplateItem.java │ │ │ └── VolumeTemplateItem.java │ │ └── web │ │ ├── ApiException.java │ │ ├── AppRole.java │ │ ├── LocationUtils.java │ │ ├── Locations.java │ │ ├── PageModelAttributes.java │ │ ├── PageModelSpec.java │ │ ├── SessionAttributes.java │ │ ├── WebRouteController.java │ │ ├── freemarker │ │ ├── CustomFreemarkerTemplate.java │ │ └── Java8DateTimeMethod.java │ │ ├── request │ │ └── json │ │ │ ├── NewRepositoryRequest.java │ │ │ ├── UpdateImageSpecRequest.java │ │ │ └── UpdateRepositoryRequest.java │ │ └── routes │ │ ├── AbstractPageHandler.java │ │ ├── AdminImageController.java │ │ ├── AdminImageEditController.java │ │ ├── AdminRepositoryController.java │ │ ├── AdminScheduleController.java │ │ ├── AdminUserController.java │ │ ├── DefaultAccessManager.java │ │ ├── HomeController.java │ │ ├── ImageController.java │ │ ├── InternalApiController.java │ │ ├── LegacyExternalApiController.java │ │ └── LoginController.java └── resources │ ├── db │ └── migration │ │ ├── V1.0__CreateTables.sql │ │ ├── V1.10__UpdateImageViewWithRepository.sql │ │ ├── V1.1__CreateSprocs.sql │ │ ├── V1.2__CreateUserTable.sql │ │ ├── V1.3__CreateUserSprocs.sql │ │ ├── V1.4__AddDeprecationFields.sql │ │ ├── V1.5__UpdateImageSprocs.sql │ │ ├── V1.6__ExtendVersionColumn.sql │ │ ├── V1.7__RemoveCoalesce.sql │ │ ├── V1.8__PullHistoryAndImageMeta.sql │ │ ├── V1.9__ExtraTagFields.sql │ │ ├── V2.0__CreateV2TablesAndSprocs.sql │ │ ├── V2.1__MigrateToNewTables.sql │ │ ├── V2.2__MetaDataTables.sql │ │ ├── V2.3__UpdateImageViewForCoreMeta.sql │ │ ├── V2.4__UpdateUserSprocs.sql │ │ ├── V2.5__BranchRemovalSproc.sql │ │ ├── V2.6__AddCleanSchedule.sql │ │ ├── V2.7__UpdateImageTemplateSprocs.sql │ │ └── V2.8__FixStoreCoreMetaOutputBug.sql │ ├── static │ └── assets │ │ ├── css │ │ ├── app.css │ │ ├── bootstrap.css │ │ ├── bulma-0.7.5.min.css │ │ ├── bulma-0.8.0.min.css │ │ ├── fontawesome-all.min.css │ │ └── prism.css │ │ ├── images │ │ ├── favicon-32x32.png │ │ ├── favicon.ico │ │ └── logo.png │ │ ├── js │ │ ├── Chart.bundle.min.js │ │ ├── admin.js │ │ ├── app.js │ │ ├── bootstrap.bundle.min.js │ │ ├── fontawesome-all.js │ │ ├── jquery-3.5.1.min.js │ │ ├── jquery.tablesorter.js │ │ └── prism.js │ │ └── webfonts │ │ ├── fa-brands-400.eot │ │ ├── fa-brands-400.svg │ │ ├── fa-brands-400.ttf │ │ ├── fa-brands-400.woff │ │ ├── fa-brands-400.woff2 │ │ ├── fa-solid-900.eot │ │ ├── fa-solid-900.svg │ │ ├── fa-solid-900.ttf │ │ ├── fa-solid-900.woff │ │ └── fa-solid-900.woff2 │ ├── version.properties │ └── views │ ├── pages │ ├── admin │ │ ├── image-edit.ftl │ │ ├── images.ftl │ │ ├── repositories.ftl │ │ ├── schedules.ftl │ │ ├── template-components │ │ │ ├── image-template-devices.ftl │ │ │ ├── image-template-environment.ftl │ │ │ ├── image-template-misc.ftl │ │ │ ├── image-template-ports.ftl │ │ │ └── image-template-volumes.ftl │ │ └── users.ftl │ ├── error.ftl │ ├── home.ftl │ ├── image.ftl │ └── login.ftl │ ├── prebuilt │ ├── base.ftl │ ├── docker-example.ftl │ ├── fleet-title.ftl │ ├── image-list-item.ftl │ ├── image-list-table-item.ftl │ └── system-alert.ftl │ └── ui │ ├── components │ ├── dropdown.ftl │ ├── message.ftl │ ├── modal.ftl │ ├── navbar.ftl │ └── pagination.ftl │ ├── elements │ ├── box.ftl │ ├── button.ftl │ ├── display-field.ftl │ ├── media.ftl │ ├── notification.ftl │ ├── table.ftl │ └── tag.ftl │ ├── form │ └── input.ftl │ └── layout │ ├── container.ftl │ ├── footer.ftl │ ├── hero.ftl │ └── section.ftl └── test └── java └── io └── linuxserver └── fleet ├── auth └── security │ └── PBKDF2PasswordEncoderTest.java ├── dockerhub └── util │ └── DockerTagFinderTest.java └── v2 └── thread └── schedule └── TimeWithUnitTest.java /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled class file 2 | *.class 3 | 4 | # Log file 5 | *.log 6 | 7 | # BlueJ files 8 | *.ctxt 9 | 10 | # Mobile Tools for Java (J2ME) 11 | .mtj.tmp/ 12 | 13 | # Package Files # 14 | *.jar 15 | *.war 16 | *.nar 17 | *.ear 18 | *.zip 19 | *.tar.gz 20 | *.rar 21 | 22 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 23 | hs_err_pid* 24 | 25 | .idea/ 26 | bin/ 27 | build/ 28 | out/ 29 | *.iml 30 | config/fleet.properties 31 | /config/fleet_static/* 32 | src/main/resources/assets/js/all*.js 33 | src/main/resources/assets/css/all*.css 34 | src/main/resources/log4j2.xml 35 | .gradle/ 36 | 37 | .classpath 38 | .project 39 | .settings/ 40 | .vscode/ 41 | 42 | **/.DS_Store 43 | -------------------------------------------------------------------------------- /config/example.fleet.properties: -------------------------------------------------------------------------------- 1 | # This is an example properties file for Fleet. 2 | # You should fill in your own values here and rename the file to "fleet.properties". 3 | 4 | # Runtime 5 | fleet.app.port=8080 6 | 7 | # Database Connectivity 8 | fleet.database.driver=org.mariadb.jdbc.Driver 9 | fleet.database.url=jdbc:mariadb://:3306/fleet 10 | fleet.database.username= 11 | fleet.database.password= 12 | 13 | # DockerHub auth 14 | fleet.dockerhub.auth.enabled=true 15 | fleet.dockerhub.username=YOUR_USERNAME 16 | fleet.dockerhub.password=YOUR_PASSWORD_OR_AUTH_TOKEN 17 | -------------------------------------------------------------------------------- /config/fleet_static/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxserver/fleet/f331c22cd833a2fc61a1769db2ec7593eb76342b/config/fleet_static/logo.png -------------------------------------------------------------------------------- /config/log4j2.local.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /config/log4j2.release.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /doc/actions.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxserver/fleet/f331c22cd833a2fc61a1769db2ec7593eb76342b/doc/actions.png -------------------------------------------------------------------------------- /doc/admin_image_list.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxserver/fleet/f331c22cd833a2fc61a1769db2ec7593eb76342b/doc/admin_image_list.png -------------------------------------------------------------------------------- /doc/repo_list.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxserver/fleet/f331c22cd833a2fc61a1769db2ec7593eb76342b/doc/repo_list.png -------------------------------------------------------------------------------- /doc/unstable.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxserver/fleet/f331c22cd833a2fc61a1769db2ec7593eb76342b/doc/unstable.png -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'fleet' -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/auth/AuthenticatedUser.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.auth; 19 | 20 | import io.linuxserver.fleet.v2.types.User; 21 | import io.linuxserver.fleet.v2.web.AppRole; 22 | 23 | import java.util.Collections; 24 | import java.util.Set; 25 | 26 | public class AuthenticatedUser { 27 | 28 | private final User user; 29 | 30 | public AuthenticatedUser(final User user) { 31 | this.user = user; 32 | } 33 | 34 | public final String getName() { 35 | return user.getUsername(); 36 | } 37 | 38 | public final Set getRoles() { 39 | return Collections.singleton(user.getRole()); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/auth/AuthenticationDelegate.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.auth; 19 | 20 | public interface AuthenticationDelegate { 21 | 22 | AuthenticationResult authenticate(String username, String password); 23 | 24 | String encodePassword(String rawPassword); 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/auth/AuthenticationResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.auth; 19 | 20 | public class AuthenticationResult { 21 | 22 | private final boolean authenticated; 23 | private final AuthenticatedUser user; 24 | 25 | public AuthenticationResult(boolean authenticated, AuthenticatedUser user) { 26 | 27 | this.authenticated = authenticated; 28 | this.user = user; 29 | } 30 | 31 | public static AuthenticationResult notAuthenticated() { 32 | return new AuthenticationResult(false, null); 33 | } 34 | 35 | public boolean isAuthenticated() { 36 | return authenticated; 37 | } 38 | 39 | public AuthenticatedUser getUser() { 40 | return user; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/auth/DefaultAuthenticationDelegate.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.auth; 19 | 20 | import io.linuxserver.fleet.auth.authenticator.UserAuthenticator; 21 | import io.linuxserver.fleet.auth.security.PasswordEncoder; 22 | 23 | public class DefaultAuthenticationDelegate implements AuthenticationDelegate { 24 | 25 | private final UserAuthenticator authenticator; 26 | 27 | public DefaultAuthenticationDelegate(final UserAuthenticator authenticator) { 28 | this.authenticator = authenticator; 29 | } 30 | 31 | @Override 32 | public AuthenticationResult authenticate(final String username, final String password) { 33 | return authenticator.authenticate(new UserCredentials(username, password)); 34 | } 35 | 36 | @Override 37 | public String encodePassword(final String rawPassword) { 38 | return authenticator.getPasswordEncoder().encode(rawPassword); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/auth/UserCredentials.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.auth; 19 | 20 | public class UserCredentials { 21 | 22 | private final String username; 23 | private final String password; 24 | 25 | public UserCredentials(String username, String password) { 26 | 27 | this.username = username; 28 | this.password = password; 29 | } 30 | 31 | public String getUsername() { 32 | return username; 33 | } 34 | 35 | public String getPassword() { 36 | return password; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/auth/authenticator/UserAuthenticator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.auth.authenticator; 19 | 20 | import io.linuxserver.fleet.auth.AuthenticationResult; 21 | import io.linuxserver.fleet.auth.UserCredentials; 22 | import io.linuxserver.fleet.auth.security.PasswordEncoder; 23 | 24 | /** 25 | *

26 | * Provides a mechanism for the application to authenticate a login request 27 | * from a user. 28 | *

29 | */ 30 | public interface UserAuthenticator { 31 | 32 | /** 33 | *

34 | * Performs an authentication check against the provided credentials and the repository 35 | * of currently stored users. 36 | *

37 | */ 38 | AuthenticationResult authenticate(UserCredentials userCredentials); 39 | 40 | PasswordEncoder getPasswordEncoder(); 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/auth/security/util/SaltGenerator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.auth.security.util; 19 | 20 | import java.security.SecureRandom; 21 | 22 | public class SaltGenerator { 23 | 24 | private static final int KEY_LENGTH = 16; 25 | 26 | public byte[] generateSalt() { 27 | 28 | SecureRandom sr = new SecureRandom(); 29 | 30 | byte[] salt = new byte[KEY_LENGTH]; 31 | sr.nextBytes(salt); 32 | 33 | return salt; 34 | } 35 | 36 | public int getKeyLength() { 37 | return KEY_LENGTH; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/core/BaseRuntimeLoader.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.core; 19 | 20 | import org.slf4j.Logger; 21 | import org.slf4j.LoggerFactory; 22 | 23 | /** 24 | *

25 | * Prints out all runtime arguments passed in as JVM arguments (-D). 26 | *

27 | * 28 | * @author Josh Stark 29 | */ 30 | abstract class BaseRuntimeLoader { 31 | 32 | private static final Logger LOGGER = LoggerFactory.getLogger(BaseRuntimeLoader.class); 33 | 34 | BaseRuntimeLoader() { 35 | 36 | LOGGER.info("Initalising..."); 37 | LOGGER.info("Config base : " + FleetRuntime.CONFIG_BASE); 38 | LOGGER.info("Show Passwords : " + FleetRuntime.SHOW_PASSWORDS); 39 | LOGGER.info("Nuke database : " + FleetRuntime.NUKE_DATABASE); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/core/FleetRuntime.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.core; 19 | 20 | public interface FleetRuntime { 21 | 22 | /** 23 | * If set will switch specific properties to allow more streamlined development 24 | */ 25 | boolean DEV_MODE = System.getProperty("enable.dev") != null; 26 | 27 | /** 28 | * Base directory for the config file. 29 | */ 30 | String CONFIG_BASE = System.getProperty("fleet.config.base"); 31 | 32 | /** 33 | * Whether or not logs should show passwords 34 | */ 35 | boolean SHOW_PASSWORDS = System.getProperty("fleet.show.passwords") != null; 36 | 37 | /** 38 | * Tells Fleet to completely wipe the database and recreate it. 39 | */ 40 | boolean NUKE_DATABASE = System.getProperty("fleet.nuke.database") != null; 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/core/Main.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.core; 19 | 20 | public class Main { 21 | 22 | public static void main(String[] args) { 23 | FleetAppController.instance().run(); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/core/ServiceProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.core; 19 | 20 | import io.linuxserver.fleet.v2.file.FileManager; 21 | import io.linuxserver.fleet.v2.service.ImageService; 22 | import io.linuxserver.fleet.v2.service.ScheduleService; 23 | import io.linuxserver.fleet.v2.service.SynchronisationService; 24 | import io.linuxserver.fleet.v2.service.UserService; 25 | 26 | public interface ServiceProvider { 27 | 28 | SynchronisationService getSynchronisationService(); 29 | 30 | ImageService getImageService(); 31 | 32 | ScheduleService getScheduleService(); 33 | 34 | UserService getUserService(); 35 | 36 | FileManager getFileManager(); 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/core/config/DatabaseConnectionProperties.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.core.config; 19 | 20 | public class DatabaseConnectionProperties { 21 | 22 | private final String driverClass; 23 | private final String url; 24 | private final String username; 25 | private final String password; 26 | 27 | public DatabaseConnectionProperties(final String driverClass, 28 | final String url, 29 | final String username, 30 | final String password) { 31 | this.driverClass = driverClass; 32 | this.url = url; 33 | this.username = username; 34 | this.password = password; 35 | } 36 | 37 | public final String getDatabaseDriverClass() { 38 | return driverClass; 39 | } 40 | 41 | public final String getDatabaseUrl() { 42 | return url; 43 | } 44 | 45 | public final String getDatabaseUsername() { 46 | return username; 47 | } 48 | 49 | public final String getDatabasePassword() { 50 | return password; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/core/config/WebConfiguration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 Wallett 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.core.config; 19 | 20 | public class WebConfiguration { 21 | 22 | private final AppProperties appProperties; 23 | 24 | public WebConfiguration(final AppProperties properties) { 25 | appProperties = properties; 26 | } 27 | 28 | public final int getPort() { 29 | return appProperties.getAppPort(); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/core/db/DatabaseConnection.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.core.db; 19 | 20 | import javax.sql.DataSource; 21 | import java.sql.Connection; 22 | import java.sql.SQLException; 23 | 24 | public interface DatabaseConnection { 25 | 26 | DataSource getDataSource(); 27 | 28 | Connection getConnection() throws SQLException; 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/core/db/DatabaseProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.core.db; 19 | 20 | import io.linuxserver.fleet.db.migration.DatabaseVersion; 21 | 22 | public interface DatabaseProvider { 23 | 24 | DatabaseConnection getDatabaseConnection(); 25 | 26 | DatabaseVersion getVersionHandler(); 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/core/db/DefaultDatabaseProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.core.db; 19 | 20 | import io.linuxserver.fleet.db.migration.DatabaseVersion; 21 | 22 | public class DefaultDatabaseProvider implements DatabaseProvider { 23 | 24 | private final DatabaseConnection databaseConnection; 25 | private final DatabaseVersion databaseVersion; 26 | 27 | public DefaultDatabaseProvider(final DatabaseConnection databaseConnection) { 28 | this.databaseConnection = databaseConnection; 29 | this.databaseVersion = new DatabaseVersion(databaseConnection); 30 | } 31 | 32 | @Override 33 | public DatabaseConnection getDatabaseConnection() { 34 | return databaseConnection; 35 | } 36 | 37 | @Override 38 | public DatabaseVersion getVersionHandler() { 39 | return databaseVersion; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/db/DefaultDatabaseConnection.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.db; 19 | 20 | import io.linuxserver.fleet.core.config.DatabaseConnectionProperties; 21 | 22 | public class DefaultDatabaseConnection extends PoolingDatabaseConnection { 23 | 24 | public DefaultDatabaseConnection(final DatabaseConnectionProperties properties) { 25 | super(properties); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/db/query/InsertUpdateResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.db.query; 19 | 20 | public class InsertUpdateResult { 21 | 22 | private final T result; 23 | private final int status; 24 | private final String statusMessage; 25 | 26 | public InsertUpdateResult(T result) { 27 | this(result, InsertUpdateStatus.OK, "OK"); 28 | } 29 | 30 | public InsertUpdateResult(T result, int status, String statusMessage) { 31 | 32 | this.result = result; 33 | this.status = status; 34 | this.statusMessage = statusMessage; 35 | } 36 | 37 | public InsertUpdateResult(int status, String statusMessage) { 38 | this(null, status, statusMessage); 39 | } 40 | 41 | public final T getResult() { 42 | return result; 43 | } 44 | 45 | public final int getStatus() { 46 | return status; 47 | } 48 | 49 | public final String getStatusMessage() { 50 | return statusMessage; 51 | } 52 | 53 | public final boolean isError() { 54 | return status != InsertUpdateStatus.OK; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/db/query/InsertUpdateStatus.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.db.query; 19 | 20 | public interface InsertUpdateStatus { 21 | 22 | int OK = 0; 23 | int FAILED = 1; 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/db/query/LimitOffset.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.db.query; 19 | 20 | public class LimitOffset { 21 | 22 | private final int limit; 23 | private final int offset; 24 | 25 | public LimitOffset(int limit, int offset) { 26 | 27 | this.limit = limit; 28 | this.offset = offset; 29 | } 30 | 31 | public int getLimit() { 32 | return limit; 33 | } 34 | 35 | public int getOffset() { 36 | return offset; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/db/query/LimitedResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.db.query; 19 | 20 | import java.util.List; 21 | 22 | public class LimitedResult { 23 | 24 | private final List results; 25 | private final LimitOffset next; 26 | private final int totalCount; 27 | 28 | public LimitedResult(List results, int totalCount) { 29 | this(results, totalCount,null); 30 | } 31 | 32 | public LimitedResult(List results, int totalCount, LimitOffset next) { 33 | 34 | this.results = results; 35 | this.totalCount = totalCount; 36 | this.next = next; 37 | } 38 | 39 | public List getResults() { 40 | return results; 41 | } 42 | 43 | public int getTotalCount() { 44 | return totalCount; 45 | } 46 | 47 | public LimitOffset getNext() { 48 | return next; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/dockerhub/DockerHubException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.dockerhub; 19 | 20 | public class DockerHubException extends RuntimeException { 21 | 22 | public DockerHubException(String message) { 23 | super(message); 24 | } 25 | 26 | public DockerHubException(String message, Throwable cause) { 27 | super(message, cause); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/dockerhub/model/DockerHubV2ImageListResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.dockerhub.model; 19 | 20 | public class DockerHubV2ImageListResult extends DockerHubV2ScanResult { 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/dockerhub/model/DockerHubV2NamespaceLookupResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.dockerhub.model; 19 | 20 | import com.fasterxml.jackson.annotation.JsonProperty; 21 | 22 | import java.util.ArrayList; 23 | import java.util.List; 24 | 25 | public class DockerHubV2NamespaceLookupResult { 26 | 27 | @JsonProperty("namespaces") 28 | private List namespaces = new ArrayList<>(); 29 | 30 | public List getNamespaces() { 31 | return namespaces; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/dockerhub/model/DockerHubV2ScanResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.dockerhub.model; 19 | 20 | import com.fasterxml.jackson.annotation.JsonProperty; 21 | 22 | import java.util.List; 23 | 24 | public class DockerHubV2ScanResult { 25 | 26 | @JsonProperty("count") 27 | private int count; 28 | 29 | @JsonProperty("next") 30 | private String next; 31 | 32 | @JsonProperty("previous") 33 | private String previous; 34 | 35 | @JsonProperty("results") 36 | private List results; 37 | 38 | public final int getCount() { 39 | return count; 40 | } 41 | 42 | public final String getNext() { 43 | return next; 44 | } 45 | 46 | public final String getPrevious() { 47 | return previous; 48 | } 49 | 50 | public final List getResults() { 51 | return results; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/dockerhub/model/DockerHubV2TagDigest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.dockerhub.model; 19 | 20 | import com.fasterxml.jackson.annotation.JsonProperty; 21 | 22 | public class DockerHubV2TagDigest { 23 | 24 | @JsonProperty("size") 25 | private long size; 26 | 27 | @JsonProperty("digest") 28 | private String digest; 29 | 30 | @JsonProperty("architecture") 31 | private String architecture; 32 | 33 | @JsonProperty("variant") 34 | private String variant; 35 | 36 | public long getSize() { 37 | return size; 38 | } 39 | 40 | public String getDigest() { 41 | return digest; 42 | } 43 | 44 | public String getArchitecture() { 45 | return architecture; 46 | } 47 | 48 | public String getVariant() { 49 | return variant; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/dockerhub/model/DockerHubV2TagListResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.dockerhub.model; 19 | 20 | public class DockerHubV2TagListResult extends DockerHubV2ScanResult { 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/exception/SaveException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.exception; 19 | 20 | public class SaveException extends Exception { 21 | 22 | public SaveException(String message) { 23 | super(message); 24 | } 25 | 26 | public SaveException(String message, Throwable cause) { 27 | super(message, cause); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/v2/LoggerOwner.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.v2; 19 | 20 | import org.slf4j.Logger; 21 | 22 | public interface LoggerOwner { 23 | 24 | Logger getLogger(); 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/v2/Utils.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.v2; 19 | 20 | public final class Utils { 21 | 22 | public static T ensureNotNull(final T obj) { 23 | 24 | if (null == obj) { 25 | throw new IllegalArgumentException("Parameter null"); 26 | } 27 | 28 | return obj; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/v2/cache/BasicItemCache.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.v2.cache; 19 | 20 | import io.linuxserver.fleet.v2.key.HasKey; 21 | import io.linuxserver.fleet.v2.key.Key; 22 | 23 | public final class BasicItemCache> extends AbstractItemCache { 24 | // Default implementation 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/v2/cache/ImageCache.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.v2.cache; 19 | 20 | import io.linuxserver.fleet.v2.key.ImageKey; 21 | import io.linuxserver.fleet.v2.types.Image; 22 | 23 | public class ImageCache extends AbstractItemCache { 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/v2/cache/ItemCache.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.v2.cache; 19 | 20 | import io.linuxserver.fleet.v2.key.HasKey; 21 | import io.linuxserver.fleet.v2.key.Key; 22 | 23 | import java.util.Collection; 24 | 25 | public interface ItemCache> { 26 | 27 | boolean isEmpty(); 28 | 29 | void addItem(ITEM item); 30 | 31 | ITEM findItem(KEY key); 32 | 33 | void removeItem(KEY key); 34 | 35 | boolean isItemCached(KEY key); 36 | 37 | Collection getAllItems(); 38 | 39 | void addAllItems(Collection items); 40 | 41 | int size(); 42 | 43 | interface ItemCacheListener { 44 | 45 | void onItemAdded(final ITEM item); 46 | void onItemUpdated(final ITEM oldItem, final ITEM newItem); 47 | void onItemRemoved(final ITEM item); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/v2/cache/RepositoryCache.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.v2.cache; 19 | 20 | import io.linuxserver.fleet.v2.key.ImageKey; 21 | import io.linuxserver.fleet.v2.key.ImageLookupKey; 22 | import io.linuxserver.fleet.v2.key.RepositoryKey; 23 | import io.linuxserver.fleet.v2.types.Image; 24 | import io.linuxserver.fleet.v2.types.Repository; 25 | 26 | public class RepositoryCache extends AbstractItemCache { 27 | 28 | public final Image lookupImage(final ImageLookupKey lookupKey) { 29 | 30 | for (Repository repository : getAllItems()) { 31 | for (Image image : repository.getImages()) { 32 | if (lookupKey.isLookupKeyFor(image)) { 33 | return image; 34 | } 35 | } 36 | } 37 | 38 | return null; 39 | } 40 | 41 | public final Image findImage(final ImageKey imageKey) { 42 | 43 | if (isItemCached(imageKey.getRepositoryKey())) { 44 | 45 | final Repository repository = findItem(imageKey.getRepositoryKey()); 46 | for (Image image : repository.getImages()) { 47 | 48 | if (imageKey.equals(image.getKey())) { 49 | return image; 50 | } 51 | } 52 | } 53 | 54 | return null; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/v2/cache/ScheduleCache.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.v2.cache; 19 | 20 | import io.linuxserver.fleet.v2.key.ScheduleKey; 21 | import io.linuxserver.fleet.v2.thread.schedule.AppSchedule; 22 | 23 | public class ScheduleCache extends AbstractItemCache { 24 | 25 | public final boolean isScheduleRunning(final ScheduleKey scheduleKey) { 26 | return isItemCached(scheduleKey); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/v2/client/docker/DockerApiClient.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.v2.client.docker; 19 | 20 | import io.linuxserver.fleet.v2.types.docker.DockerImage; 21 | import io.linuxserver.fleet.v2.types.docker.DockerTag; 22 | 23 | import java.util.List; 24 | 25 | public interface DockerApiClient { 26 | 27 | boolean isRepositoryValid(final String repositoryName); 28 | 29 | DockerImage fetchImage(final String imageName); 30 | 31 | List fetchAllImages(final String repositoryName); 32 | 33 | List fetchImageTags(final String imageName); 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/v2/client/docker/DockerImageNotFoundException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.v2.client.docker; 19 | 20 | public class DockerImageNotFoundException extends RuntimeException { 21 | 22 | public DockerImageNotFoundException(final String reason) { 23 | super(reason); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/v2/client/docker/converter/DockerResponseConverter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.v2.client.docker.converter; 19 | 20 | public interface DockerResponseConverter { 21 | 22 | INTERNAL_MODEL convert(final DOCKER_MODEL dockerModel); 23 | 24 | Class getConverterClass(); 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/v2/client/docker/dockerhub/DockerHubCredentials.java: -------------------------------------------------------------------------------- 1 | package io.linuxserver.fleet.v2.client.docker.dockerhub; 2 | 3 | import io.linuxserver.fleet.v2.Utils; 4 | 5 | public class DockerHubCredentials { 6 | 7 | private final String username; 8 | private final String password; 9 | 10 | public DockerHubCredentials(final String username, 11 | final String password) { 12 | this.username = Utils.ensureNotNull(username); 13 | this.password = Utils.ensureNotNull(password); 14 | } 15 | 16 | public final String getUsername() { 17 | return username; 18 | } 19 | 20 | public final String getPassword() { 21 | return password; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/v2/client/docker/dockerhub/DockerHubImageConverter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.v2.client.docker.dockerhub; 19 | 20 | import io.linuxserver.fleet.dockerhub.model.DockerHubV2Image; 21 | import io.linuxserver.fleet.v2.client.docker.converter.AbstractDockerResponseConverter; 22 | import io.linuxserver.fleet.v2.types.docker.DockerImage; 23 | 24 | public class DockerHubImageConverter extends AbstractDockerResponseConverter { 25 | 26 | @Override 27 | protected final DockerImage doPlainConvert(final DockerHubV2Image dockerApiImage) { 28 | 29 | return new DockerImage(dockerApiImage.getName(), 30 | dockerApiImage.getNamespace(), 31 | dockerApiImage.getDescription(), 32 | dockerApiImage.getStarCount(), 33 | dockerApiImage.getPullCount(), 34 | parseDockerHubDate(dockerApiImage.getLastUpdated())); 35 | } 36 | 37 | @Override 38 | public Class getConverterClass() { 39 | return DockerHubV2Image.class; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/v2/client/docker/dockerhub/IDockerHubAuthenticator.java: -------------------------------------------------------------------------------- 1 | package io.linuxserver.fleet.v2.client.docker.dockerhub; 2 | 3 | import java.util.Map; 4 | 5 | public interface IDockerHubAuthenticator { 6 | 7 | Map buildAuthHeaders(); 8 | 9 | String refreshToken(); 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/v2/client/docker/dockerhub/NoOpDockerHubAuthenticator.java: -------------------------------------------------------------------------------- 1 | package io.linuxserver.fleet.v2.client.docker.dockerhub; 2 | 3 | import java.util.HashMap; 4 | import java.util.Map; 5 | 6 | public class NoOpDockerHubAuthenticator implements IDockerHubAuthenticator { 7 | 8 | @Override 9 | public Map buildAuthHeaders() { 10 | return new HashMap<>(); 11 | } 12 | 13 | @Override 14 | public String refreshToken() { 15 | return null; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/v2/client/docker/github/GitHubContainerRegistryClient.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.v2.client.docker.github; 19 | 20 | import io.linuxserver.fleet.v2.client.docker.AbstractDockerApiClient; 21 | import io.linuxserver.fleet.v2.client.docker.github.model.GitHubImage; 22 | import io.linuxserver.fleet.v2.client.docker.github.model.GitHubTag; 23 | 24 | import java.util.List; 25 | 26 | public class GitHubContainerRegistryClient extends AbstractDockerApiClient { 27 | 28 | public GitHubContainerRegistryClient() { 29 | super(new GitHubImageConverter(), new GitHubTagConverter()); 30 | } 31 | 32 | @Override 33 | protected final GitHubImage fetchImageFromApi(String imageName) { 34 | return null; 35 | } 36 | 37 | @Override 38 | protected final List fetchAllImagesFromApi(String repositoryName) { 39 | return null; 40 | } 41 | 42 | @Override 43 | protected final List fetchTagsFromApi(String imageName) { 44 | return null; 45 | } 46 | 47 | @Override 48 | public final boolean isRepositoryValid(String repositoryName) { 49 | return false; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/v2/client/docker/github/GitHubImageConverter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.v2.client.docker.github; 19 | 20 | import io.linuxserver.fleet.v2.client.docker.converter.AbstractDockerResponseConverter; 21 | import io.linuxserver.fleet.v2.client.docker.github.model.GitHubImage; 22 | import io.linuxserver.fleet.v2.types.docker.DockerImage; 23 | 24 | public class GitHubImageConverter extends AbstractDockerResponseConverter { 25 | 26 | @Override 27 | protected final DockerImage doPlainConvert(final GitHubImage dockerApiImage) { 28 | return null; 29 | } 30 | 31 | @Override 32 | public final Class getConverterClass() { 33 | return GitHubImage.class; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/v2/client/docker/github/GitHubTagConverter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.v2.client.docker.github; 19 | 20 | import io.linuxserver.fleet.v2.client.docker.converter.AbstractDockerResponseConverter; 21 | import io.linuxserver.fleet.v2.client.docker.github.model.GitHubTag; 22 | import io.linuxserver.fleet.v2.types.docker.DockerTag; 23 | 24 | public class GitHubTagConverter extends AbstractDockerResponseConverter { 25 | 26 | @Override 27 | protected final DockerTag doPlainConvert(final GitHubTag dockerApiImage) { 28 | return null; 29 | } 30 | 31 | @Override 32 | public final Class getConverterClass() { 33 | return GitHubTag.class; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/v2/client/docker/github/model/GitHubImage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.v2.client.docker.github.model; 19 | 20 | public class GitHubImage { 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/v2/client/docker/github/model/GitHubTag.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.v2.client.docker.github.model; 19 | 20 | public class GitHubTag { 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/v2/client/docker/queue/AsyncDockerApiRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.v2.client.docker.queue; 19 | 20 | import io.linuxserver.fleet.v2.key.ImageKey; 21 | import io.linuxserver.fleet.v2.thread.AsyncTask; 22 | 23 | public interface AsyncDockerApiRequest extends AsyncTask { 24 | ImageKey getImageKey(); 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/v2/client/docker/queue/AsyncDockerApiResponse.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.v2.client.docker.queue; 19 | 20 | import io.linuxserver.fleet.v2.thread.AsyncTaskResponse; 21 | 22 | public interface AsyncDockerApiResponse extends AsyncTaskResponse { 23 | void handleDockerApiResponse(); 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/v2/client/docker/queue/DockerApiTaskConsumer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.v2.client.docker.queue; 19 | 20 | import io.linuxserver.fleet.v2.service.SynchronisationService; 21 | import io.linuxserver.fleet.v2.thread.AbstractTaskQueueConsumer; 22 | import io.linuxserver.fleet.v2.thread.TaskExecutionException; 23 | 24 | public final class DockerApiTaskConsumer extends AbstractTaskQueueConsumer { 25 | 26 | public DockerApiTaskConsumer(final SynchronisationService syncService) { 27 | 28 | super(syncService.getController(), 29 | syncService.getConfiguredDockerDelegate(), 30 | syncService.getSyncQueue(), 31 | "DockerSyncConsumer"); 32 | } 33 | 34 | @Override 35 | protected void handleTaskResponse(final DockerImageUpdateResponse response) { 36 | 37 | try { 38 | response.handleDockerApiResponse(); 39 | } catch (Exception e) { 40 | 41 | getLogger().error("handleTaskResponse caught unhandled error, but not something worthy of stalling thread", e); 42 | throw new TaskExecutionException(e); 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/v2/client/docker/queue/DockerImageMissingUpdateResponse.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.v2.client.docker.queue; 19 | 20 | import io.linuxserver.fleet.core.FleetAppController; 21 | import io.linuxserver.fleet.v2.key.ImageKey; 22 | 23 | public class DockerImageMissingUpdateResponse extends DockerImageUpdateResponse { 24 | 25 | public DockerImageMissingUpdateResponse(final FleetAppController controller, 26 | final ImageKey imageKey) { 27 | super(controller, imageKey, null); 28 | } 29 | 30 | @Override 31 | public final void handleDockerApiResponse() { 32 | // Do nothing. Let schedule handle this. 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/v2/client/docker/queue/DockerImageUpdateRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.v2.client.docker.queue; 19 | 20 | import io.linuxserver.fleet.v2.client.docker.DockerImageNotFoundException; 21 | import io.linuxserver.fleet.v2.key.ImageKey; 22 | import io.linuxserver.fleet.v2.thread.AbstractAppTask; 23 | 24 | public class DockerImageUpdateRequest extends AbstractAppTask { 25 | 26 | private final ImageKey imageKey; 27 | 28 | public DockerImageUpdateRequest(final ImageKey imageKey) { 29 | super(imageKey.toString()); 30 | this.imageKey = imageKey; 31 | } 32 | 33 | @Override 34 | protected DockerImageUpdateResponse performTaskInternal(final DockerApiDelegate delegate) { 35 | 36 | try { 37 | return new DockerImageUpdateResponse(delegate.getController(), imageKey, delegate.getCurrentImageView(imageKey)); 38 | } catch (DockerImageNotFoundException e) { 39 | getLogger().warn("Request responded with an empty response so assuming image {} has been removed upstream. Error message: {}", imageKey, e.getMessage()); 40 | return new DockerImageMissingUpdateResponse(delegate.getController(), imageKey); 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/v2/client/docker/queue/TaskQueue.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.v2.client.docker.queue; 19 | 20 | import io.linuxserver.fleet.v2.thread.AsyncTask; 21 | import org.slf4j.Logger; 22 | import org.slf4j.LoggerFactory; 23 | 24 | import java.util.concurrent.BlockingQueue; 25 | import java.util.concurrent.LinkedBlockingQueue; 26 | 27 | public class TaskQueue> { 28 | 29 | private static final Logger LOGGER = LoggerFactory.getLogger(TaskQueue.class); 30 | 31 | private final BlockingQueue activeTaskQueue; 32 | 33 | public TaskQueue() { 34 | activeTaskQueue = new LinkedBlockingQueue<>(); 35 | } 36 | 37 | public final boolean submitTask(final TASK task) { 38 | 39 | LOGGER.info("Task submitted: {}", task); 40 | if (activeTaskQueue.contains(task)) { 41 | 42 | LOGGER.warn("Task {} is already queued so will not duplicate the request.", task); 43 | return false; 44 | } 45 | 46 | return activeTaskQueue.add(task); 47 | } 48 | 49 | public final int size() { 50 | return activeTaskQueue.size(); 51 | } 52 | 53 | public final TASK retrieveNextTask() throws InterruptedException { 54 | return activeTaskQueue.take(); 55 | } 56 | 57 | public final boolean isEmpty() { 58 | return activeTaskQueue.isEmpty(); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/v2/client/rest/HttpException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.v2.client.rest; 19 | 20 | public class HttpException extends RuntimeException { 21 | 22 | public HttpException(String message) { 23 | super(message); 24 | } 25 | 26 | public HttpException(String message, Throwable cause) { 27 | super(message, cause); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/v2/client/rest/RestResponse.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.v2.client.rest; 19 | 20 | import io.linuxserver.fleet.v2.client.rest.proxy.PayloadProxy; 21 | 22 | public class RestResponse { 23 | 24 | private PayloadProxy payloadProxy; 25 | private int statusCode; 26 | 27 | RestResponse(int statusCode) { 28 | this(null, statusCode); 29 | } 30 | 31 | RestResponse(PayloadProxy payloadProxy, int statusCode) { 32 | 33 | this.payloadProxy = payloadProxy; 34 | this.statusCode = statusCode; 35 | } 36 | 37 | public T getPayload() { 38 | return payloadProxy.get(); 39 | } 40 | 41 | public int getStatusCode() { 42 | return statusCode; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/v2/client/rest/marshalling/JacksonMarshallingStrategy.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.v2.client.rest.marshalling; 19 | 20 | import com.fasterxml.jackson.core.JsonProcessingException; 21 | import com.fasterxml.jackson.databind.DeserializationFeature; 22 | import com.fasterxml.jackson.databind.ObjectMapper; 23 | 24 | import java.io.IOException; 25 | 26 | /** 27 | * Jackson JSON implementation of the marshalling strategy. This will convert incoming 28 | * and outgoing messages formatted in JSON. 29 | */ 30 | public class JacksonMarshallingStrategy implements MarshallingStrategy { 31 | 32 | private static final ObjectMapper OBJECT_MAPPER; 33 | static { 34 | 35 | OBJECT_MAPPER = new ObjectMapper(); 36 | OBJECT_MAPPER.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); 37 | } 38 | 39 | @Override 40 | public T unmarshall(String value, Class classType) throws IOException { 41 | return OBJECT_MAPPER.readValue(value, classType); 42 | } 43 | 44 | @Override 45 | public String marshall(Object value) throws JsonProcessingException { 46 | return OBJECT_MAPPER.writeValueAsString(value); 47 | } 48 | 49 | @Override 50 | public String getContentType() { 51 | return "application/json"; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/v2/client/rest/marshalling/MarshallingStrategy.java: -------------------------------------------------------------------------------- 1 | package io.linuxserver.fleet.v2.client.rest.marshalling; 2 | 3 | import java.io.IOException; 4 | 5 | public interface MarshallingStrategy { 6 | 7 | /** 8 | *

9 | * Converts a given string value into its representative object type. 10 | *

11 | * @param value 12 | * The value to convert to an object 13 | * @param classType 14 | * The object class definition 15 | * @return 16 | * The converted object 17 | */ 18 | T unmarshall(String value, Class classType) throws IOException; 19 | 20 | /** 21 | *

22 | * Converts an object into a single representative string value. 23 | *

24 | * @param value 25 | * The object to convert 26 | * @return 27 | * The result of the conversion 28 | */ 29 | String marshall(Object value) throws IOException; 30 | 31 | /** 32 | *

33 | * The content type of the payloads represented by this strategy. 34 | *

35 | */ 36 | String getContentType(); 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/v2/client/rest/proxy/LazyLoadPayloadProxy.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.v2.client.rest.proxy; 19 | 20 | import io.linuxserver.fleet.v2.client.rest.HttpException; 21 | import io.linuxserver.fleet.v2.client.rest.marshalling.MarshallingStrategy; 22 | 23 | import java.io.IOException; 24 | 25 | public class LazyLoadPayloadProxy implements PayloadProxy { 26 | 27 | private final MarshallingStrategy marshallingStrategy; 28 | private final String payload; 29 | private final Class payloadType; 30 | 31 | public LazyLoadPayloadProxy(MarshallingStrategy marshallingStrategy, String payload, Class payloadType) { 32 | 33 | this.marshallingStrategy = marshallingStrategy; 34 | this.payload = payload; 35 | this.payloadType = payloadType; 36 | } 37 | 38 | @Override 39 | public T get() { 40 | 41 | try { 42 | return marshallingStrategy.unmarshall(payload, payloadType); 43 | } catch (IOException e) { 44 | throw new HttpException("Unable to unmarshall response payload", e); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/v2/client/rest/proxy/PayloadProxy.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.v2.client.rest.proxy; 19 | 20 | public interface PayloadProxy { 21 | 22 | T get(); 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/v2/db/AbstractDAO.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.v2.db; 19 | 20 | import io.linuxserver.fleet.core.db.DatabaseProvider; 21 | import io.linuxserver.fleet.v2.LoggerOwner; 22 | import org.slf4j.Logger; 23 | import org.slf4j.LoggerFactory; 24 | 25 | import java.sql.Connection; 26 | import java.sql.SQLException; 27 | 28 | public class AbstractDAO implements LoggerOwner { 29 | 30 | private final Logger logger = LoggerFactory.getLogger(getClass()); 31 | 32 | private final DatabaseProvider databaseProvider; 33 | 34 | public AbstractDAO(final DatabaseProvider databaseProvider) { 35 | this.databaseProvider = databaseProvider; 36 | } 37 | 38 | protected final Connection getConnection() throws SQLException { 39 | return databaseProvider.getDatabaseConnection().getConnection(); 40 | } 41 | 42 | @Override 43 | public final Logger getLogger() { 44 | return logger; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/v2/db/DbUpdateStatus.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.v2.db; 19 | 20 | public enum DbUpdateStatus { 21 | 22 | Inserted, Updated, NoChange, Exists; 23 | 24 | public final boolean isExpected(final DbUpdateStatus expected) { 25 | return this == expected; 26 | } 27 | 28 | public final boolean isExists() { 29 | return this == Exists; 30 | } 31 | 32 | public final boolean isInserted() { 33 | return this == Inserted; 34 | } 35 | 36 | public final boolean isUpdated() { 37 | return this == Updated; 38 | } 39 | 40 | public final boolean isNoChange() { 41 | return this == NoChange; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/v2/db/ScheduleDAO.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.v2.db; 19 | 20 | import io.linuxserver.fleet.v2.thread.schedule.ScheduleSpec; 21 | 22 | import java.util.Set; 23 | 24 | public interface ScheduleDAO { 25 | 26 | Set fetchScheduleSpecs(); 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/v2/db/UserDAO.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.v2.db; 19 | 20 | import io.linuxserver.fleet.db.query.InsertUpdateResult; 21 | import io.linuxserver.fleet.v2.key.UserKey; 22 | import io.linuxserver.fleet.v2.types.User; 23 | import io.linuxserver.fleet.v2.types.internal.UserOutlineRequest; 24 | 25 | import java.util.List; 26 | 27 | public interface UserDAO { 28 | 29 | User fetchUser(UserKey userKey); 30 | 31 | User lookUpUser(String username); 32 | 33 | InsertUpdateResult createUser(UserOutlineRequest request); 34 | 35 | List fetchAllUsers(); 36 | 37 | InsertUpdateResult removeUser(User user); 38 | 39 | InsertUpdateResult updateUser(User updatedUser); 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/v2/key/AbstractDatabaseKey.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.v2.key; 19 | 20 | public abstract class AbstractDatabaseKey implements Key { 21 | 22 | private final Integer id; 23 | 24 | public AbstractDatabaseKey(final Integer id) { 25 | this.id = id; 26 | } 27 | 28 | @Override 29 | public final Integer getId() { 30 | return id; 31 | } 32 | 33 | @Override 34 | public boolean equals(Object o) { 35 | 36 | if (!(o instanceof Key)) { 37 | return false; 38 | } 39 | 40 | if (null == id) { 41 | return ((Key) o).getId() == null; 42 | } 43 | 44 | return ((Key) o).getId().equals(id); 45 | } 46 | 47 | @Override 48 | public int hashCode() { 49 | 50 | if (null == id) { 51 | return -1; 52 | } 53 | 54 | return id.hashCode(); 55 | } 56 | 57 | @Override 58 | public String toString() { 59 | return null == id ? "" : String.valueOf(id); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/v2/key/AbstractLookupKey.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.v2.key; 19 | 20 | public abstract class AbstractLookupKey> implements Key { 21 | 22 | private final String query; 23 | 24 | public AbstractLookupKey(final String query) { 25 | this.query = query; 26 | } 27 | 28 | public final String getQuery() { 29 | return query; 30 | } 31 | 32 | @Override 33 | public final Integer getId() { 34 | return null; 35 | } 36 | 37 | @Override 38 | public String toString() { 39 | return query; 40 | } 41 | 42 | public abstract boolean isLookupKeyFor(final TYPE type); 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/v2/key/AlertKey.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.v2.key; 19 | 20 | import io.linuxserver.fleet.v2.types.AppAlert; 21 | 22 | public class AlertKey extends AbstractLookupKey { 23 | 24 | public AlertKey(String query) { 25 | super(query); 26 | } 27 | 28 | @Override 29 | public boolean isLookupKeyFor(final AppAlert appAlert) { 30 | throw new RuntimeException("Operation not supported"); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/v2/key/HasKey.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.v2.key; 19 | 20 | public interface HasKey extends Comparable> { 21 | 22 | KEY getKey(); 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/v2/key/ImageLookupKey.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.v2.key; 19 | 20 | import io.linuxserver.fleet.v2.types.Image; 21 | 22 | public class ImageLookupKey extends AbstractLookupKey { 23 | 24 | private static final String KeyPattern = "^[^/]+/[^/]+$"; 25 | 26 | private final String lookupRepositoryName; 27 | private final String lookupImageName; 28 | 29 | public ImageLookupKey(final String query) { 30 | super(query); 31 | 32 | if (query.matches(KeyPattern)) { 33 | 34 | final String[] names = query.split("/"); 35 | lookupRepositoryName = names[0]; 36 | lookupImageName = names[1]; 37 | 38 | } else { 39 | throw new IllegalArgumentException("Malformed lookup query for ImageLookupKey"); 40 | } 41 | } 42 | 43 | @Override 44 | public final boolean isLookupKeyFor(final Image image) { 45 | 46 | if (null == image) { 47 | return false; 48 | } 49 | 50 | return image.getRepositoryName().equals(lookupRepositoryName) && image.getName().equals(lookupImageName); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/v2/key/Key.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.v2.key; 19 | 20 | import javax.naming.OperationNotSupportedException; 21 | 22 | public interface Key { 23 | 24 | Integer getId(); 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/v2/key/RepositoryKey.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.v2.key; 19 | 20 | public class RepositoryKey extends AbstractDatabaseKey { 21 | 22 | private static final String KeyPattern = "^\\d+:[^/]++$"; 23 | 24 | private final String name; 25 | 26 | public static RepositoryKey parse(final String keyAsString) { 27 | 28 | if (keyAsString.matches(KeyPattern)) { 29 | 30 | final String[] keyParts = keyAsString.split(":"); 31 | final int repositoryId = Integer.parseInt(keyParts[0]); 32 | final String repositoryName = keyParts[1]; 33 | 34 | return new RepositoryKey(repositoryId, repositoryName); 35 | 36 | } else { 37 | throw new IllegalArgumentException("Key pattern is malformed"); 38 | } 39 | } 40 | 41 | public RepositoryKey(final Integer id, final String name) { 42 | super(id); 43 | this.name = name; 44 | } 45 | 46 | public RepositoryKey cloneWithId(int id) { 47 | return new RepositoryKey(id, name); 48 | } 49 | 50 | public final String getName() { 51 | return name; 52 | } 53 | 54 | @Override 55 | public String toString() { 56 | return super.toString() + ":" + name; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/v2/key/ScheduleKey.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.v2.key; 19 | 20 | public class ScheduleKey extends AbstractDatabaseKey { 21 | 22 | public ScheduleKey(Integer id) { 23 | super(id); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/v2/key/TagBranchKey.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.v2.key; 19 | 20 | public class TagBranchKey extends AbstractDatabaseKey { 21 | 22 | private final ImageKey imageKey; 23 | 24 | public TagBranchKey(final Integer id, final ImageKey imageKey) { 25 | super(id); 26 | this.imageKey = imageKey; 27 | } 28 | 29 | public final ImageKey getImageKey() { 30 | return imageKey; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/v2/key/UserKey.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.v2.key; 19 | 20 | public class UserKey extends AbstractDatabaseKey { 21 | 22 | public UserKey() { 23 | this(null); 24 | } 25 | 26 | public UserKey(Integer id) { 27 | super(id); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/v2/service/AbstractAppService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.v2.service; 19 | 20 | import io.linuxserver.fleet.core.FleetAppController; 21 | import io.linuxserver.fleet.core.config.AppProperties; 22 | import io.linuxserver.fleet.v2.LoggerOwner; 23 | import org.slf4j.Logger; 24 | import org.slf4j.LoggerFactory; 25 | 26 | public class AbstractAppService implements LoggerOwner { 27 | 28 | private final Logger logger; 29 | private final FleetAppController controller; 30 | 31 | public AbstractAppService(FleetAppController controller) { 32 | this.controller = controller; 33 | this.logger = LoggerFactory.getLogger(getClass()); 34 | } 35 | 36 | public final FleetAppController getController() { 37 | return controller; 38 | } 39 | 40 | public final AppProperties getProperties() { 41 | return getController().getAppProperties(); 42 | } 43 | 44 | public final Logger getLogger() { 45 | return logger; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/v2/thread/AsyncTask.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.v2.thread; 19 | 20 | public interface AsyncTask { 21 | RESPONSE performTaskOn(DELEGATE delegate); 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/v2/thread/AsyncTaskDelegate.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.v2.thread; 19 | 20 | import io.linuxserver.fleet.core.FleetAppController; 21 | 22 | public interface AsyncTaskDelegate { 23 | 24 | FleetAppController getController(); 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/v2/thread/AsyncTaskResponse.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.v2.thread; 19 | 20 | public interface AsyncTaskResponse { 21 | void handleResponse(); 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/v2/thread/TaskExecutionException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.v2.thread; 19 | 20 | public class TaskExecutionException extends RuntimeException { 21 | 22 | public TaskExecutionException(final Exception cause) { 23 | super(cause); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/v2/thread/TaskResponseControllerProxy.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.v2.thread; 19 | 20 | import io.linuxserver.fleet.core.FleetAppController; 21 | 22 | public class TaskResponseControllerProxy implements AsyncTaskResponse { 23 | 24 | private final FleetAppController controller; 25 | private final R response; 26 | 27 | public TaskResponseControllerProxy(final FleetAppController controller, final R response) { 28 | this.controller = controller; 29 | this.response = response; 30 | } 31 | 32 | @Override 33 | public void handleResponse() { 34 | 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/v2/thread/ThreadStatus.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.v2.thread; 19 | 20 | public enum ThreadStatus { 21 | Stopped, Running; 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/v2/thread/schedule/AppSchedule.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.v2.thread.schedule; 19 | 20 | import io.linuxserver.fleet.v2.key.HasKey; 21 | import io.linuxserver.fleet.v2.key.ScheduleKey; 22 | 23 | import java.time.Duration; 24 | import java.time.LocalDateTime; 25 | 26 | public interface AppSchedule extends HasKey, Runnable { 27 | 28 | String getName(); 29 | 30 | LocalDateTime getLastRunTime(); 31 | 32 | LocalDateTime getNextRunTime(); 33 | 34 | Duration getLastRunDuration(); 35 | 36 | TimeWithUnit getDelay(); 37 | 38 | TimeWithUnit getInterval(); 39 | 40 | void executeSchedule(); 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/v2/thread/schedule/CheckAppVersionSchedule.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.v2.thread.schedule; 19 | 20 | import io.linuxserver.fleet.core.FleetAppController; 21 | 22 | public class CheckAppVersionSchedule extends AbstractAppSchedule { 23 | 24 | public CheckAppVersionSchedule(final ScheduleSpec spec, 25 | final FleetAppController controller) { 26 | super(spec, controller); 27 | } 28 | 29 | @Override 30 | public void executeSchedule() { 31 | getLogger().info("Currently not implemented. This is a placeholder schedule"); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/v2/thread/schedule/TidyHistoricDataSchedule.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.v2.thread.schedule; 19 | 20 | import io.linuxserver.fleet.core.FleetAppController; 21 | 22 | public class TidyHistoricDataSchedule extends AbstractAppSchedule { 23 | 24 | public TidyHistoricDataSchedule(final ScheduleSpec spec, 25 | final FleetAppController controller) { 26 | super(spec, controller); 27 | } 28 | 29 | @Override 30 | public void executeSchedule() { 31 | getLogger().info("Currently not implemented. This is a placeholder schedule"); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/v2/thread/schedule/cache/RefreshCacheSchedule.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.v2.thread.schedule.cache; 19 | 20 | import io.linuxserver.fleet.core.FleetAppController; 21 | import io.linuxserver.fleet.v2.thread.schedule.AbstractAppSchedule; 22 | import io.linuxserver.fleet.v2.thread.schedule.ScheduleSpec; 23 | 24 | public final class RefreshCacheSchedule extends AbstractAppSchedule { 25 | 26 | public RefreshCacheSchedule(final ScheduleSpec spec, 27 | final FleetAppController controller) { 28 | super(spec, controller); 29 | } 30 | 31 | @Override 32 | public void executeSchedule() { 33 | getController().getImageService().reloadCache(); 34 | } 35 | 36 | @Override 37 | protected boolean isAllowedToExecute() { 38 | return getController().getSynchronisationService().isSyncQueueEmpty(); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/v2/thread/schedule/sync/AllImagesSyncSchedule.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.v2.thread.schedule.sync; 19 | 20 | import io.linuxserver.fleet.core.FleetAppController; 21 | import io.linuxserver.fleet.v2.thread.schedule.AbstractAppSchedule; 22 | import io.linuxserver.fleet.v2.thread.schedule.ScheduleSpec; 23 | import io.linuxserver.fleet.v2.types.Repository; 24 | 25 | import java.util.List; 26 | 27 | public final class AllImagesSyncSchedule extends AbstractAppSchedule { 28 | 29 | public AllImagesSyncSchedule(final ScheduleSpec spec, 30 | final FleetAppController controller) { 31 | super(spec, controller); 32 | } 33 | 34 | @Override 35 | public void executeSchedule() { 36 | 37 | final List allRepositories = getController().getImageService().getAllRepositories(); 38 | for (Repository repository : allRepositories) { 39 | getController().getSynchronisationService().synchroniseCachedRepository(repository); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/v2/thread/schedule/sync/GetMissingImagesSchedule.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.v2.thread.schedule.sync; 19 | 20 | import io.linuxserver.fleet.core.FleetAppController; 21 | import io.linuxserver.fleet.v2.thread.schedule.AbstractAppSchedule; 22 | import io.linuxserver.fleet.v2.thread.schedule.ScheduleSpec; 23 | import io.linuxserver.fleet.v2.types.Repository; 24 | 25 | import java.util.List; 26 | 27 | public final class GetMissingImagesSchedule extends AbstractAppSchedule { 28 | 29 | public GetMissingImagesSchedule(final ScheduleSpec spec, 30 | final FleetAppController controller) { 31 | super(spec, controller); 32 | } 33 | 34 | @Override 35 | public void executeSchedule() { 36 | 37 | final List cachedRepositories = getController().getImageService().getAllRepositories(); 38 | for (Repository repository : cachedRepositories) { 39 | getController().getSynchronisationService().synchroniseUpstreamRepository(repository); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/v2/types/FilePathDetails.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.v2.types; 19 | 20 | public class FilePathDetails { 21 | 22 | private final String fileNameWithExtension; 23 | private final String fullAbsolutePath; 24 | private final String publicSafePath; 25 | 26 | public FilePathDetails(final String fileNameWithExtension, 27 | final String fullAbsolutePath, 28 | final String publicSafePath) { 29 | 30 | this.fileNameWithExtension = fileNameWithExtension; 31 | this.fullAbsolutePath = fullAbsolutePath; 32 | this.publicSafePath = publicSafePath; 33 | } 34 | 35 | public final String getFileNameWithExtension() { 36 | return fileNameWithExtension; 37 | } 38 | 39 | public final String getFullAbsolutePath() { 40 | return fullAbsolutePath; 41 | } 42 | 43 | public final String getPublicSafePathWithFileName() { 44 | return publicSafePath + "/" + getFileNameWithExtension(); 45 | } 46 | 47 | public final String getFullAbsolutePathWithFileName() { 48 | return getFullAbsolutePath() + "/" + getFileNameWithExtension(); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/v2/types/HasSyncSpec.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.v2.types; 19 | 20 | public interface HasSyncSpec { 21 | 22 | boolean isSyncEnabled(); 23 | 24 | boolean isStable(); 25 | 26 | boolean isDeprecated(); 27 | 28 | String getVersionMask(); 29 | 30 | boolean isHidden(); 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/v2/types/ImageCountData.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.v2.types; 19 | 20 | public class ImageCountData { 21 | 22 | private final long pullCount; 23 | private final int starCount; 24 | 25 | public ImageCountData(final long pullCount, final int starCount) { 26 | 27 | this.pullCount = pullCount; 28 | this.starCount = starCount; 29 | } 30 | 31 | public final long getPullCount() { 32 | return pullCount; 33 | } 34 | 35 | public final int getStarCount() { 36 | return starCount; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/v2/types/Tag.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.v2.types; 19 | 20 | import java.time.LocalDateTime; 21 | import java.util.*; 22 | 23 | public class Tag { 24 | 25 | public static final Tag DefaultUnknown = new Tag("Unknown", null, Collections.emptySet()); 26 | 27 | private final String version; 28 | private final Set digests; 29 | private final LocalDateTime buildDate; 30 | 31 | public Tag(final String version, final LocalDateTime buildDate, final Set digests) { 32 | 33 | this.version = version; 34 | this.digests = Collections.unmodifiableSet(digests); 35 | this.buildDate = (null == buildDate ? null : LocalDateTime.of(buildDate.toLocalDate(), buildDate.toLocalTime())); 36 | } 37 | 38 | public final List getDigests() { 39 | return new ArrayList<>(digests); 40 | } 41 | 42 | public String getVersion() { 43 | return version; 44 | } 45 | 46 | public LocalDateTime getBuildDate() { 47 | 48 | if (null != buildDate) { 49 | return LocalDateTime.of(buildDate.toLocalDate(), buildDate.toLocalTime()); 50 | } 51 | 52 | return null; 53 | } 54 | 55 | @Override 56 | public String toString() { 57 | return version; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/v2/types/api/AbstractApiWrapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.v2.types.api; 19 | 20 | public class AbstractApiWrapper { 21 | 22 | private final T originalObject; 23 | 24 | public AbstractApiWrapper(final T originalObject) { 25 | this.originalObject = originalObject; 26 | } 27 | 28 | protected final T getOriginalObject() { 29 | return originalObject; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/v2/types/api/ApiImageWrapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.v2.types.api; 19 | 20 | import io.linuxserver.fleet.v2.types.Image; 21 | 22 | public class ApiImageWrapper extends AbstractApiWrapper { 23 | 24 | public ApiImageWrapper(final Image originalObject) { 25 | super(originalObject); 26 | } 27 | 28 | public final String getName() { 29 | return getOriginalObject().getName(); 30 | } 31 | 32 | public final String getVersionMask() { 33 | return getOriginalObject().getVersionMask(); 34 | } 35 | 36 | public final boolean isSyncEnabled() { 37 | return getOriginalObject().isSyncEnabled(); 38 | } 39 | 40 | public final boolean isHidden() { 41 | return getOriginalObject().isHidden(); 42 | } 43 | 44 | public final boolean isDeprecated() { 45 | return getOriginalObject().isDeprecated(); 46 | } 47 | 48 | public final boolean isStable() { 49 | return getOriginalObject().isStable(); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/v2/types/api/ApiRepositoryWrapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.v2.types.api; 19 | 20 | import io.linuxserver.fleet.v2.types.Repository; 21 | 22 | public class ApiRepositoryWrapper extends AbstractApiWrapper { 23 | 24 | public ApiRepositoryWrapper(final Repository originalObject) { 25 | super(originalObject); 26 | } 27 | 28 | public final String getName() { 29 | return getOriginalObject().getName(); 30 | } 31 | 32 | public final String getVersionMask() { 33 | return getOriginalObject().getVersionMask(); 34 | } 35 | 36 | public final boolean isSyncEnabled() { 37 | return getOriginalObject().isSyncEnabled(); 38 | } 39 | 40 | public final int getNumberOfImages() { 41 | return getOriginalObject().getImages().size(); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/v2/types/api/ApiScheduleWrapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.v2.types.api; 19 | 20 | import io.linuxserver.fleet.v2.thread.schedule.AppSchedule; 21 | 22 | public class ApiScheduleWrapper extends AbstractApiWrapper { 23 | 24 | public ApiScheduleWrapper(final AppSchedule schedule) { 25 | super(schedule); 26 | } 27 | 28 | public final String getName() { 29 | return getOriginalObject().getName(); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/v2/types/api/external/ExternalApiResponse.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.v2.types.api.external; 19 | 20 | public class ExternalApiResponse { 21 | 22 | private ApiStatus status; 23 | private T data; 24 | 25 | public ExternalApiResponse(final ApiStatus status, final T data) { 26 | this.status = status; 27 | this.data = data; 28 | } 29 | 30 | public final ApiStatus getStatus() { 31 | return status; 32 | } 33 | 34 | public final T getData() { 35 | return data; 36 | } 37 | 38 | public enum ApiStatus { 39 | OK, Error 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/v2/types/api/external/templates/ApiDeviceTemplate.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | package io.linuxserver.fleet.v2.types.api.external.templates; 18 | 19 | public class ApiDeviceTemplate { 20 | 21 | private final String device; 22 | private final String description; 23 | 24 | public ApiDeviceTemplate(final String device, final String description) { 25 | this.device = device; 26 | this.description = description; 27 | } 28 | 29 | public String getDevice() { 30 | return device; 31 | } 32 | 33 | public String getDescription() { 34 | return description; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/v2/types/api/external/templates/ApiEnvTemplate.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | package io.linuxserver.fleet.v2.types.api.external.templates; 18 | 19 | public class ApiEnvTemplate { 20 | 21 | private final String name; 22 | private final String exampleValue; 23 | private final String description; 24 | 25 | public ApiEnvTemplate(final String name, final String exampleValue, final String description) { 26 | this.name = name; 27 | this.exampleValue = exampleValue; 28 | this.description = description; 29 | } 30 | 31 | public String getName() { 32 | return name; 33 | } 34 | 35 | public String getExampleValue() { 36 | return exampleValue; 37 | } 38 | 39 | public String getDescription() { 40 | return description; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/v2/types/api/external/templates/ApiPortTemplate.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | package io.linuxserver.fleet.v2.types.api.external.templates; 18 | 19 | public class ApiPortTemplate { 20 | 21 | private final int port; 22 | private final String protocol; 23 | private final String description; 24 | 25 | public ApiPortTemplate(final int port, final String protocol, final String description) { 26 | this.port = port; 27 | this.protocol = protocol; 28 | this.description = description; 29 | } 30 | 31 | public int getPort() { 32 | return port; 33 | } 34 | 35 | public String getProtocol() { 36 | return protocol; 37 | } 38 | 39 | public String getDescription() { 40 | return description; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/v2/types/api/external/templates/ApiVolumeTemplate.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | package io.linuxserver.fleet.v2.types.api.external.templates; 18 | 19 | public class ApiVolumeTemplate { 20 | 21 | private final String containerPath; 22 | private final boolean readonly; 23 | private final String description; 24 | 25 | public ApiVolumeTemplate(final String containerPath, final boolean readonly, final String description) { 26 | this.containerPath = containerPath; 27 | this.readonly = readonly; 28 | this.description = description; 29 | } 30 | 31 | public String getContainerPath() { 32 | return containerPath; 33 | } 34 | 35 | public boolean isReadonly() { 36 | return readonly; 37 | } 38 | 39 | public String getDescription() { 40 | return description; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/v2/types/docker/DockerCapability.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.v2.types.docker; 19 | 20 | public enum DockerCapability { 21 | 22 | AUDIT_CONTROL, 23 | AUDIT_WRITE, 24 | BLOCK_SUSPEND, 25 | CHOWN, 26 | DAC_OVERRIDE, 27 | DAC_READ_SEARCH, 28 | FOWNER, 29 | FSETID, 30 | IPC_LOCK, 31 | IPC_OWNER, 32 | KILL, 33 | LEASE, 34 | LINUX_IMMUTABLE, 35 | MAC_ADMIN, 36 | MAC_OVERRIDE, 37 | MKNOD, 38 | NET_ADMIN, 39 | NET_BIND_SERVICE, 40 | NET_BROADCAST, 41 | NET_RAW, 42 | SETFCAP, 43 | SETGID, 44 | SETPCAP, 45 | SETUID, 46 | SYSLOG, 47 | SYS_ADMIN, 48 | SYS_BOOT, 49 | SYS_CHROOT, 50 | SYS_MODULE, 51 | SYS_NICE, 52 | SYS_PACCT, 53 | SYS_PTRACE, 54 | SYS_RAWIO, 55 | SYS_RESOURCE, 56 | SYS_TIME, 57 | SYS_TTY_CONFIG, 58 | WAKE_ALARM; 59 | } 60 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/v2/types/docker/DockerTagManifestDigest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.v2.types.docker; 19 | 20 | public class DockerTagManifestDigest { 21 | 22 | private final long size; 23 | private final String digest; 24 | private final String architecture; 25 | private final String archVariant; 26 | 27 | public DockerTagManifestDigest(final long size, final String digest, final String architecture, final String archVariant) { 28 | 29 | this.size = size; 30 | this.digest = digest; 31 | this.architecture = architecture; 32 | this.archVariant = archVariant; 33 | } 34 | 35 | public final long getSize() { 36 | return size; 37 | } 38 | 39 | public final String getDigest() { 40 | return digest; 41 | } 42 | 43 | public final String getArchitecture() { 44 | return architecture; 45 | } 46 | 47 | public final String getArchVariant() { 48 | return archVariant; 49 | } 50 | 51 | @Override 52 | public final String toString() { 53 | return architecture + "/" + archVariant + "[" + digest + "]"; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/v2/types/internal/ImageGeneralInfoUpdateRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.v2.types.internal; 19 | 20 | import java.util.List; 21 | import java.util.Map; 22 | 23 | public class ImageGeneralInfoUpdateRequest extends AbstractParamRequest { 24 | 25 | private final ImageAppLogo imageAppLogo; 26 | 27 | public ImageGeneralInfoUpdateRequest(final Map> params, 28 | final ImageAppLogo imageAppLogo) { 29 | super(params); 30 | this.imageAppLogo = imageAppLogo; 31 | } 32 | 33 | public final ImageAppLogo getImageAppLogo() { 34 | return imageAppLogo; 35 | } 36 | 37 | public final String getBaseImage() { 38 | return getFirstOrNull("ImageBase"); 39 | } 40 | 41 | public final String getCategory() { 42 | return getFirstOrNull("ImageCategory"); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/v2/types/internal/ImageOutlineRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.v2.types.internal; 19 | 20 | import io.linuxserver.fleet.v2.key.RepositoryKey; 21 | 22 | import java.time.LocalDateTime; 23 | 24 | public class ImageOutlineRequest { 25 | 26 | private final RepositoryKey repositoryKey; 27 | private final String imageName; 28 | private final String imageDescription; 29 | private final LocalDateTime imageLastUpdated; 30 | 31 | public ImageOutlineRequest(final RepositoryKey repositoryKey, 32 | final String imageName, 33 | final String imageDescription, 34 | final LocalDateTime imageLastUpdated) { 35 | 36 | this.repositoryKey = repositoryKey; 37 | this.imageName = imageName; 38 | this.imageDescription = imageDescription; 39 | this.imageLastUpdated = imageLastUpdated; 40 | } 41 | 42 | public final RepositoryKey getRepositoryKey() { 43 | return repositoryKey; 44 | } 45 | 46 | public final String getImageName() { 47 | return imageName; 48 | } 49 | 50 | public final String getImageDescription() { 51 | return imageDescription; 52 | } 53 | 54 | public final LocalDateTime getImageLastUpdated() { 55 | return imageLastUpdated; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/v2/types/internal/RepositoryOutlineRequest.java: -------------------------------------------------------------------------------- 1 | /*io.linuxserver.fleet.v2.db 2 | * Copyright (c) 2019 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.v2.types.internal; 19 | 20 | public class RepositoryOutlineRequest { 21 | 22 | private final String repositoryName; 23 | 24 | public RepositoryOutlineRequest(final String repositoryName) { 25 | this.repositoryName = repositoryName; 26 | } 27 | 28 | public final String getRepositoryName() { 29 | return repositoryName; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/v2/types/internal/TagBranchOutlineRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.v2.types.internal; 19 | 20 | import io.linuxserver.fleet.v2.key.ImageKey; 21 | 22 | public class TagBranchOutlineRequest { 23 | 24 | private final ImageKey imageKey; 25 | private final String branchName; 26 | 27 | public TagBranchOutlineRequest(final ImageKey imageKey, final String branchName) { 28 | 29 | this.imageKey = imageKey; 30 | this.branchName = branchName; 31 | } 32 | 33 | public final ImageKey getImageKey() { 34 | return imageKey; 35 | } 36 | 37 | public final String getBranchName() { 38 | return branchName; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/v2/types/internal/UserOutlineRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.v2.types.internal; 19 | 20 | import io.linuxserver.fleet.v2.web.AppRole; 21 | 22 | public class UserOutlineRequest { 23 | 24 | public static final UserOutlineRequest InitialFirstLoadUser = new UserOutlineRequest("admin", "admin", AppRole.Admin); 25 | 26 | private final String username; 27 | private final String password; 28 | private final AppRole role; 29 | 30 | public UserOutlineRequest(final String username, final String password, final AppRole role) { 31 | 32 | this.username = username; 33 | this.password = password; 34 | this.role = role; 35 | } 36 | 37 | public final UserOutlineRequest cloneWithPassword(final String password) { 38 | return new UserOutlineRequest(getUsername(), password, getRole()); 39 | } 40 | 41 | public final String getUsername() { 42 | return username; 43 | } 44 | 45 | public final String getPassword() { 46 | return password; 47 | } 48 | 49 | public final AppRole getRole() { 50 | return role; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/v2/types/meta/ExternalUrlKey.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.v2.types.meta; 19 | 20 | import io.linuxserver.fleet.v2.Utils; 21 | import io.linuxserver.fleet.v2.key.AbstractDatabaseKey; 22 | import io.linuxserver.fleet.v2.key.Key; 23 | 24 | public class ExternalUrlKey extends AbstractDatabaseKey { 25 | 26 | public static final ExternalUrlKey NewNotPersistedYet = new ExternalUrlKey(-1); 27 | 28 | public ExternalUrlKey(final Integer id) { 29 | super(Utils.ensureNotNull(id)); 30 | } 31 | 32 | @Override 33 | public boolean equals(Object o) { 34 | 35 | final boolean keysMath = super.equals(o); 36 | 37 | final Key other = (Key) o; 38 | if (keysMath && areBothNonPersistedKeys(other)) { 39 | return false; 40 | } 41 | return keysMath; 42 | } 43 | 44 | private boolean areBothNonPersistedKeys(Key other) { 45 | return other.getId().equals(NewNotPersistedYet.getId()) && getId().equals(NewNotPersistedYet.getId()); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/v2/types/meta/history/ImagePullHistory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.v2.types.meta.history; 19 | 20 | import java.util.List; 21 | import java.util.Set; 22 | import java.util.TreeSet; 23 | import java.util.stream.Collectors; 24 | 25 | public class ImagePullHistory { 26 | 27 | private final Set historicalPulls; 28 | 29 | public ImagePullHistory() { 30 | historicalPulls = new TreeSet<>(); 31 | } 32 | 33 | public final boolean addStatistic(final ImagePullStatistic statistic) { 34 | return historicalPulls.add(statistic); 35 | } 36 | 37 | public final List getHistoryFor(final ImagePullStatistic.StatGroupMode groupMode) { 38 | return historicalPulls.stream().filter(s -> s.isGroupedBy(groupMode)).collect(Collectors.toList()); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/v2/types/meta/template/AbstractTemplateItem.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.v2.types.meta.template; 19 | 20 | public abstract class AbstractTemplateItem, ITEM extends AbstractTemplateItem> implements TemplateItem, Comparable { 21 | 22 | private final T name; 23 | private final String description; 24 | 25 | protected AbstractTemplateItem(final T name, final String description) { 26 | 27 | this.name = name; 28 | this.description = description; 29 | } 30 | 31 | @Override 32 | public final T getName() { 33 | return name; 34 | } 35 | 36 | @Override 37 | public final String getDescription() { 38 | return description; 39 | } 40 | 41 | @Override 42 | public int compareTo(final ITEM o) { 43 | return o.getName().compareTo(getName()); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/v2/types/meta/template/DeviceTemplateItem.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.v2.types.meta.template; 19 | 20 | public class DeviceTemplateItem extends AbstractTemplateItem { 21 | 22 | public DeviceTemplateItem(final String name, final String description) { 23 | super(name, description); 24 | } 25 | 26 | public final String getDevice() { 27 | return getName(); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/v2/types/meta/template/EnvironmentTemplateItem.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.v2.types.meta.template; 19 | 20 | public class EnvironmentTemplateItem extends AbstractTemplateItem { 21 | 22 | private final String exampleValue; 23 | 24 | public EnvironmentTemplateItem(final String name, final String description, final String exampleValue) { 25 | super(name, description); 26 | this.exampleValue = exampleValue; 27 | } 28 | 29 | public final String getEnv() { 30 | return getName(); 31 | } 32 | 33 | public final String getExampleValue() { 34 | return exampleValue; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/v2/types/meta/template/TemplateItem.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.v2.types.meta.template; 19 | 20 | public interface TemplateItem { 21 | 22 | T getName(); 23 | 24 | String getDescription(); 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/v2/types/meta/template/VolumeTemplateItem.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.v2.types.meta.template; 19 | 20 | public class VolumeTemplateItem extends AbstractTemplateItem { 21 | 22 | private final boolean readonly; 23 | 24 | public VolumeTemplateItem(final String volume, final String description, final boolean readonly) { 25 | super(volume, description); 26 | this.readonly = readonly; 27 | } 28 | 29 | public final String getVolume() { 30 | return getName(); 31 | } 32 | 33 | public final boolean isReadonly() { 34 | return readonly; 35 | } 36 | 37 | public enum Protocol { 38 | 39 | Tcp("tcp"), 40 | Udp("udp"); 41 | 42 | private final String protocolName; 43 | 44 | Protocol(final String protocolName) { 45 | this.protocolName = protocolName; 46 | } 47 | 48 | public static Protocol fromName(final String protocolName) { 49 | 50 | for (Protocol protocol : values()) { 51 | if (protocol.protocolName.equals(protocolName)) { 52 | return protocol; 53 | } 54 | } 55 | 56 | throw new IllegalArgumentException("Unknown protocol " + protocolName); 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/v2/web/ApiException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.v2.web; 19 | 20 | public class ApiException extends RuntimeException { 21 | 22 | public ApiException(final String message, final Throwable cause) { 23 | super(message, cause); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/v2/web/AppRole.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.v2.web; 19 | 20 | import io.javalin.core.security.Role; 21 | 22 | public enum AppRole implements Role { 23 | Anyone, Admin 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/v2/web/LocationUtils.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.v2.web; 19 | 20 | import java.util.stream.Stream; 21 | 22 | public class LocationUtils { 23 | 24 | public static boolean isUnAuthenticatedLocation(final String location) { 25 | return location.startsWith(Locations.Static.Assets); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/v2/web/Locations.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.v2.web; 19 | 20 | public interface Locations { 21 | 22 | interface Static { 23 | 24 | String Static = "/static"; 25 | String Assets = "/assets"; 26 | } 27 | 28 | // Error handling 29 | String UnhandledError = "/error"; 30 | String MethodNotAllowed = "/error"; 31 | 32 | // All pages 33 | String Home = "/"; 34 | String Login = "/login"; 35 | String Image = "/image"; 36 | 37 | interface Api { 38 | String Images = "/api/v1/images"; 39 | } 40 | 41 | interface Internal { 42 | String Api = "/internalapi"; 43 | String Repository = "repository"; 44 | String Image = "image"; 45 | String Schedule = "schedule"; 46 | String Sync = "sync"; 47 | String Stats = "stats"; 48 | String Track = "track"; 49 | String Template = "template"; 50 | } 51 | 52 | interface Admin { 53 | 54 | String Repositories = "/admin/repositories"; 55 | String Images = "/admin/images"; 56 | String ImageEdit = "/admin/image"; 57 | String Schedules = "/admin/schedules"; 58 | String Users = "/admin/users"; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/v2/web/PageModelAttributes.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.v2.web; 19 | 20 | public interface PageModelAttributes { 21 | 22 | String AuthenticatedUser = "__AuthenticatedUser"; 23 | 24 | String ContextAdapter = "__ContextAdapter"; 25 | 26 | String SystemAlerts = "__SystemAlerts"; 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/v2/web/PageModelSpec.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.v2.web; 19 | 20 | import java.util.HashMap; 21 | import java.util.Map; 22 | 23 | public class PageModelSpec { 24 | 25 | private final String viewName; 26 | private final Map model; 27 | 28 | public PageModelSpec(final String viewName) { 29 | 30 | this.viewName = viewName; 31 | this.model = new HashMap<>(); 32 | } 33 | 34 | public final String getViewName() { 35 | return viewName; 36 | } 37 | 38 | public final Map getModel() { 39 | return model; 40 | } 41 | 42 | public void addModelAttribute(final String key, final Object value) { 43 | model.put(key, value); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/v2/web/SessionAttributes.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.v2.web; 19 | 20 | public interface SessionAttributes { 21 | 22 | String AuthenticatedUser = "io.linuxserver.fleet.web.SessionAttributes.__AuthenticatedUser"; 23 | 24 | String ContextAdapter = "io.linuxserver.fleet.web.SessionAttributes.__ContextAdapter"; 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/v2/web/freemarker/CustomFreemarkerTemplate.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.v2.web.freemarker; 19 | 20 | import freemarker.template.TemplateMethodModelEx; 21 | 22 | public interface CustomFreemarkerTemplate extends TemplateMethodModelEx { 23 | 24 | String getName(); 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/v2/web/freemarker/Java8DateTimeMethod.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.v2.web.freemarker; 19 | 20 | import freemarker.ext.beans.StringModel; 21 | import freemarker.template.SimpleScalar; 22 | import freemarker.template.TemplateModelException; 23 | 24 | import java.time.format.DateTimeFormatter; 25 | import java.time.temporal.TemporalAccessor; 26 | import java.util.List; 27 | 28 | public class Java8DateTimeMethod implements CustomFreemarkerTemplate { 29 | 30 | @Override 31 | public String getName() { 32 | return "formatDate"; 33 | } 34 | 35 | @Override 36 | public Object exec(List arguments) throws TemplateModelException { 37 | 38 | if (arguments.size() != 2) { 39 | throw new TemplateModelException("Wrong arguments"); 40 | } 41 | 42 | final TemporalAccessor time = (TemporalAccessor) ((StringModel) arguments.get(0)).getWrappedObject(); 43 | final DateTimeFormatter formatter = DateTimeFormatter.ofPattern(((SimpleScalar) arguments.get(1)).getAsString()); 44 | 45 | return formatter.format(time); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/v2/web/request/json/NewRepositoryRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.v2.web.request.json; 19 | 20 | import com.fasterxml.jackson.annotation.JsonProperty; 21 | 22 | public class NewRepositoryRequest { 23 | 24 | @JsonProperty 25 | private String repositoryName; 26 | 27 | public final String getRepositoryName() { 28 | return repositoryName; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/v2/web/request/json/UpdateImageSpecRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.v2.web.request.json; 19 | 20 | import com.fasterxml.jackson.annotation.JsonProperty; 21 | 22 | public class UpdateImageSpecRequest { 23 | 24 | @JsonProperty 25 | private String imageKey; 26 | 27 | @JsonProperty 28 | private boolean syncEnabled; 29 | 30 | @JsonProperty 31 | private String versionMask; 32 | 33 | @JsonProperty 34 | private boolean stable; 35 | 36 | @JsonProperty 37 | private boolean hidden; 38 | 39 | @JsonProperty 40 | private boolean deprecated; 41 | 42 | public final String getImageKey() { 43 | return imageKey; 44 | } 45 | 46 | public final boolean isSyncEnabled() { 47 | return syncEnabled; 48 | } 49 | 50 | public final String getVersionMask() { 51 | return versionMask; 52 | } 53 | 54 | public final boolean isStable() { 55 | return stable; 56 | } 57 | 58 | public final boolean isHidden() { 59 | return hidden; 60 | } 61 | 62 | public boolean isDeprecated() { 63 | return deprecated; 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/v2/web/request/json/UpdateRepositoryRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.v2.web.request.json; 19 | 20 | import com.fasterxml.jackson.annotation.JsonProperty; 21 | 22 | public class UpdateRepositoryRequest { 23 | 24 | @JsonProperty 25 | private String repositoryKey; 26 | 27 | @JsonProperty 28 | private boolean syncEnabled; 29 | 30 | @JsonProperty 31 | private String versionMask; 32 | 33 | public final String getRepositoryKey() { 34 | return repositoryKey; 35 | } 36 | 37 | public final boolean isSyncEnabled() { 38 | return syncEnabled; 39 | } 40 | 41 | public final String getVersionMask() { 42 | return versionMask; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/io/linuxserver/fleet/v2/web/routes/AdminRepositoryController.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.v2.web.routes; 19 | 20 | import io.javalin.http.Context; 21 | import io.linuxserver.fleet.core.FleetAppController; 22 | import io.linuxserver.fleet.v2.service.ImageService; 23 | import io.linuxserver.fleet.v2.web.PageModelSpec; 24 | 25 | public class AdminRepositoryController extends AbstractPageHandler { 26 | 27 | private final ImageService imageService; 28 | 29 | public AdminRepositoryController(final FleetAppController controller) { 30 | super(controller); 31 | imageService = controller.getImageService(); 32 | } 33 | 34 | @Override 35 | protected PageModelSpec handlePageLoad(final Context ctx) { 36 | 37 | final PageModelSpec modelSpec = new PageModelSpec("views/pages/admin/repositories.ftl"); 38 | modelSpec.addModelAttribute("repositories", imageService.getAllRepositories()); 39 | return modelSpec; 40 | } 41 | 42 | @Override 43 | protected PageModelSpec handleFormSubmission(Context ctx) { 44 | return null; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/main/resources/db/migration/V1.0__CreateTables.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE Repositories ( 2 | `id` INT NOT NULL auto_increment PRIMARY KEY, 3 | `name` VARCHAR(255) NOT NULL, 4 | `version_mask` VARCHAR(255) DEFAULT NULL, 5 | `sync_enabled` TINYINT NOT NULL DEFAULT 0, 6 | `modified` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, 7 | UNIQUE KEY (`name`) 8 | ) ENGINE=InnoDB; 9 | 10 | CREATE TABLE Images ( 11 | `id` INT NOT NULL auto_increment PRIMARY KEY, 12 | `repository` INT NOT NULL, 13 | `name` VARCHAR(255) NOT NULL, 14 | `pulls` BIGINT DEFAULT NULL, 15 | `latest_version` VARCHAR(100) DEFAULT NULL, 16 | `version_mask` VARCHAR(255) DEFAULT NULL, 17 | `hidden` TINYINT NOT NULL DEFAULT 0, 18 | `unstable` TINYINT NOT NULL DEFAULT 0, 19 | `modified` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, 20 | UNIQUE KEY (`repository`, `name`), 21 | FOREIGN KEY (`repository`) REFERENCES Repositories(`id`) ON DELETE CASCADE 22 | ) ENGINE=InnoDB; -------------------------------------------------------------------------------- /src/main/resources/db/migration/V1.10__UpdateImageViewWithRepository.sql: -------------------------------------------------------------------------------- 1 | DELIMITER // 2 | 3 | CREATE OR REPLACE VIEW `Image_View` AS ( 4 | 5 | SELECT 6 | images.`id` AS `ImageId`, 7 | images.`repository` AS `RepositoryId`, 8 | repositories.`name` AS `RepositoryName`, 9 | images.`name` AS `ImageName`, 10 | images.`pulls` AS `ImagePullCount`, 11 | images.`latest_version` AS `LatestTagVersion`, 12 | images.`latest_version_raw` AS `LatestMaskedTagVersion`, 13 | images.`latest_version_buildtime` AS `LatestTagBuildDate`, 14 | images.`version_mask` AS `ImageVersionMask`, 15 | images.`hidden` AS `ImageHidden`, 16 | images.`unstable` AS `ImageUnstable`, 17 | images.`deprecated` AS `ImageDeprecated`, 18 | images.`deprecation_reason` AS `ImageDeprecationReason`, 19 | images.`modified` AS `ModifiedTime` 20 | FROM 21 | Images images 22 | JOIN Repositories repositories ON repositories.`id` = images.`repository` 23 | ); 24 | // -------------------------------------------------------------------------------- /src/main/resources/db/migration/V1.2__CreateUserTable.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE Users ( 2 | `id` INT NOT NULL auto_increment PRIMARY KEY, 3 | `username` VARCHAR(255) NOT NULL, 4 | `password` VARCHAR(255) DEFAULT NULL, 5 | `modified` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, 6 | UNIQUE KEY (`username`) 7 | ) ENGINE=InnoDB; -------------------------------------------------------------------------------- /src/main/resources/db/migration/V1.4__AddDeprecationFields.sql: -------------------------------------------------------------------------------- 1 | -- Specifically for deprecation 2 | ALTER TABLE Images 3 | ADD COLUMN `deprecated` TINYINT NOT NULL DEFAULT 0, 4 | ADD COLUMN `deprecation_reason` VARCHAR(255); -------------------------------------------------------------------------------- /src/main/resources/db/migration/V2.1__MigrateToNewTables.sql: -------------------------------------------------------------------------------- 1 | INSERT INTO 2 | Repository (`id`, `name`, `sync_enabled`, `version_mask`, `hidden`, `stable`, `deprecated`, `modified`) 3 | SELECT 4 | `id`, `name`, `sync_enabled`, `version_mask`, 0, 1, 0, `modified` 5 | FROM 6 | Repositories; 7 | 8 | INSERT INTO 9 | Image (`id`, `repository`, `name`, `description`, `pulls`, `stars`, `sync_enabled`, `version_mask`, `hidden`, `stable`, `deprecated`, `modified`) 10 | SELECT 11 | `id`, `repository`, `name`, null, `pulls`, 0, 1, `version_mask`, `hidden`, NOT(`unstable`), `deprecated`, `modified` 12 | FROM 13 | Images; 14 | 15 | INSERT INTO 16 | TagBranch (`image_id`, `name`, `latest_version`, `protected`, `build_date`) 17 | SELECT 18 | `id`, 'latest', `latest_version`, 1, `latest_version_buildtime` 19 | FROM Images; 20 | 21 | INSERT INTO 22 | Schedule (`name`, `interval`, `delay`, `java_class`) 23 | VALUES 24 | ('SyncAllCachedImages', '1:hours', '0:minutes', 'io.linuxserver.fleet.v2.thread.schedule.sync.AllImagesSyncSchedule'), 25 | ('GetMissingImages', '30:minutes', '0:minutes', 'io.linuxserver.fleet.v2.thread.schedule.sync.GetMissingImagesSchedule'), 26 | ('RefreshCache', '1:days', '15:minutes', 'io.linuxserver.fleet.v2.thread.schedule.cache.RefreshCacheSchedule'), 27 | ('TidyHistoricData', '1:days', '0:minutes', 'io.linuxserver.fleet.v2.thread.schedule.TidyHistoricDataSchedule'), 28 | ('CheckAppVersion', '1:days', '0:minutes', 'io.linuxserver.fleet.v2.thread.schedule.CheckAppVersionSchedule'); 29 | -------------------------------------------------------------------------------- /src/main/resources/db/migration/V2.6__AddCleanSchedule.sql: -------------------------------------------------------------------------------- 1 | INSERT INTO 2 | Schedule (`name`, `interval`, `delay`, `java_class`) 3 | VALUE 4 | ('CleanRemovedImages', '1:hours', '0:minutes', 'io.linuxserver.fleet.v2.thread.schedule.sync.CleanRemovedImagesSchedule'); 5 | -------------------------------------------------------------------------------- /src/main/resources/db/migration/V2.8__FixStoreCoreMetaOutputBug.sql: -------------------------------------------------------------------------------- 1 | DELIMITER // 2 | 3 | CREATE OR REPLACE PROCEDURE Image_StoreCoreMetaData 4 | ( 5 | in_id INT, 6 | in_category VARCHAR(255), 7 | in_base_image VARCHAR(255), 8 | in_icon_url VARCHAR(1000), 9 | 10 | OUT out_status ENUM('Inserted', 'Updated', 'NoChange') 11 | ) 12 | BEGIN 13 | 14 | -- Only add core metadata if it has been provided with at least one value 15 | IF 16 | ( 17 | in_category IS NOT NULL OR 18 | in_base_image IS NOT NULL OR 19 | in_icon_url IS NOT NULL 20 | ) 21 | THEN 22 | 23 | IF NOT EXISTS(SELECT 1 FROM ImageMetadata WHERE `image_id` = in_id) THEN 24 | 25 | INSERT INTO ImageMetadata 26 | ( 27 | `image_id`, 28 | `category`, 29 | `base_image`, 30 | `icon_url` 31 | ) 32 | VALUES 33 | ( 34 | in_id, 35 | in_category, 36 | in_base_image, 37 | in_icon_url 38 | ); 39 | 40 | SET out_status = 'Inserted'; 41 | 42 | ELSE 43 | 44 | UPDATE ImageMetadata 45 | SET 46 | `category` = in_category, 47 | `base_image` = in_base_image, 48 | `icon_url` = in_icon_url 49 | WHERE 50 | `image_id` = in_id; 51 | 52 | IF ROW_COUNT() = 0 THEN 53 | SET out_status = 'NoChange'; 54 | ELSE 55 | SET out_status = 'Updated'; 56 | END IF; 57 | 58 | END IF; 59 | 60 | ELSE 61 | SET out_status = 'NoChange'; 62 | END IF; 63 | 64 | END; 65 | // 66 | -------------------------------------------------------------------------------- /src/main/resources/static/assets/images/favicon-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxserver/fleet/f331c22cd833a2fc61a1769db2ec7593eb76342b/src/main/resources/static/assets/images/favicon-32x32.png -------------------------------------------------------------------------------- /src/main/resources/static/assets/images/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxserver/fleet/f331c22cd833a2fc61a1769db2ec7593eb76342b/src/main/resources/static/assets/images/favicon.ico -------------------------------------------------------------------------------- /src/main/resources/static/assets/images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxserver/fleet/f331c22cd833a2fc61a1769db2ec7593eb76342b/src/main/resources/static/assets/images/logo.png -------------------------------------------------------------------------------- /src/main/resources/static/assets/webfonts/fa-brands-400.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxserver/fleet/f331c22cd833a2fc61a1769db2ec7593eb76342b/src/main/resources/static/assets/webfonts/fa-brands-400.eot -------------------------------------------------------------------------------- /src/main/resources/static/assets/webfonts/fa-brands-400.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxserver/fleet/f331c22cd833a2fc61a1769db2ec7593eb76342b/src/main/resources/static/assets/webfonts/fa-brands-400.ttf -------------------------------------------------------------------------------- /src/main/resources/static/assets/webfonts/fa-brands-400.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxserver/fleet/f331c22cd833a2fc61a1769db2ec7593eb76342b/src/main/resources/static/assets/webfonts/fa-brands-400.woff -------------------------------------------------------------------------------- /src/main/resources/static/assets/webfonts/fa-brands-400.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxserver/fleet/f331c22cd833a2fc61a1769db2ec7593eb76342b/src/main/resources/static/assets/webfonts/fa-brands-400.woff2 -------------------------------------------------------------------------------- /src/main/resources/static/assets/webfonts/fa-solid-900.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxserver/fleet/f331c22cd833a2fc61a1769db2ec7593eb76342b/src/main/resources/static/assets/webfonts/fa-solid-900.eot -------------------------------------------------------------------------------- /src/main/resources/static/assets/webfonts/fa-solid-900.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxserver/fleet/f331c22cd833a2fc61a1769db2ec7593eb76342b/src/main/resources/static/assets/webfonts/fa-solid-900.ttf -------------------------------------------------------------------------------- /src/main/resources/static/assets/webfonts/fa-solid-900.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxserver/fleet/f331c22cd833a2fc61a1769db2ec7593eb76342b/src/main/resources/static/assets/webfonts/fa-solid-900.woff -------------------------------------------------------------------------------- /src/main/resources/static/assets/webfonts/fa-solid-900.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/linuxserver/fleet/f331c22cd833a2fc61a1769db2ec7593eb76342b/src/main/resources/static/assets/webfonts/fa-solid-900.woff2 -------------------------------------------------------------------------------- /src/main/resources/version.properties: -------------------------------------------------------------------------------- 1 | #Sun Oct 30 08:13:05 GMT 2022 2 | app.build.date=2022-10-30T08\:13\:05 3 | app.build.os=Mac OS X 4 | app.build.user=josh 5 | app.version=2.3.3 6 | -------------------------------------------------------------------------------- /src/main/resources/views/pages/error.ftl: -------------------------------------------------------------------------------- 1 | <#-- 2 | Copyright (c) 2019 LinuxServer.io 3 | 4 | This program is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | --> 17 | 18 | ${error} ${exception} -------------------------------------------------------------------------------- /src/main/resources/views/prebuilt/fleet-title.ftl: -------------------------------------------------------------------------------- 1 | <#-- 2 | Copyright (c) 2019 LinuxServer.io 3 | 4 | This program is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | --> 17 | <#macro title thinValue="" boldValue="" separator="" icon="" imageIcon="" subtitle=""> 18 | 19 |

20 | <#if imageIcon?has_content> 21 |
22 | Title logo 23 |
24 | <#elseif icon?has_content> 25 | 26 | 27 | <#if thinValue?has_content>${thinValue}${separator}${boldValue}. 28 | <#nested /> 29 |

30 | <#if subtitle?has_content> 31 |

32 | ${subtitle} 33 |

34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /src/main/resources/views/prebuilt/system-alert.ftl: -------------------------------------------------------------------------------- 1 | <#-- 2 | Copyright (c) 2019 LinuxServer.io 3 | 4 | This program is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | --> 17 | 18 | <#import "../ui/components/message.ftl" as message /> 19 | <#import "../prebuilt/fleet-title.ftl" as fleetTitle /> 20 | 21 | <#macro alert specificAlert> 22 | 23 | <@message.message colour="danger"> 24 | <@fleetTitle.title boldValue=specificAlert.subject /> 25 | ${specificAlert.alertMessage!""} 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /src/main/resources/views/ui/components/dropdown.ftl: -------------------------------------------------------------------------------- 1 | 2 | <#macro dropdown triggerText id title="" size="normal" isDisabled=false extraClasses="" extraAttributes=""> 3 | 4 | 19 | 20 | 21 | 22 | <#macro item id="" link="" modal="" isActive=false extraClasses="" extraAttributes=""> 23 | id="${id}" class="dropdown-item<#if isActive> is-active<#if modal?has_content> is-modal-trigger<#if extraClasses?has_content> ${extraClasses}"<#if extraAttributes?has_content> ${extraAttributes}<#if modal?has_content> data-modal="${modal}"<#if link?has_content> href="${link}"> 24 | <#nested /> 25 | 26 | -------------------------------------------------------------------------------- /src/main/resources/views/ui/components/message.ftl: -------------------------------------------------------------------------------- 1 | <#-- 2 | Reference: https://bulma.io/documentation/components/message/ 3 | 4 | Colored message blocks, to emphasize part of your page 5 | 6 | title:String - An optional heading for the message. This affects the style slightly if provided. 7 | colour:enum(light, dark, danger, warning, info, success) - The colour scheme of the element. 8 | extraClasses:String - Any other classes the element should have. 9 | extraAttributes:String - Any other attributes (e.g. data-*) the element should have. 10 | --> 11 | <#macro message title="" colour="" extraClasses="" extraAttributes=""> 12 | 13 |
${extraAttributes}> 14 | <#if title?has_content> 15 |
16 | ${title} 17 |
18 | 19 |
20 | <#nested /> 21 |
22 |
23 | 24 | -------------------------------------------------------------------------------- /src/main/resources/views/ui/components/modal.ftl: -------------------------------------------------------------------------------- 1 | <#-- 2 | Reference: https://bulma.io/documentation/components/modal/ 3 | 4 | A classic modal overlay, in which you can include any content you want 5 | 6 | id:String - An identifier for this element 7 | title:String - An optional title for the modal 8 | isDismissable:boolean - Whether this element can be closed by the user 9 | isWide:boolean - Sets the modal to take up a larger proportion of the screen. Default: true 10 | extraClasses:String - Any other classes the element should have. 11 | extraAttributes:String - Any other attributes (e.g. data-*) the element should have. 12 | --> 13 | <#import "../elements/box.ftl" as box /> 14 | 15 | <#macro modal id title="" isDismissable=true isWide=true extraClasses="" extraAttributes=""> 16 | 17 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /src/main/resources/views/ui/components/pagination.ftl: -------------------------------------------------------------------------------- 1 | <#-- 2 | Reference: https://bulma.io/documentation/components/pagination/ 3 | 4 | A responsive, usable, and flexible pagination 5 | 6 | isRight:boolean - If set to true, the list will be on the right 7 | currentPage:int - The current page to be highlighted 8 | allPages:list(int) - A list of all pages to render. A NULL value will be rendered as an ellipsis. 9 | additionalQueryParameters:String - Any additional params to be appended to the end of each link. 10 | --> 11 | <#macro pagination isRight=true currentPage=1 allPages=[] additionalQueryParameters=""> 12 | 13 | 26 | 27 | -------------------------------------------------------------------------------- /src/main/resources/views/ui/elements/box.ftl: -------------------------------------------------------------------------------- 1 | <#-- 2 | Resource: https://bulma.io/documentation/elements/box/ 3 | 4 | Constructs a visible container for content on a page. 5 | 6 | id:String - The unique identifier for this element 7 | extraClasses:String - Any additional classes that this element should have 8 | extraAttributes:String - Any additional attributes that this element should have (e.g. disabled, data-*) 9 | --> 10 | <#macro box id="" extraClasses="" extraAttributes=""> 11 | 12 |
id="${id}" class="box<#if extraClasses?has_content> ${extraClasses}"<#if extraAttributes?has_content> ${extraAttributes}> 13 |
14 |
15 |
16 | <#nested /> 17 |
18 |
19 |
20 |
21 | 22 | -------------------------------------------------------------------------------- /src/main/resources/views/ui/elements/display-field.ftl: -------------------------------------------------------------------------------- 1 | <#import "../../templates/helpers/type-safe.ftl" as typeSafe /> 2 | 3 | <#macro displayField value label="" size="normal" isInline=false extraClasses="" extraAttributes=""> 4 | 5 |
${extraAttributes}> 6 | <#if label?has_content> 7 | 10 | 11 |
12 | 13 | <@typeSafe.render value=value /> 14 | 15 |
16 |
17 | 18 | -------------------------------------------------------------------------------- /src/main/resources/views/ui/elements/media.ftl: -------------------------------------------------------------------------------- 1 | <#-- 2 | Resource: https://bulma.io/documentation/elements/box/ 3 | 4 | Constructs a visible container for content on a page. 5 | 6 | id:String - The unique identifier for this element 7 | extraClasses:String - Any additional classes that this element should have 8 | extraAttributes:String - Any additional attributes that this element should have (e.g. disabled, data-*) 9 | --> 10 | <#macro media id="" extraClasses="" extraAttributes=""> 11 | 12 | id="${id}" class="media<#if extraClasses?has_content> ${extraClasses}"<#if extraAttributes?has_content> ${extraAttributes}> 13 |
14 |
15 | <#nested /> 16 |
17 |
18 | 19 | 20 | -------------------------------------------------------------------------------- /src/main/resources/views/ui/elements/notification.ftl: -------------------------------------------------------------------------------- 1 | <#-- 2 | Reference: https://bulma.io/documentation/elements/notification/ 3 | 4 | Bold notification blocks, to alert your users of something 5 | 6 | id:String - The unique identifier for this element 7 | isError:boolean - Colours the notification with an error-like colour 8 | isWarning:boolean - Colours the notification with a warning-like colour 9 | isSuccess:boolean - Colours the notification with a success-like colour 10 | isInfo:boolean - Colours the notification with an info-like colour 11 | isDismissable:boolean - Whether or not the notification may be removed via an "x" button. Default: true 12 | 13 | Note on colour flags: The notification will always take the colour of the highest priority level. Therefore if isWarning=true and isInfo=true, 14 | the resulting colour will be for isWarning as it has a higher priority. 15 | --> 16 | <#macro notification id="" isError=false isWarning=false isSuccess=false isInfo=true isDismissable=true> 17 | 18 | id="${id}" class="notification is-<#if isError>danger<#elseif isWarning>warning<#elseif isSuccess>success<#elseif isInfo>info<#else>primary"> 19 | <#if isDismissable> 20 | <#nested /> 21 | 22 | 23 | -------------------------------------------------------------------------------- /src/main/resources/views/ui/elements/tag.ftl: -------------------------------------------------------------------------------- 1 | <#-- 2 | Reference: https://bulma.io/documentation/elements/tag/ 3 | 4 | Small tag labels to insert anywhere 5 | 6 | value:String - The primary text to display in the tag 7 | colour:enum(primary, warning, info etc) - The colour of the main text background 8 | size:enum(small, normal, large) - The size of the tag 9 | isRounded:boolean - If true, rounds the edges. Only applied if isGrouped=false 10 | isGrouped:boolean - If true, generates a title for the tag 11 | groupTitle:String - A title for the tag, separate to the main text 12 | extraClasses:String - Any other classes the input should have. These are applied directly to the input 13 | extraAttributes:String - Any other attributes (e.g. data-*) the input should have. Applied directly to the input. 14 | --> 15 | <#macro tag value colour="primary" size="normal" isRounded=false isGrouped=false groupTitle="" extraClasses="" extraAttributes=""> 16 | 17 | <#if isGrouped> 18 |
19 | ${groupTitle} 20 | 21 | 22 | ${extraAttributes}> 23 | ${value} 24 | 25 | 26 | <#if isGrouped> 27 |
28 | 29 | 30 | -------------------------------------------------------------------------------- /src/main/resources/views/ui/layout/container.ftl: -------------------------------------------------------------------------------- 1 | <#-- 2 | Resource: https://bulma.io/documentation/layout/container/ 3 | 4 | A simple container to center your content horizontally 5 | 6 | id:String - The unique identifier for this element 7 | extraClasses:String - Any additional classes that this element should have 8 | isFluid:boolean - Defines whether or not the container becomes "full width". Default: false 9 | --> 10 | <#macro container id="" extraClasses="" isFluid=false> 11 | 12 |
id="${id}" class="container<#if isFluid> is-fluid<#if extraClasses?has_content> ${extraClasses}"> 13 | <#nested /> 14 |
15 | 16 | -------------------------------------------------------------------------------- /src/main/resources/views/ui/layout/footer.ftl: -------------------------------------------------------------------------------- 1 | <#-- 2 | Reference: https://bulma.io/documentation/layout/footer/ 3 | 4 | A simple responsive footer which can include anything: lists, headings, columns, icons, buttons, etc. 5 | 6 | serviceInfo:AtassServiceInfo - An optional param which will be used to display the service name and other build info 7 | --> 8 | <#macro footer serviceInfo=""> 9 | 10 |
11 |
12 | <#if serviceInfo?has_content> 13 | ${serviceInfo.serviceFullName} 14 |

15 | ${serviceInfo.version} 16 |

17 | 18 |
19 |
20 | 21 | -------------------------------------------------------------------------------- /src/main/resources/views/ui/layout/hero.ftl: -------------------------------------------------------------------------------- 1 | <#-- 2 | Resource: https://bulma.io/documentation/layout/hero/ 3 | 4 | An imposing hero banner to showcase something 5 | 6 | id:String - The unique identifier for this element 7 | isFullHeight:boolean - Ensures the hero fills the entire screen 8 | extraClasses:String - Any additional classes that this element should have 9 | --> 10 | <#macro hero id="" isFullHeight=false extraClasses=""> 11 | 12 |
id="${id}" class="hero<#if isFullHeight> is-fullheight<#if extraClasses?has_content> ${extraClasses}"> 13 |
14 | <#nested /> 15 |
16 |
17 | 18 | -------------------------------------------------------------------------------- /src/main/resources/views/ui/layout/section.ftl: -------------------------------------------------------------------------------- 1 | <#-- 2 | Resource: https://bulma.io/documentation/layout/ection/ 3 | 4 | A simple container to divide your page into sections 5 | 6 | id:String - The unique identifier for this element 7 | extraClasses:String - Any additional classes that this element should have 8 | --> 9 | <#macro section id="" extraClasses=""> 10 | 11 |
id="${id}" class="section<#if extraClasses?has_content> ${extraClasses}"> 12 | <#nested /> 13 |
14 | 15 | -------------------------------------------------------------------------------- /src/test/java/io/linuxserver/fleet/auth/security/PBKDF2PasswordEncoderTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.auth.security; 19 | 20 | import org.junit.Test; 21 | 22 | import static org.hamcrest.CoreMatchers.equalTo; 23 | import static org.hamcrest.CoreMatchers.is; 24 | import static org.hamcrest.MatcherAssert.assertThat; 25 | 26 | public class PBKDF2PasswordEncoderTest { 27 | 28 | private static final String HASH_FOR_PASSWORD = "AEGvVmpwYMMYdW5XkX5lqQWKsuZp0fSIxo27KUaI7nPqHF1gTVFvKlEIJyN9FJWsBG5bF59v5axUg2gpyqAsNbT7l9nT5KwKenfkcx7IVEo="; 29 | 30 | private PBKDF2PasswordEncoder encoder = new PBKDF2PasswordEncoder("superSecret"); 31 | 32 | @Test 33 | public void shouldGenerateHash() { 34 | assertThat(encoder.matches("password", HASH_FOR_PASSWORD), is(equalTo(true))); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/test/java/io/linuxserver/fleet/v2/thread/schedule/TimeWithUnitTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 LinuxServer.io 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 3 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | package io.linuxserver.fleet.v2.thread.schedule; 19 | 20 | import org.junit.Test; 21 | 22 | import java.util.concurrent.TimeUnit; 23 | 24 | import static org.hamcrest.CoreMatchers.is; 25 | import static org.hamcrest.MatcherAssert.assertThat; 26 | import static org.hamcrest.core.IsEqual.equalTo; 27 | 28 | public class TimeWithUnitTest { 29 | 30 | @Test 31 | public void shouldConvertToLowestUnit() { 32 | 33 | final TimeWithUnit minutes = new TimeWithUnit(30, TimeUnit.MINUTES); 34 | final TimeWithUnit hours = new TimeWithUnit(3, TimeUnit.HOURS); 35 | 36 | assertThat(minutes.convertToLowestUnit(hours).getTimeUnit(), is(equalTo(TimeUnit.MINUTES))); 37 | assertThat(minutes.convertToLowestUnit(hours).getTimeDuration(), is(equalTo(30L))); 38 | 39 | assertThat(hours.convertToLowestUnit(minutes).getTimeUnit(), is(equalTo(TimeUnit.MINUTES))); 40 | assertThat(hours.convertToLowestUnit(minutes).getTimeDuration(), is(equalTo(180L))); 41 | } 42 | } 43 | --------------------------------------------------------------------------------